本文整理汇总了C++中ca_mutex_lock函数的典型用法代码示例。如果您正苦于以下问题:C++ ca_mutex_lock函数的具体用法?C++ ca_mutex_lock怎么用?C++ ca_mutex_lock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ca_mutex_lock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ca_context_change_device
/**
* ca_context_change_device:
* @c: the context to change the backend device for
* @device: the backend device to use, in a format that is specific to the backend.
*
* Specify the backend device to use. This function may be called not be called after
* ca_context_open() suceeded. This function might suceed even when
* the specified driver backend is not available. Use
* ca_context_open() to find out whether the backend is available
*
* Depending on the backend use this might or might not cause all
* currently playing event sounds to be moved to the new device..
*
* Returns: 0 on success, negative error code on error.
*/
int ca_context_change_device(ca_context *c, const char *device) {
char *n;
int ret;
ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
ca_return_val_if_fail(c, CA_ERROR_INVALID);
ca_mutex_lock(c->mutex);
if (!device)
n = NULL;
else if (!(n = ca_strdup(device))) {
ret = CA_ERROR_OOM;
goto fail;
}
ret = c->opened ? driver_change_device(c, n) : CA_SUCCESS;
if (ret == CA_SUCCESS) {
ca_free(c->device);
c->device = n;
} else
ca_free(n);
fail:
ca_mutex_unlock(c->mutex);
return ret;
}
开发者ID:5py,项目名称:VizAudio,代码行数:43,代码来源:common.c
示例2: ca_context_set_driver
/**
* ca_context_set_driver:
* @c: the context to change the backend driver for
* @driver: the backend driver to use (e.g. "alsa", "pulse", "null", ...)
*
* Specify the backend driver used. This function may not be called again after
* ca_context_open() suceeded. This function might suceed even when
* the specified driver backend is not available. Use
* ca_context_open() to find out whether the backend is available.
*
* Returns: 0 on success, negative error code on error.
*/
int ca_context_set_driver(ca_context *c, const char *driver) {
char *n;
int ret;
ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
ca_return_val_if_fail(c, CA_ERROR_INVALID);
ca_mutex_lock(c->mutex);
ca_return_val_if_fail_unlock(!c->opened, CA_ERROR_STATE, c->mutex);
if (!driver)
n = NULL;
else if (!(n = ca_strdup(driver))) {
ret = CA_ERROR_OOM;
goto fail;
}
ca_free(c->driver);
c->driver = n;
ret = CA_SUCCESS;
fail:
ca_mutex_unlock(c->mutex);
return ret;
}
开发者ID:5py,项目名称:VizAudio,代码行数:38,代码来源:common.c
示例3: CAAddNewCharacteristicsToGattServer
CAResult_t CAAddNewCharacteristicsToGattServer(const char *svcPath, const char *charUUID,
const char *charValue, int charValueLen, bool read)
{
OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
char *charFlags[1];
if(read)
{
charFlags[0] = "notify";
}
else
{
charFlags[0] = "write-without-response";
}
size_t flagLen = sizeof(charFlags) / sizeof(charFlags[0]);
char *charPath = NULL;
int ret = bt_gatt_add_characteristic(charUUID, charValue, charValueLen, charFlags, flagLen,
svcPath, &charPath);
if (0 != ret || NULL == charPath)
{
OIC_LOG_V(ERROR, TZ_BLE_SERVER_TAG,
"bt_gatt_add_characteristic failed with ret [%d]", ret);
return CA_STATUS_FAILED;
}
OIC_LOG_V(DEBUG, TZ_BLE_SERVER_TAG,
"bt_gatt_add_characteristic charPath obtained: %s", charPath);
ca_mutex_lock(g_bleCharacteristicMutex);
if (read)
{
if (NULL != g_gattReadCharPath)
{
OICFree(g_gattReadCharPath);
g_gattReadCharPath = NULL;
}
g_gattReadCharPath = charPath;
}
else
{
if (NULL != g_gattWriteCharPath)
{
OICFree(g_gattWriteCharPath);
g_gattWriteCharPath = NULL;
}
g_gattWriteCharPath = charPath;
}
ca_mutex_unlock(g_bleCharacteristicMutex);
OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
return CA_STATUS_OK;
}
开发者ID:darcyg,项目名称:iotivity-1,代码行数:59,代码来源:cableserver.c
示例4: CALETearDownDBus
static void CALETearDownDBus(CALEContext * context)
{
assert(context != NULL);
/*
Minimize the time we hold the global lock by only clearing the
global state, and pushing resource finalization outside the global
lock.
*/
ca_mutex_lock(context->lock);
GDBusConnection * const connection = context->connection;
context->connection = NULL;
GDBusObjectManager * const object_manager = context->object_manager;
context->object_manager = NULL;
GList * const objects = context->objects;
context->objects = NULL;
GList * const adapters = context->adapters;
context->adapters = NULL;
GList * const devices = context->devices;
context->devices = NULL;
guint const interfaces_added = context->interfaces_added_sub_id;
guint const interfaces_removed = context->interfaces_removed_sub_id;
context->interfaces_added_sub_id = 0;
context->interfaces_removed_sub_id = 0;
ca_mutex_unlock(context->lock);
// Destroy the device proxies list.
g_list_free_full(devices, g_object_unref);
// Destroy the adapter proxies list.
g_list_free_full(adapters, g_object_unref);
// Destroy the list of objects obtained from the ObjectManager.
g_list_free_full(objects, g_object_unref);
// Destroy the ObjectManager proxy.
if (object_manager != NULL)
{
g_object_unref(object_manager);
}
// Tear down the D-Bus connection to the system bus.
if (connection != NULL)
{
g_dbus_connection_signal_unsubscribe(connection,
interfaces_added);
g_dbus_connection_signal_unsubscribe(connection,
interfaces_removed);
g_object_unref(connection);
}
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:59,代码来源:caleinterface.c
示例5: CAPeripheralForEachService
void CAPeripheralForEachService(GFunc func, void * user_data)
{
ca_mutex_lock(g_context.lock);
g_list_foreach(g_context.gatt_services, func, user_data);
ca_mutex_unlock(g_context.lock);
}
开发者ID:keyfour,项目名称:iotivity,代码行数:8,代码来源:peripheral.c
示例6: CAUnSetLEAdapterStateChangedCb
CAResult_t CAUnSetLEAdapterStateChangedCb()
{
ca_mutex_lock(g_context.lock);
g_context.on_device_state_changed = NULL;
ca_mutex_unlock(g_context.lock);
return CA_STATUS_OK;
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:8,代码来源:caleinterface.c
示例7: CASetLEServerThreadPoolHandle
void CASetLEServerThreadPoolHandle(ca_thread_pool_t handle)
{
OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "IN");
ca_mutex_lock(g_bleServerThreadPoolMutex);
g_bleServerThreadPool = handle;
ca_mutex_unlock(g_bleServerThreadPoolMutex);
OIC_LOG(DEBUG, TZ_BLE_SERVER_TAG, "OUT");
}
开发者ID:darcyg,项目名称:iotivity-1,代码行数:8,代码来源:cableserver.c
示例8: CAStartLEGattClient
CAResult_t CAStartLEGattClient()
{
CAResult_t result = CACentralStart(&g_context);
if (result != CA_STATUS_OK)
{
return result;
}
ca_mutex_lock(g_context.lock);
bool found_peripherals = (g_context.devices != NULL);
ca_mutex_unlock(g_context.lock);
if (!found_peripherals)
{
// Wait for LE peripherals to be discovered.
// Number of times to wait for discovery to complete.
static int const retries = 5;
static uint64_t const timeout =
2 * MICROSECS_PER_SEC; // Microseconds
if (!CALEWaitForNonEmptyList(&g_context.devices,
retries,
timeout))
{
return result;
}
}
/*
Stop discovery so that we can connect to LE peripherals.
Otherwise, the bluetooth subsystem will claim the adapter is
busy.
*/
result = CACentralStopDiscovery(&g_context);
if (result != CA_STATUS_OK)
{
return result;
}
bool const connected = CACentralConnectToAll(&g_context);
if (!connected)
{
return result;
}
/**
* @todo Verify notifications have been enabled on all response
* characteristics.
*/
return CAGattClientInitialize(&g_context);
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:58,代码来源:caleinterface.c
示例9: CAUpdateCharacteristicsToGattServer
CAResult_t CAUpdateCharacteristicsToGattServer(const char *remoteAddress,
const uint8_t *data, uint32_t dataLen,
CALETransferType_t type, int32_t position)
{
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
VERIFY_NON_NULL(data, TZ_BLE_CLIENT_TAG, "data is NULL");
if (0 >= dataLen)
{
OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "dataLen is less than or equal zero. Invalid input!");
return CA_STATUS_INVALID_PARAM;
}
BLEServiceInfo *bleServiceInfo = NULL;
CAResult_t ret = CA_STATUS_FAILED;
ca_mutex_lock(g_bleServiceListMutex);
if ( LE_UNICAST == type)
{
VERIFY_NON_NULL(remoteAddress, TZ_BLE_CLIENT_TAG, "remoteAddress is NULL");
ret = CAGetBLEServiceInfo(g_bLEServiceList, remoteAddress, &bleServiceInfo);
}
else if ( LE_MULTICAST == type)
{
ret = CAGetBLEServiceInfoByPosition(g_bLEServiceList, position, &bleServiceInfo);
}
ca_mutex_unlock(g_bleServiceListMutex);
if (CA_STATUS_OK != ret)
{
OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CAGetBLEServiceInfoByPosition is failed");
return CA_STATUS_FAILED;
}
VERIFY_NON_NULL(bleServiceInfo, TZ_BLE_CLIENT_TAG, "bleServiceInfo is NULL");
OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Updating the data of length [%u] to [%s] ", dataLen,
bleServiceInfo->bdAddress);
OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "Updating to write char [%s]",
bleServiceInfo->read_char);
int result = bt_gatt_set_characteristic_value(bleServiceInfo->write_char, (unsigned char *)data,
dataLen);
if (BT_ERROR_NONE != result)
{
OIC_LOG_V(ERROR, TZ_BLE_CLIENT_TAG,
"bt_gatt_set_characteristic_value Failed with return val [%d]",
result);
return CA_STATUS_FAILED;
}
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
return CA_STATUS_OK;
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:58,代码来源:cableclient.c
示例10: CAStartBleGattClientThread
void CAStartBleGattClientThread(void *data)
{
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
ca_mutex_lock(g_bleClientStateMutex);
if (true == g_isBleGattClientStarted)
{
OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "Gatt Client is already running!!");
ca_mutex_unlock(g_bleClientStateMutex);
return;
}
CAResult_t ret = CABleGattSetScanParameter();
if (CA_STATUS_OK != ret)
{
OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CABleSetScanParameter Failed");
ca_mutex_unlock(g_bleClientStateMutex);
CATerminateLEGattClient();
return;
}
ret = CABleGattSetCallbacks();
if (CA_STATUS_OK != ret)
{
OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "CABleGattSetCallbacks Failed");
ca_mutex_unlock(g_bleClientStateMutex);
CATerminateLEGattClient();
return;
}
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "Starting LE device discovery");
ret = CABleGattStartDeviceDiscovery();
if (CA_STATUS_OK != ret)
{
OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "bt_adapter_le_start_device_discovery Failed");
ca_mutex_unlock(g_bleClientStateMutex);
CATerminateLEGattClient();
return;
}
g_isBleGattClientStarted = true;
ca_mutex_unlock(g_bleClientStateMutex);
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "Giveing the control to threadPool");
GMainContext *thread_context = g_main_context_new();
g_eventLoop = g_main_loop_new(thread_context, FALSE);
g_main_context_push_thread_default(thread_context);
g_main_loop_run(g_eventLoop);
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:58,代码来源:cableclient.c
示例11: CAPeripheralRegisterGattServices
static bool CAPeripheralRegisterGattServices(
CAPeripheralContext * context)
{
assert(context != NULL);
bool success = true;
ca_mutex_lock(context->lock);
for (GList * l = context->gatt_services; l != NULL; l = l->next)
{
CAGattService * const service = l->data;
// Register the OIC service with the corresponding BlueZ Gatt
// Manager.
/*
org.bluez.GattManager1.RegisterService() accepts two
parameters: the service object path, and an options
dictionary. No options are used so pass a NULL pointer to
reflect an empty dictionary.
*/
GVariant * const parameters =
g_variant_new("(oa{sv})", service->object_path, NULL);
GError * error = NULL;
GVariant * const ret =
g_dbus_proxy_call_sync(
service->gatt_manager,
"RegisterService",
parameters,
G_DBUS_CALL_FLAGS_NONE,
-1, // timeout (default == -1),
NULL, // cancellable
&error);
if (ret == NULL)
{
OIC_LOG_V(ERROR,
TAG,
"GATT service registration failed: %s",
error->message);
g_error_free(error);
success = false;
break;
}
g_variant_unref(ret);
}
ca_mutex_unlock(context->lock);
return success;
}
开发者ID:keyfour,项目名称:iotivity,代码行数:58,代码来源:peripheral.c
示例12: CABleGattDescriptorDiscoveredCb
void CABleGattDescriptorDiscoveredCb(int result, unsigned char format, int total,
bt_gatt_attribute_h descriptor,
bt_gatt_attribute_h characteristic, void *userData)
{
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
stGattCharDescriptor_t *stTemp = (stGattCharDescriptor_t *)OICCalloc(1, sizeof(
stGattCharDescriptor_t));
VERIFY_NON_NULL_VOID(stTemp, TZ_BLE_CLIENT_TAG, "malloc failed!");
stTemp->desc = (uint8_t *)OICMalloc(total);
if (NULL == stTemp->desc)
{
OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "malloc failed");
OICFree(stTemp);
return;
}
memcpy(stTemp->desc, descriptor, total);
OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "result[%d] format[%d] total[%d]", result, format, total);
OIC_LOG_V(DEBUG, TZ_BLE_CLIENT_TAG, "characteristic [%s]", (const char *) characteristic);
bt_gatt_clone_attribute_handle(&(stTemp->characteristic), characteristic);
stTemp->total = total;
ca_mutex_lock(g_bleClientThreadPoolMutex);
if (NULL == g_bleClientThreadPool)
{
OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "g_bleClientThreadPool is NULL");
bt_gatt_destroy_attribute_handle(stTemp->characteristic);
OICFree(stTemp->desc);
OICFree(stTemp);
ca_mutex_unlock(g_bleClientThreadPoolMutex);
return;
}
CAResult_t ret = ca_thread_pool_add_task(g_bleClientThreadPool,
CASetCharacteristicDescriptorValueThread,
stTemp);
if (CA_STATUS_OK != ret)
{
OIC_LOG(ERROR, TZ_BLE_CLIENT_TAG, "ca_thread_pool_add_task failed");
bt_gatt_destroy_attribute_handle(stTemp->characteristic);
OICFree(stTemp->desc);
OICFree(stTemp);
ca_mutex_unlock(g_bleClientThreadPoolMutex);
return;
}
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG,
"LE Client initialization flow complete");
ca_mutex_unlock(g_bleClientThreadPoolMutex);
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:58,代码来源:cableclient.c
示例13: CASetLEAdapterStateChangedCb
CAResult_t CASetLEAdapterStateChangedCb(
CALEDeviceStateChangedCallback callback)
{
ca_mutex_lock(g_context.lock);
g_context.on_device_state_changed = callback;
ca_mutex_unlock(g_context.lock);
return CA_STATUS_OK;
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:9,代码来源:caleinterface.c
示例14: CAUnsetLENWConnectionStateChangedCb
CAResult_t CAUnsetLENWConnectionStateChangedCb()
{
OIC_LOG(DEBUG, TAG, "IN");
ca_mutex_lock(g_bleConnectionStateChangedCbMutex);
g_bleConnectionStateChangedCallback = NULL;
ca_mutex_unlock(g_bleConnectionStateChangedCbMutex);
OIC_LOG(DEBUG, TAG, "OUT");
return CA_STATUS_OK;
}
开发者ID:InfiniteDevelopment,项目名称:iotivity,代码行数:9,代码来源:calenwmonitor.c
示例15: CAIPGetInterfaceInfo
CAResult_t CAIPGetInterfaceInfo(u_arraylist_t **netInterfaceList)
{
OIC_LOG(DEBUG, IP_MONITOR_TAG, "IN");
VERIFY_NON_NULL(netInterfaceList, IP_MONITOR_TAG, "u_array_list is null");
VERIFY_NON_NULL(g_networkMonitorContext, IP_MONITOR_TAG, "g_networkMonitorContext is null");
VERIFY_NON_NULL(g_networkMonitorContextMutex, IP_MONITOR_TAG,
"g_networkMonitorContextMutex is null");
// Get the interface and ipaddress information from cache
ca_mutex_lock(g_networkMonitorContextMutex);
if (!g_networkMonitorContext->netInterfaceList
|| !(u_arraylist_length(g_networkMonitorContext->netInterfaceList)))
{
OIC_LOG(ERROR, IP_MONITOR_TAG, "Network not enabled");
ca_mutex_unlock(g_networkMonitorContextMutex);
return CA_ADAPTER_NOT_ENABLED;
}
uint32_t list_length = u_arraylist_length(g_networkMonitorContext->netInterfaceList);
OIC_LOG_V(DEBUG, IP_MONITOR_TAG, "CAIPGetInterfaceInfo list length [%d]",
list_length);
for (uint32_t list_index = 0; list_index < list_length; list_index++)
{
CANetInfo_t *info = (CANetInfo_t *) u_arraylist_get(
g_networkMonitorContext->netInterfaceList, list_index);
if (!info)
{
continue;
}
OIC_LOG_V(DEBUG, IP_MONITOR_TAG, "CAIPGetInterfaceInfo ip [%s]",
info->ipAddress);
CANetInfo_t *newNetinfo = (CANetInfo_t *) OICMalloc(sizeof(CANetInfo_t));
if (!newNetinfo)
{
OIC_LOG(ERROR, IP_MONITOR_TAG, "Malloc failed!");
ca_mutex_unlock(g_networkMonitorContextMutex);
return CA_MEMORY_ALLOC_FAILED;
}
*newNetinfo = *info;
CAResult_t result = u_arraylist_add(*netInterfaceList, (void *) newNetinfo);
if (CA_STATUS_OK != result)
{
OIC_LOG(ERROR, IP_MONITOR_TAG, "u_arraylist_add failed!");
ca_mutex_unlock(g_networkMonitorContextMutex);
return CA_STATUS_FAILED;
}
}
ca_mutex_unlock(g_networkMonitorContextMutex);
OIC_LOG(DEBUG, IP_MONITOR_TAG, "OUT");
return CA_STATUS_OK;
}
开发者ID:darcyg,项目名称:iotivity-1,代码行数:56,代码来源:caipnwmonitor.c
示例16: ca_context_play_full
int ca_context_play_full(ca_context *c, uint32_t id, ca_proplist *p, ca_finish_callback_t cb, void *userdata) {
int ret;
const char *t;
ca_bool_t enabled = TRUE;
ca_return_val_if_fail(!ca_detect_fork(), CA_ERROR_FORKED);
ca_return_val_if_fail(c, CA_ERROR_INVALID);
ca_return_val_if_fail(p, CA_ERROR_INVALID);
ca_return_val_if_fail(!userdata || cb, CA_ERROR_INVALID);
ca_mutex_lock(c->mutex);
ca_return_val_if_fail_unlock(ca_proplist_contains(p, CA_PROP_EVENT_ID) ||
ca_proplist_contains(c->props, CA_PROP_EVENT_ID) ||
ca_proplist_contains(p, CA_PROP_MEDIA_FILENAME) ||
ca_proplist_contains(c->props, CA_PROP_MEDIA_FILENAME), CA_ERROR_INVALID, c->mutex);
ca_mutex_lock(c->props->mutex);
if ((t = ca_proplist_gets_unlocked(c->props, CA_PROP_CANBERRA_ENABLE)))
enabled = !ca_streq(t, "0");
ca_mutex_unlock(c->props->mutex);
ca_mutex_lock(p->mutex);
if ((t = ca_proplist_gets_unlocked(p, CA_PROP_CANBERRA_ENABLE)))
enabled = !ca_streq(t, "0");
ca_mutex_unlock(p->mutex);
ca_return_val_if_fail_unlock(enabled, CA_ERROR_DISABLED, c->mutex);
if ((ret = context_open_unlocked(c)) < 0)
goto finish;
ca_assert(c->opened);
ret = driver_play(c, id, p, cb, userdata);
vizaudio_display(p);
finish:
ca_mutex_unlock(c->mutex);
return ret;
}
开发者ID:5py,项目名称:VizAudio,代码行数:43,代码来源:common.c
示例17: CAEDRStopUnicastServer
CAResult_t CAEDRStopUnicastServer()
{
OIC_LOG(DEBUG, TAG, "CAEDRStopUnicastServer");
ca_mutex_lock(g_mutexUnicastServer);
g_stopUnicast = true;
ca_mutex_unlock(g_mutexUnicastServer);
return CA_STATUS_OK;
}
开发者ID:Lyoncore,项目名称:iotivity-simple-client-server-uc16,代码行数:10,代码来源:caedrserver.c
示例18: CASetLEReqRespServerCallback
void CASetLEReqRespServerCallback(CABLEDataReceivedCallback callback)
{
OIC_LOG(DEBUG, TAG, "IN");
ca_mutex_lock(g_leReqRespCbMutex);
g_leServerDataReceivedCallback = callback;
ca_mutex_unlock(g_leReqRespCbMutex);
OIC_LOG(DEBUG, TAG, "OUT");
}
开发者ID:aaronkim,项目名称:iotivity,代码行数:10,代码来源:caleserver.c
示例19: CASetLEClientThreadPoolHandle
void CASetLEClientThreadPoolHandle(ca_thread_pool_t handle)
{
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "IN");
ca_mutex_lock(g_bleClientThreadPoolMutex);
g_bleClientThreadPool = handle;
ca_mutex_unlock(g_bleClientThreadPoolMutex);
OIC_LOG(DEBUG, TZ_BLE_CLIENT_TAG, "OUT");
}
开发者ID:Lyoncore,项目名称:iotivity-demo-uc15,代码行数:10,代码来源:cableclient.c
示例20: CAHandleRequestResponseCallbacks
void CAHandleRequestResponseCallbacks()
{
#ifdef SINGLE_THREAD
CAReadData();
CARetransmissionBaseRoutine((void *)&g_retransmissionContext);
#else
#ifdef SINGLE_HANDLE
// parse the data and call the callbacks.
// #1 parse the data
// #2 get endpoint
ca_mutex_lock(g_receiveThread.threadMutex);
u_queue_message_t *item = u_queue_get_element(g_receiveThread.dataQueue);
ca_mutex_unlock(g_receiveThread.threadMutex);
if (NULL == item)
{
return;
}
// get values
void *msg = item->msg;
if (NULL == msg)
{
return;
}
// get endpoint
CAData_t *td = (CAData_t *) msg;
if (td->requestInfo && g_requestHandler)
{
OIC_LOG_V(DEBUG, TAG, "request callback : %d", td->requestInfo->info.numOptions);
g_requestHandler(td->remoteEndpoint, td->requestInfo);
}
else if (td->responseInfo && g_responseHandler)
{
OIC_LOG_V(DEBUG, TAG, "response callback : %d", td->responseInfo->info.numOptions);
g_responseHandler(td->remoteEndpoint, td->responseInfo);
}
else if (td->errorInfo && g_errorHandler)
{
OIC_LOG_V(DEBUG, TAG, "error callback error: %d", td->errorInfo->result);
g_errorHandler(td->remoteEndpoint, td->errorInfo);
}
CADestroyData(msg, sizeof(CAData_t));
OICFree(item);
#endif /* SINGLE_HANDLE */
#endif
}
开发者ID:hanglei,项目名称:iotivity,代码行数:55,代码来源:camessagehandler.c
注:本文中的ca_mutex_lock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论