X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Futil%2Fsrc%2Fcamanager%2Fbt_le_manager%2Ftizen%2Fcaleconnectionmanager.c;fp=resource%2Fcsdk%2Fconnectivity%2Futil%2Fsrc%2Fcamanager%2Ftizen%2Fcaleconnectionmanager.c;h=ecb6f61ba58dd3adb2d3f835b0a84f28ff3ebe0a;hb=7f00f942c39b7bc27c7eeecf213a239c3fe4173c;hp=cc196f27ba037e9ca3cb92eaf5bd0bf3bc31f9b3;hpb=edcfc3d2329da7b914771c0dcff5f42c9b74fd93;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/util/src/camanager/tizen/caleconnectionmanager.c b/resource/csdk/connectivity/util/src/camanager/bt_le_manager/tizen/caleconnectionmanager.c similarity index 54% rename from resource/csdk/connectivity/util/src/camanager/tizen/caleconnectionmanager.c rename to resource/csdk/connectivity/util/src/camanager/bt_le_manager/tizen/caleconnectionmanager.c index cc196f2..ecb6f61 100644 --- a/resource/csdk/connectivity/util/src/camanager/tizen/caleconnectionmanager.c +++ b/resource/csdk/connectivity/util/src/camanager/bt_le_manager/tizen/caleconnectionmanager.c @@ -43,35 +43,32 @@ void CASetLENetworkMonitorCallbacks(CAAdapterStateChangedCB adapterStateCB, { OIC_LOG(DEBUG, TAG, "CASetLENetworkMonitorCallbacks"); - g_adapterStateCB = adapterStateCB; - CASetNetworkMonitorCallback(CAManagerAdapterMonitorHandler); - - g_connStateCB = connStateCB; - CASetLEConnectionStateChangedCallback(CAManagerConnectionMonitorHandler); } -void CAStartServerLEAdvertising() +CAResult_t CAManagerLEStartAdvertising() { - OIC_LOG(DEBUG, TAG, "CAStartServerLEAdvertising"); + OIC_LOG(DEBUG, TAG, "CAManagerLEStartAdvertising"); - CAResult_t res = CALEStartAdvertise(CA_GATT_SERVICE_UUID); + CAResult_t res = CALEStartAdvertise(); if (CA_STATUS_OK != res) { OIC_LOG_V(ERROR, TAG, "Failed to start le advertising [%d]", res); - return; + return res; } + return res; } -void CAStopServerLEAdvertising() +CAResult_t CAManagerLEStopAdvertising() { - OIC_LOG(DEBUG, TAG, "CAStopServerLEAdvertising"); + OIC_LOG(DEBUG, TAG, "CAManagerLEStopAdvertising"); CAResult_t res = CALEStopAdvertise(); if (CA_STATUS_OK != res) { OIC_LOG_V(ERROR, TAG, "Failed to stop le advertising [%d]", res); - return; + return res; } + return res; } CAResult_t CASetLEClientAutoConnectionDeviceInfo(const char * address) @@ -87,58 +84,28 @@ CAResult_t CAUnsetLEClientAutoConnectionDeviceInfo(const char * address) (void)address; return CA_NOT_SUPPORTED; } - -static void CAManagerAdapterMonitorHandler(const CAEndpoint_t *info, CANetworkStatus_t status) +#if defined(__TIZEN__) && defined(LE_ADAPTER) && defined(BLE_CUSTOM_ADVERTISE) +CAResult_t CAManagerLEServerSetAdvertisementData(const char *data, int length) { - if (CA_INTERFACE_DOWN == status) - { - if (info && g_adapterStateCB) - { - g_adapterStateCB(info->adapter, false); - OIC_LOG(DEBUG, TAG, "Pass the disabled adapter state to upper layer"); - } - } - else if (CA_INTERFACE_UP == status) + + CAResult_t res = CAsetServerAdvertisementData(data, length); + + if (CA_STATUS_OK != res) { - if (info && g_adapterStateCB) - { - g_adapterStateCB(info->adapter, true); - OIC_LOG(DEBUG, TAG, "Pass the enabled adapter state to upper layer"); - } + OIC_LOG_V(ERROR, TAG, "Failed to stop le CAManagerLEServerSetAdvertisementData [%d]", res); + return; } } -static void CAManagerConnectionMonitorHandler(CATransportAdapter_t adapter, - const char *remoteAddress, bool connected) +CAResult_t CAManagerLEServerSetScanResponseData(const char *data, int length) { - (void)adapter; - if (!remoteAddress) - { - OIC_LOG(ERROR, TAG, "remoteAddress is NULL"); - return; - } + CAResult_t res = CAsetServerSanResponseData(data, length); - if (connected) - { - if (g_connStateCB) - { - g_connStateCB(CA_ADAPTER_GATT_BTLE, remoteAddress, true); - OIC_LOG(DEBUG, TAG, "Pass the connected device info to upper layer"); - - // stop le advertising - CAStopServerLEAdvertising(); - } - } - else + if (CA_STATUS_OK != res) { - if (g_connStateCB) - { - g_connStateCB(CA_ADAPTER_GATT_BTLE, remoteAddress, false); - OIC_LOG(DEBUG, TAG, "Pass the disconnected device info to upper layer"); - - // start le advertising to receive new connection request. - CAStartServerLEAdvertising(); - } + OIC_LOG_V(ERROR, TAG, "Failed to stop le CAsetServerSanResponseData [%d]", res); + return; } } +#endif