diff --git a/drivers/nble/gap.c b/drivers/nble/gap.c index 61d2687be8d..af45f5db195 100644 --- a/drivers/nble/gap.c +++ b/drivers/nble/gap.c @@ -24,6 +24,7 @@ #include #include +#include "gap_internal.h" #include "uart.h" #include "rpc.h" @@ -51,6 +52,7 @@ static int recv_cb(int channel, int request, int len, void *p_data) switch (request) { case IPC_MSG_TYPE_MESSAGE: + rpc_deserialize(p_data, len); break; case IPC_MSG_TYPE_FREE: /* TODO: Try to send another message immediately */ @@ -64,6 +66,23 @@ static int recv_cb(int channel, int request, int len, void *p_data) return 0; } +static bt_ready_cb_t bt_ready_cb; + +void on_nble_up(void) +{ + BT_DBG(""); + if (bt_ready_cb) { + bt_ready_cb(0); + } + + ble_get_version_req(NULL); +} + +void on_ble_get_version_rsp(const struct ble_version_response *rsp) +{ + BT_DBG(""); +} + int bt_enable(bt_ready_cb_t cb) { struct device *gpio; @@ -145,6 +164,8 @@ int bt_enable(bt_ready_cb_t cb) return -ENODEV; } + bt_ready_cb = cb; + return 0; }