summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnupam Roy <anupam.r@samsung.com>2020-07-30 16:11:01 +0530
committerAnupam Roy <anupam.r@samsung.com>2020-07-30 16:15:09 +0530
commit59f041f509497848a78cbc6ba3748ef63dba9c66 (patch)
treef578c75e73d356c0aae2040c9c050c67e3daa08c
parentde84669fae9b492614fb41b416762ffbba1d9608 (diff)
downloadbluetooth-submit/tizen/20200731.001830.tar.gz
bluetooth-submit/tizen/20200731.001830.tar.bz2
bluetooth-submit/tizen/20200731.001830.zip
This patch handles following- - Don't create node handle and send to application if Remote Node Discovery fails. Node Browsing is mandatory command to discover remote node composition. Without remote node composition, node handle is meaningless. Therefore, send NULL in node handle incase Node Browsing fails. - Send Node feature information only when remote node feature command is successful. Change-Id: I85c78c89a22cf50cccb321f8d3d7fbeaee20a6ef Signed-off-by: Anupam Roy <anupam.r@samsung.com>
-rw-r--r--src/bluetooth-common.c74
-rw-r--r--src/bluetooth-mesh.c1
2 files changed, 43 insertions, 32 deletions
diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c
index cfc6278..f9a73e9 100644
--- a/src/bluetooth-common.c
+++ b/src/bluetooth-common.c
@@ -3744,18 +3744,22 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
if (!info)
break;
- if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
+ if (_bt_get_error_code(param->result) == BT_ERROR_NONE) {
BT_INFO("Mesh: Remote Node Browsing: SUCCESS");
- else
- BT_INFO("Mesh: Remote Node Browsing: Failed");
- node_s = _bt_mesh_remote_node_browsed(res->net_uuid, res->dev_uuid,
- res->unicast, res->count);
-
- ((bt_mesh_node_discover_status_cb)
- bt_event_slot_container[event_index].callback)
+ node_s = _bt_mesh_remote_node_browsed(res->net_uuid, res->dev_uuid,
+ res->unicast, res->count);
+ ((bt_mesh_node_discover_status_cb)
+ bt_event_slot_container[event_index].callback)
(_bt_get_error_code(param->result), (bt_mesh_network_h) info,
- (bt_mesh_node_h) node_s,
- bt_event_slot_container[event_index].user_data);
+ (bt_mesh_node_h) node_s,
+ bt_event_slot_container[event_index].user_data);
+ } else {
+ BT_INFO("Mesh: Remote Node Browsing: FAILED");
+ ((bt_mesh_node_discover_status_cb)
+ bt_event_slot_container[event_index].callback)
+ (_bt_get_error_code(param->result), (bt_mesh_network_h) info,
+ NULL, bt_event_slot_container[event_index].user_data);
+ }
break;
} case BLUETOOTH_EVENT_MESH_NODE_VENDOR_FEATURES: {
BT_INFO("BLUETOOTH_EVENT_MESH_NODE_VENDOR_FEATURES");
@@ -3768,33 +3772,39 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
if (!network_s)
break;
- if (_bt_get_error_code(param->result) == BT_ERROR_NONE)
- BT_INFO("Mesh: Node Vendor Features: SUCCESS");
- else
- BT_INFO("Mesh: Node Vendor Features: Failed");
node_s = _bt_mesh_remote_node_browsed(res->net_uuid, res->dev_uuid,
res->unicast, res->elem_count);
if (!node_s)
break;
- node_s->features.cid = res->vendor_info.companyid;
- node_s->features.pid = res->vendor_info.versionid;
- node_s->features.vid = res->vendor_info.vendorid;
- node_s->features.crpl = res->vendor_info.crpl;
-
- if (res->features.relay)
- node_s->features.features = BT_MESH_FEATURE_RELAY;
- if (res->features.proxy)
- node_s->features.features |= BT_MESH_FEATURE_PROXY;
- if (res->features.frnd)
- node_s->features.features |= BT_MESH_FEATURE_FRIEND;
- if (res->features.lpn)
- node_s->features.features |= BT_MESH_FEATURE_LOWPOWER;
-
- ((bt_mesh_node_features_cb)
- bt_event_slot_container[event_index].callback)
+
+ if (_bt_get_error_code(param->result) == BT_ERROR_NONE) {
+ BT_INFO("Mesh: Node Vendor Features: SUCCESS");
+ node_s->features.cid = res->vendor_info.companyid;
+ node_s->features.pid = res->vendor_info.versionid;
+ node_s->features.vid = res->vendor_info.vendorid;
+ node_s->features.crpl = res->vendor_info.crpl;
+
+ if (res->features.relay)
+ node_s->features.features = BT_MESH_FEATURE_RELAY;
+ if (res->features.proxy)
+ node_s->features.features |= BT_MESH_FEATURE_PROXY;
+ if (res->features.frnd)
+ node_s->features.features |= BT_MESH_FEATURE_FRIEND;
+ if (res->features.lpn)
+ node_s->features.features |= BT_MESH_FEATURE_LOWPOWER;
+
+ ((bt_mesh_node_features_cb)
+ bt_event_slot_container[event_index].callback)
(_bt_get_error_code(param->result), (bt_mesh_node_h) node_s,
- (bt_mesh_node_features_s*)&node_s->features,
- bt_event_slot_container[event_index].user_data);
+ (bt_mesh_node_features_s*)&node_s->features,
+ bt_event_slot_container[event_index].user_data);
+ } else {
+ BT_INFO("Mesh: Node Vendor Features: FAILED");
+ ((bt_mesh_node_features_cb)
+ bt_event_slot_container[event_index].callback)
+ (_bt_get_error_code(param->result), (bt_mesh_node_h) node_s,
+ NULL, bt_event_slot_container[event_index].user_data);
+ }
break;
} case BLUETOOTH_EVENT_MESH_NODE_KEY_CONFIGURED : {
BT_INFO("BLUETOOTH_EVENT_MESH_NODE_KEY_CONFIGURED");
diff --git a/src/bluetooth-mesh.c b/src/bluetooth-mesh.c
index 3ab088c..243e206 100644
--- a/src/bluetooth-mesh.c
+++ b/src/bluetooth-mesh.c
@@ -2193,6 +2193,7 @@ int bt_mesh_network_discover_node(bt_mesh_network_h network,
BT_MESH_VALIDATE_HANDLE(network, networks);
+ BT_INFO("Mesh: Discover Node with UUID[%s]", dev_uuid);
/* Check if node with dev_uuid is already created */
network_s = (bt_mesh_network_s*)network;