99 */
1010
1111#include <sid_error.h>
12+ #include <sid_ble_config_ifc.h>
1213#include <sid_pal_ble_adapter_ifc.h>
1314#include <sid_ble_service.h>
1415#include <sid_ble_ama_service.h>
3132#include <zephyr/settings/settings.h>
3233#include <zephyr/logging/log.h>
3334#include <zephyr/sys/byteorder.h>
35+ #include <zephyr/sys/util.h>
3436#include <zephyr/bluetooth/hci_vs.h>
37+ #include <string.h>
3538
3639LOG_MODULE_REGISTER (sid_ble , CONFIG_SIDEWALK_BLE_ADAPTER_LOG_LEVEL );
3740
@@ -48,21 +51,28 @@ static sid_error_t ble_adapter_deinit(void);
4851static sid_error_t ble_adapter_get_rssi (int8_t * rssi );
4952static sid_error_t ble_adapter_get_tx_pwr (int16_t * tx_power );
5053static sid_error_t ble_adapter_set_tx_pwr (int16_t tx_power );
54+ static sid_error_t ble_adapter_user_config (sid_ble_user_config_t * cfg );
55+ static void ble_adapter_received_data_result (sid_error_t result );
56+ static void ble_adapter_notify_ama_state (bool is_active );
57+ static sid_error_t ble_adapter_get_mac_addr (uint8_t * addr );
5158
5259static struct sid_pal_ble_adapter_interface ble_ifc = {
5360 .init = ble_adapter_init ,
5461 .start_service = ble_adapter_start_service ,
62+ .user_config = ble_adapter_user_config ,
5563 .set_adv_data = ble_adapter_set_adv_data ,
5664 .start_adv = ble_adapter_start_advertisement ,
5765 .stop_adv = ble_adapter_stop_advertisement ,
66+ .get_rssi = ble_adapter_get_rssi ,
67+ .get_tx_pwr = ble_adapter_get_tx_pwr ,
5868 .send = ble_adapter_send_data ,
5969 .set_callback = ble_adapter_set_callback ,
70+ .set_tx_pwr = ble_adapter_set_tx_pwr ,
71+ .received_data_result = ble_adapter_received_data_result ,
6072 .disconnect = ble_adapter_disconnect ,
6173 .deinit = ble_adapter_deinit ,
62- .get_rssi = ble_adapter_get_rssi ,
63- .get_tx_pwr = ble_adapter_get_tx_pwr ,
64- .set_tx_pwr = ble_adapter_set_tx_pwr ,
65-
74+ .notify_ama_state = ble_adapter_notify_ama_state ,
75+ .get_mac_addr = ble_adapter_get_mac_addr ,
6676};
6777
6878static void read_conn_rssi (uint16_t handle , int8_t * rssi )
@@ -379,6 +389,44 @@ static sid_error_t ble_adapter_send_data(sid_ble_cfg_service_identifier_t id, ui
379389 return SID_ERROR_NONE ;
380390}
381391
392+ static sid_error_t ble_adapter_user_config (sid_ble_user_config_t * cfg )
393+ {
394+ ARG_UNUSED (cfg );
395+ LOG_DBG ("BLE user config: not implemented" );
396+ return SID_ERROR_NOSUPPORT ;
397+ }
398+
399+ static void ble_adapter_received_data_result (sid_error_t result )
400+ {
401+ ARG_UNUSED (result );
402+ LOG_DBG ("received_data_result: not implemented" );
403+ }
404+
405+ static void ble_adapter_notify_ama_state (bool is_active )
406+ {
407+ ARG_UNUSED (is_active );
408+ LOG_DBG ("notify_ama_state: not implemented" );
409+ }
410+
411+ static sid_error_t ble_adapter_get_mac_addr (uint8_t * addr )
412+ {
413+ if (!addr ) {
414+ return SID_ERROR_NULL_POINTER ;
415+ }
416+
417+ bt_addr_le_t addrs [BT_ID_SIDEWALK + 1 ];
418+ size_t count = ARRAY_SIZE (addrs );
419+
420+ bt_id_get (addrs , & count );
421+ if (count <= BT_ID_SIDEWALK ) {
422+ LOG_WRN ("get_mac_addr: Sidewalk identity not present (count=%zu)" , count );
423+ return SID_ERROR_NOT_FOUND ;
424+ }
425+
426+ memcpy (addr , addrs [BT_ID_SIDEWALK ].a .val , BLE_ADDR_MAX_LEN );
427+ return SID_ERROR_NONE ;
428+ }
429+
382430static sid_error_t ble_adapter_set_callback (const sid_pal_ble_adapter_callbacks_t * cb )
383431{
384432 LOG_DBG ("Sidewalk -> BLE" );
0 commit comments