{
CA_DEFAULT_BT_FLAGS = 0,
// flags for BLE transport
- CA_LE_ADV_DISABLE = 0x1, // disable BLE advertisement
- CA_LE_ADV_ENABLE = 0x2, // enable BLE advertisement
+ CA_LE_ADV_DISABLE = 0x1, // disable BLE advertisement.
+ CA_LE_ADV_ENABLE = 0x2, // enable BLE advertisement.
+ CA_LE_SERVER_DISABLE = (1 << 4), // disable gatt server.
// flags for EDR transport
CA_EDR_SERVER_DISABLE = (1 << 7)
} CATransportBTFlags_t;
{
CANetworkStatus_t newStatus = CA_INTERFACE_UP;
CALEClientCreateDeviceList();
- CALEServerCreateCachedDeviceList();
+
+ if (!(caglobals.bleFlags & CA_LE_SERVER_DISABLE))
+ {
+ CALEServerCreateCachedDeviceList();
+ }
g_bleDeviceStateChangedCallback(newStatus);
}
{
OIC_LOG(DEBUG, CALEADAPTER_TAG, "Before CAStartLEGattServer");
+ if (caglobals.bleFlags & CA_LE_SERVER_DISABLE)
+ {
+ OIC_LOG_V(INFO, CALEADAPTER_TAG, "server's flag is disabled in configuration [%d]",
+ caglobals.bleFlags);
+ return CA_STATUS_OK;
+ }
+
CAResult_t result = CAStartLEGattServer();
#ifndef SINGLE_THREAD
static CAResult_t CALEAdapterGattServerStop()
{
+ OIC_LOG(DEBUG, CALEADAPTER_TAG, "Server Stop");
+
+ if (caglobals.bleFlags & CA_LE_SERVER_DISABLE)
+ {
+ OIC_LOG_V(INFO, CALEADAPTER_TAG, "server flag of configure is disable [%d]",
+ caglobals.bleFlags);
+ return CA_STATUS_OK;
+ }
+
#ifndef SINGLE_THREAD
- OIC_LOG(DEBUG, CALEADAPTER_TAG, "CALEAdapterGattServerStop");
CAResult_t res = CAStopLEGattServer();
if (CA_STATUS_OK != res)
static CAResult_t CAStartLEListeningServer()
{
OIC_LOG(DEBUG, CALEADAPTER_TAG, "IN - CAStartLEListeningServer");
+
+ if (caglobals.bleFlags & CA_LE_SERVER_DISABLE)
+ {
+ OIC_LOG_V(INFO, CALEADAPTER_TAG, "server flag of configure is disable [%d]",
+ caglobals.bleFlags);
+ return CA_STATUS_OK;
+ }
+
#ifndef ROUTING_GATEWAY
CAResult_t result = CA_STATUS_OK;
#ifndef SINGLE_THREAD
CAResult_t CAUtilSetBTConfigure(CAUtilConfig_t config)
{
OIC_LOG_V(DEBUG, TAG, "CAUtilSetConfigure");
- OIC_LOG_V(DEBUG, TAG, "bleFlag [%d]", config.bleFlags);
#if (defined(__ANDROID__) && defined(LE_ADAPTER))
+ OIC_LOG_V(DEBUG, TAG, "bleFlag [%d]", config.bleFlags);
CAManagerSetConfigure(config);
return CA_STATUS_OK;
#else
typedef enum
{
+ /** default flag is 0.*/
OC_DEFAULT_BT_FLAGS = 0,
- // flags for BLE transport
- OC_LE_ADV_DISABLE = 0x1, // disable BLE advertisement
- OC_LE_ADV_ENABLE = 0x2, // enable BLE advertisement
- // flags for EDR transport
+ /** disable BLE advertisement.*/
+ OC_LE_ADV_DISABLE = 0x1,
+ /** enable BLE advertisement.*/
+ OC_LE_ADV_ENABLE = 0x2,
+ /** disable gatt server.*/
+ OC_LE_SERVER_DISABLE = (1 << 4),
+ /** disable rfcomm server.*/
OC_EDR_SERVER_DISABLE = (1 << 7)
} OCTransportBTFlags_t;