|
@@ -24,16 +24,6 @@ luat_ble_cb_t g_drv_ble_cb;
|
|
|
#undef LLOGD
|
|
#undef LLOGD
|
|
|
#define LLOGD(...)
|
|
#define LLOGD(...)
|
|
|
|
|
|
|
|
-// 读取wifi固件版本, 控制API适配状态
|
|
|
|
|
-extern luat_airlink_dev_info_t g_airlink_ext_dev_info;
|
|
|
|
|
-static uint32_t get_ble_version(void) {
|
|
|
|
|
- uint32_t version = 0;
|
|
|
|
|
- if (g_airlink_ext_dev_info.tp == 1) {
|
|
|
|
|
- memcpy(&version, g_airlink_ext_dev_info.wifi.version, 4);
|
|
|
|
|
- }
|
|
|
|
|
- return version;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
int luat_ble_init(void* args, luat_ble_cb_t luat_ble_cb) {
|
|
int luat_ble_init(void* args, luat_ble_cb_t luat_ble_cb) {
|
|
|
LLOGD("执行luat_ble_init %p", luat_ble_cb);
|
|
LLOGD("执行luat_ble_init %p", luat_ble_cb);
|
|
|
g_drv_ble_cb = luat_ble_cb;
|
|
g_drv_ble_cb = luat_ble_cb;
|
|
@@ -534,8 +524,8 @@ int luat_ble_delete_scanning(void* args) {
|
|
|
|
|
|
|
|
int luat_ble_connect(void* args, luat_ble_connect_req_t *conn) {
|
|
int luat_ble_connect(void* args, luat_ble_connect_req_t *conn) {
|
|
|
LLOGD("执行luat_ble_connect");
|
|
LLOGD("执行luat_ble_connect");
|
|
|
- if (get_ble_version() < 11) {
|
|
|
|
|
- LLOGE("ble:connect not support, ble version is %d", get_ble_version());
|
|
|
|
|
|
|
+ if (luat_airlink_sversion() < 11) {
|
|
|
|
|
+ LLOGE("ble:connect not support, ble version is %d", luat_airlink_sversion());
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
uint64_t seq = luat_airlink_get_next_cmd_id();
|
|
uint64_t seq = luat_airlink_get_next_cmd_id();
|
|
@@ -562,8 +552,8 @@ int luat_ble_connect(void* args, luat_ble_connect_req_t *conn) {
|
|
|
|
|
|
|
|
int luat_ble_disconnect(void* args) {
|
|
int luat_ble_disconnect(void* args) {
|
|
|
LLOGD("执行luat_ble_disconnect");
|
|
LLOGD("执行luat_ble_disconnect");
|
|
|
- if (get_ble_version() < 11) {
|
|
|
|
|
- LLOGE("ble:disconnect not support, ble version is %d", get_ble_version());
|
|
|
|
|
|
|
+ if (luat_airlink_sversion() < 11) {
|
|
|
|
|
+ LLOGE("ble:disconnect not support, ble version is %d", luat_airlink_sversion());
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
uint64_t seq = luat_airlink_get_next_cmd_id();
|
|
uint64_t seq = luat_airlink_get_next_cmd_id();
|
|
@@ -585,8 +575,8 @@ int luat_ble_disconnect(void* args) {
|
|
|
|
|
|
|
|
int luat_ble_read_value(luat_ble_uuid_t* uuid_service, luat_ble_uuid_t* uuid_characteristic, luat_ble_uuid_t* uuid_descriptor, uint8_t **data, uint16_t* len) {
|
|
int luat_ble_read_value(luat_ble_uuid_t* uuid_service, luat_ble_uuid_t* uuid_characteristic, luat_ble_uuid_t* uuid_descriptor, uint8_t **data, uint16_t* len) {
|
|
|
LLOGD("执行luat_ble_read_value");
|
|
LLOGD("执行luat_ble_read_value");
|
|
|
- if (get_ble_version() < 11) {
|
|
|
|
|
- LLOGE("ble:read_value not support, ble version is %d", get_ble_version());
|
|
|
|
|
|
|
+ if (luat_airlink_sversion() < 11) {
|
|
|
|
|
+ LLOGE("ble:read_value not support, ble version is %d", luat_airlink_sversion());
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
uint16_t tmp = 0;
|
|
uint16_t tmp = 0;
|
|
@@ -634,8 +624,8 @@ int luat_ble_read_value(luat_ble_uuid_t* uuid_service, luat_ble_uuid_t* uuid_cha
|
|
|
|
|
|
|
|
int luat_ble_notify_enable(luat_ble_uuid_t* uuid_service, luat_ble_uuid_t* uuid_characteristic, uint8_t enable) {
|
|
int luat_ble_notify_enable(luat_ble_uuid_t* uuid_service, luat_ble_uuid_t* uuid_characteristic, uint8_t enable) {
|
|
|
LLOGD("执行luat_ble_notify_enable %d", enable);
|
|
LLOGD("执行luat_ble_notify_enable %d", enable);
|
|
|
- if (get_ble_version() < 11) {
|
|
|
|
|
- LLOGE("ble:notify_enable not support, ble version is %d", get_ble_version());
|
|
|
|
|
|
|
+ if (luat_airlink_sversion() < 11) {
|
|
|
|
|
+ LLOGE("ble:notify_enable not support, ble version is %d", luat_airlink_sversion());
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
uint16_t tmp = 0;
|
|
uint16_t tmp = 0;
|
|
@@ -676,8 +666,8 @@ int luat_ble_notify_enable(luat_ble_uuid_t* uuid_service, luat_ble_uuid_t* uuid_
|
|
|
|
|
|
|
|
int luat_ble_indicate_enable(luat_ble_uuid_t* uuid_service, luat_ble_uuid_t* uuid_characteristic, uint8_t enable) {
|
|
int luat_ble_indicate_enable(luat_ble_uuid_t* uuid_service, luat_ble_uuid_t* uuid_characteristic, uint8_t enable) {
|
|
|
LLOGD("执行luat_ble_indicate_enable %d", enable);
|
|
LLOGD("执行luat_ble_indicate_enable %d", enable);
|
|
|
- if (get_ble_version() < 15) {
|
|
|
|
|
- LLOGE("ble:indicate_enable not support, ble version is %d", get_ble_version());
|
|
|
|
|
|
|
+ if (luat_airlink_sversion() < 15) {
|
|
|
|
|
+ LLOGE("ble:indicate_enable not support, ble version is %d", luat_airlink_sversion());
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
uint16_t tmp = 0;
|
|
uint16_t tmp = 0;
|