MESH_LEFT_NETWORK_EVENT = 0x03, /**< This event comes after left the current mesh network */
MESH_STATION_JOIN_EVENT = 0x04, /**< This event takes place when new station joined */
MESH_STATION_LEFT_EVENT = 0x05, /**< This event takes place when existing station left */
+ MESH_CONNECTED_EVENT = 0x06, /**< This event comes after all network connection sequence finished */
} mesh_event_e;
/**
* @since_tizen 4.0
*/
typedef struct {
- unsigned int result; /**< The result of creating or joining mesh network */
+ int result; /**< The result of creating or joining mesh network */
} mesh_mesh_enabled_event_s;
/**
} mesh_other_station_event_s;
/**
+ * @brief The structure type for the MESH_CONNECTED_EVENT callback data.
+ * @details The result of connecting mesh network.
+ *
+ * @since_tizen 4.0
+ */
+typedef struct {
+ int result; /**< The result of connecting mesh network. */
+} mesh_connected_event_s;
+
+/**
* @brief The structure type for response data of mesh_event_cb.
* @details This function can receive events from the devices in the network.
* ex) join, re-join, leave and attribute change report
*/
typedef struct {
union {
- mesh_mesh_enabled_event_s *mesh_enable; /**< The result of enabling zigbee system service. */
+ mesh_mesh_enabled_event_s *mesh_enable; /**< The result of enabling mesh system service. */
mesh_other_station_event_s *sta_info; /**< This event comes from other stations. */
+ mesh_connected_event_s *connected_result; /**< The result of mesh network connection. */
} data;
} mesh_event_data_s;
if (0 == g_strcmp0(signal_name, "mesh_enabled")) {
int result = MESH_ERROR_NONE;
+ mesh_event_data_s ev;
+
g_variant_get(parameters, "(i)", &result);
- result = __convert_service_error_type(result);
- mesh_event_data_s ev;
ev.data.mesh_enable = calloc(1, sizeof(mesh_mesh_enabled_event_s));
RETM_IF(NULL == ev.data.mesh_enable, "Failed to memory allocation !");
- ev.data.mesh_enable->result = result;
+ ev.data.mesh_enable->result = __convert_service_error_type(result);
+
h->event_handler(MESH_MESH_ENABLED_EVENT, &ev);
- g_free(ev.data.mesh_enable);
+ free(ev.data.mesh_enable);
} else if (0 == g_strcmp0(signal_name, "scan_done")) {
h->event_handler(MESH_SCAN_DONE_EVENT, NULL);
} else if (0 == g_strcmp0(signal_name, "joined_network")) {
h->event_handler(MESH_JOIN_NETWORK_EVENT, NULL);
} else if (0 == g_strcmp0(signal_name, "left_network")) {
h->event_handler(MESH_LEFT_NETWORK_EVENT, NULL);
+ } else if (0 == g_strcmp0(signal_name, "mesh_connected")) {
+ int result = MESH_ERROR_NONE;
+ mesh_event_data_s ev;
+
+ g_variant_get(parameters, "(i)", &result);
+
+ ev.data.connected_result = calloc(1, sizeof(mesh_connected_event_s));
+ RETM_IF(NULL == ev.data.connected_result, "Failed to memory allocation !");
+ ev.data.connected_result->result = __convert_service_error_type(result);
+
+ h->event_handler(MESH_CONNECTED_EVENT, &ev);
+ free(ev.data.connected_result);
} else if (0 == g_strcmp0(signal_name, "sta_joined")) {
char *bssid = NULL;
mesh_event_data_s ev;
h->dbus_sub_ids = g_list_append(h->dbus_sub_ids, GUINT_TO_POINTER(id));
LOGD("subscribed for left_network signal %d", id);
+ id = g_dbus_connection_signal_subscribe(h->dbus_connection, NULL, MESH_SERVER_NAME,
+ "mesh_connected", MESH_OBJECT_PATH, NULL,
+ G_DBUS_CALL_FLAGS_NONE, _mesh_signal_handler, h, NULL);
+ if (0 == id) {
+ LOGE("g_dbus_connection_signal_subscribe(mesh_connected) Fail(%d)", errno);
+ return;
+ }
+ h->dbus_sub_ids = g_list_append(h->dbus_sub_ids, GUINT_TO_POINTER(id));
+ LOGD("subscribed for mesh_connected signal %d", id);
id = g_dbus_connection_signal_subscribe(h->dbus_connection, NULL, MESH_SERVER_NAME,
"sta_joined", MESH_OBJECT_PATH, NULL,
CASE_TO_STR(MESH_LEFT_NETWORK_EVENT)
CASE_TO_STR(MESH_STATION_JOIN_EVENT)
CASE_TO_STR(MESH_STATION_LEFT_EVENT)
+ CASE_TO_STR(MESH_CONNECTED_EVENT)
default :
return "MESH_EVENT_UNKNOWN";
}
case MESH_STATION_LEFT_EVENT: {
msgp(" A Station Left = %s", event->data.sta_info->bssid);
} break;
+ case MESH_CONNECTED_EVENT: {
+ msgp(" Connection sequence finished [%s]",
+ mesh_error_to_string(event->data.connected_result->result));
+ } break;
}
}