Skip to content

Commit

Permalink
nimble/host: Add support to send power control event in registered ca…
Browse files Browse the repository at this point in the history
…llback
  • Loading branch information
rahult-github committed Sep 5, 2023
1 parent b5e107e commit a8a220a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nimble/host/src/ble_gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1721,34 +1721,38 @@ void
ble_gap_rx_le_pathloss_threshold(const struct ble_hci_ev_le_subev_path_loss_threshold *ev)
{
struct ble_gap_event event;
uint16_t conn_handle = le16toh(ev->conn_handle);

memset(&event, 0, sizeof event);

event.type = BLE_GAP_EVENT_PATHLOSS_THRESHOLD;
event.pathloss_threshold.conn_handle = le16toh(ev->conn_handle);
event.pathloss_threshold.conn_handle = conn_handle;
event.pathloss_threshold.current_path_loss = ev->current_path_loss;
event.pathloss_threshold.zone_entered = ev->zone_entered;

ble_gap_event_listener_call(&event);
ble_gap_call_conn_event_cb(&event, conn_handle);
}

void
ble_gap_rx_transmit_power_report(const struct ble_hci_ev_le_subev_transmit_power_report *ev)
{
struct ble_gap_event event;
uint16_t conn_handle = le16toh(ev->conn_handle);

memset(&event, 0, sizeof event);

event.type = BLE_GAP_EVENT_TRANSMIT_POWER;
event.transmit_power.status = ev->status;
event.transmit_power.conn_handle = le16toh(ev->conn_handle);
event.transmit_power.conn_handle = conn_handle;
event.transmit_power.reason = ev->reason;
event.transmit_power.phy = ev->phy;
event.transmit_power.transmit_power_level = ev->transmit_power_level;
event.transmit_power.transmit_power_level_flag = ev->transmit_power_level_flag;
event.transmit_power.delta = ev->delta;

ble_gap_event_listener_call(&event);
ble_gap_call_conn_event_cb(&event, conn_handle);
}
#endif

Expand Down

0 comments on commit a8a220a

Please sign in to comment.