Fix the crash in CONTROLLER_ERROR event
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-adapter-mgr.c
index 57e9755..6b66301 100644 (file)
@@ -80,6 +80,7 @@ extern void cb_rssi_monitor_state_changed(bt_bdaddr_t *bd_addr, int32_t link_typ
 extern void cb_rssi_alert(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t alert_type, int32_t rssi);
 extern void cb_raw_rssi_received(bt_bdaddr_t *bd_addr, int32_t link_type, int32_t rssi);
 extern void cb_dbfw_plus_info_received(unsigned char *data, uint32_t length, uint8_t event_code);
+extern void cb_controller_error_received(uint8_t error_code);
 #endif
 
 static bt_callbacks_t callbacks = {
@@ -108,6 +109,7 @@ static bt_callbacks_t callbacks = {
        .rssi_alert_cb = cb_rssi_alert,
        .raw_rssi_received_cb = cb_raw_rssi_received,
        .dbfw_plus_info_received_cb = cb_dbfw_plus_info_received,
+       .controller_error_received_cb = cb_controller_error_received,
 #endif
 };
 
@@ -1105,3 +1107,18 @@ static void cb_adapter_device_found(int num_properties, bt_property_t *propertie
 
        BT_DBG("-");
 }
+
+void cb_controller_error_received(uint8_t error_code)
+{
+       uint8_t *event_data;
+
+       BT_DBG("+");
+
+       event_data = g_new0(uint8_t, 1);
+       *event_data = error_code;
+
+       send_event(OAL_EVENT_CONTROLLER_ERROR_RECEIVED,
+               (gpointer)event_data, sizeof(uint8_t));
+
+       BT_DBG("-");
+}
\ No newline at end of file