Merge branch 'feature/btdm_blufi_version' into 'master'
component/bt : blufi add version blufi add version and the android APK add version check, too. See merge request !378
This commit is contained in:
commit
f5b221b9fb
9 changed files with 41 additions and 5 deletions
|
@ -71,4 +71,8 @@ esp_err_t esp_blufi_profile_deinit(void)
|
||||||
return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
return (btc_transfer_context(&msg, NULL, 0, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t esp_blufi_get_version(void)
|
||||||
|
{
|
||||||
|
return btc_blufi_get_version();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,6 +344,15 @@ esp_err_t esp_blufi_profile_deinit(void);
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_blufi_send_wifi_conn_report(wifi_mode_t opmode, esp_blufi_sta_conn_state_t sta_conn_state, uint8_t softap_conn_num, esp_blufi_extra_info_t *extra_info);
|
esp_err_t esp_blufi_send_wifi_conn_report(wifi_mode_t opmode, esp_blufi_sta_conn_state_t sta_conn_state, uint8_t softap_conn_num, esp_blufi_extra_info_t *extra_info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @brief Get BLUFI profile version
|
||||||
|
*
|
||||||
|
* @return Most 8bit significant is Great version, Least 8bit is Sub version
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
uint16_t esp_blufi_get_version(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -233,8 +233,6 @@ void bta_gatts_register(tBTA_GATTS_CB *p_cb, tBTA_GATTS_DATA *p_msg)
|
||||||
if (p_msg->api_reg.p_cback) {
|
if (p_msg->api_reg.p_cback) {
|
||||||
(*p_msg->api_reg.p_cback)(BTA_GATTS_REG_EVT, &cb_data);
|
(*p_msg->api_reg.p_cback)(BTA_GATTS_REG_EVT, &cb_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_ERROR("status=%x\n", status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -895,3 +895,7 @@ void btc_blufi_set_callbacks(esp_blufi_callbacks_t *callbacks)
|
||||||
blufi_env.cbs = callbacks;
|
blufi_env.cbs = callbacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t btc_blufi_get_version(void)
|
||||||
|
{
|
||||||
|
return BTC_BLUFI_VERSION;
|
||||||
|
}
|
||||||
|
|
|
@ -90,6 +90,15 @@ void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len)
|
||||||
|
|
||||||
btc_transfer_context(&msg, NULL, 0, NULL);
|
btc_transfer_context(&msg, NULL, 0, NULL);
|
||||||
break;
|
break;
|
||||||
|
case BLUFI_TYPE_CTRL_SUBTYPE_GET_VERSION: {
|
||||||
|
uint8_t type = BLUFI_BUILD_TYPE(BLUFI_TYPE_DATA, BLUFI_TYPE_DATA_SUBTYPE_REPLY_VERSION);
|
||||||
|
uint8_t data[2];
|
||||||
|
|
||||||
|
data[0] = BTC_BLUFI_GREAT_VER;
|
||||||
|
data[1] = BTC_BLUFI_SUB_VER;
|
||||||
|
btc_blufi_send_encap(type, &data[0], sizeof(data));
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
LOG_ERROR("%s Unkown Ctrl pkt %02x\n", __func__, type);
|
LOG_ERROR("%s Unkown Ctrl pkt %02x\n", __func__, type);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
#ifndef __BLUFI_INT_H__
|
#ifndef __BLUFI_INT_H__
|
||||||
#define __BLUFI_INT_H__
|
#define __BLUFI_INT_H__
|
||||||
|
|
||||||
|
#define BTC_BLUFI_GREAT_VER 0x01 //Version + Subversion
|
||||||
|
#define BTC_BLUFI_SUB_VER 0x00 //Version + Subversion
|
||||||
|
#define BTC_BLUFI_VERSION ((BTC_BLUFI_GREAT_VER<<8)|BTC_BLUFI_SUB_VER) //Version + Subversion
|
||||||
|
|
||||||
/* service engine control block */
|
/* service engine control block */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* Protocol reference */
|
/* Protocol reference */
|
||||||
|
@ -86,6 +90,7 @@ typedef struct blufi_frag_hdr blufi_frag_hdr_t;
|
||||||
#define BLUFI_TYPE_CTRL_SUBTYPE_DISCONN_FROM_AP 0x04
|
#define BLUFI_TYPE_CTRL_SUBTYPE_DISCONN_FROM_AP 0x04
|
||||||
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_STATUS 0x05
|
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_STATUS 0x05
|
||||||
#define BLUFI_TYPE_CTRL_SUBTYPE_DEAUTHENTICATE_STA 0x06
|
#define BLUFI_TYPE_CTRL_SUBTYPE_DEAUTHENTICATE_STA 0x06
|
||||||
|
#define BLUFI_TYPE_CTRL_SUBTYPE_GET_VERSION 0x07
|
||||||
|
|
||||||
#define BLUFI_TYPE_DATA 0x1
|
#define BLUFI_TYPE_DATA 0x1
|
||||||
#define BLUFI_TYPE_DATA_SUBTYPE_NEG 0x00
|
#define BLUFI_TYPE_DATA_SUBTYPE_NEG 0x00
|
||||||
|
@ -104,7 +109,7 @@ typedef struct blufi_frag_hdr blufi_frag_hdr_t;
|
||||||
#define BLUFI_TYPE_DATA_SUBTYPE_CLIENT_PRIV_KEY 0x0d
|
#define BLUFI_TYPE_DATA_SUBTYPE_CLIENT_PRIV_KEY 0x0d
|
||||||
#define BLUFI_TYPE_DATA_SUBTYPE_SERVER_PRIV_KEY 0x0e
|
#define BLUFI_TYPE_DATA_SUBTYPE_SERVER_PRIV_KEY 0x0e
|
||||||
#define BLUFI_TYPE_DATA_SUBTYPE_WIFI_REP 0x0f
|
#define BLUFI_TYPE_DATA_SUBTYPE_WIFI_REP 0x0f
|
||||||
|
#define BLUFI_TYPE_DATA_SUBTYPE_REPLY_VERSION 0x10
|
||||||
#define BLUFI_TYPE_IS_CTRL(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_CTRL)
|
#define BLUFI_TYPE_IS_CTRL(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_CTRL)
|
||||||
#define BLUFI_TYPE_IS_DATA(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_DATA)
|
#define BLUFI_TYPE_IS_DATA(type) (BLUFI_GET_TYPE((type)) == BLUFI_TYPE_DATA)
|
||||||
|
|
||||||
|
@ -116,6 +121,7 @@ typedef struct blufi_frag_hdr blufi_frag_hdr_t;
|
||||||
#define BLUFI_TYPE_IS_CTRL_DISCONN_WIFI(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_DISCONN_FROM_AP)
|
#define BLUFI_TYPE_IS_CTRL_DISCONN_WIFI(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_DISCONN_FROM_AP)
|
||||||
#define BLUFI_TYPE_IS_CTRL_GET_WIFI_STATUS(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_STATUS)
|
#define BLUFI_TYPE_IS_CTRL_GET_WIFI_STATUS(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_GET_WIFI_STATUS)
|
||||||
#define BLUFI_TYPE_IS_CTRL_DEAUTHENTICATE_STA(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_DEAUTHENTICATE_STA)
|
#define BLUFI_TYPE_IS_CTRL_DEAUTHENTICATE_STA(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_DEAUTHENTICATE_STA)
|
||||||
|
#define BLUFI_TYPE_IS_CTRL_GET_VERSION(type) (BLUFI_TYPE_IS_CTRL((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_CTRL_SUBTYPE_GET_VERSION)
|
||||||
|
|
||||||
#define BLUFI_TYPE_IS_DATA_NEG(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_NEG)
|
#define BLUFI_TYPE_IS_DATA_NEG(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_NEG)
|
||||||
#define BLUFI_TYPE_IS_DATA_STA_BSSID(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_STA_BSSID)
|
#define BLUFI_TYPE_IS_DATA_STA_BSSID(type) (BLUFI_TYPE_IS_DATA((type)) && BLUFI_GET_SUBTYPE((type)) == BLUFI_TYPE_DATA_SUBTYPE_STA_BSSID)
|
||||||
|
|
|
@ -41,4 +41,7 @@ void btc_blufi_set_callbacks(esp_blufi_callbacks_t *callbacks);
|
||||||
|
|
||||||
void btc_blufi_call_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
void btc_blufi_call_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||||
void btc_blufi_call_deep_free(btc_msg_t *msg);
|
void btc_blufi_call_deep_free(btc_msg_t *msg);
|
||||||
|
|
||||||
|
uint16_t btc_blufi_get_version(void);
|
||||||
|
|
||||||
#endif /* __BTC_BLUFI_PRF_H__ */
|
#endif /* __BTC_BLUFI_PRF_H__ */
|
||||||
|
|
|
@ -125,4 +125,5 @@ Functions
|
||||||
.. doxygenfunction:: esp_blufi_profile_init
|
.. doxygenfunction:: esp_blufi_profile_init
|
||||||
.. doxygenfunction:: esp_blufi_profile_deinit
|
.. doxygenfunction:: esp_blufi_profile_deinit
|
||||||
.. doxygenfunction:: esp_blufi_send_wifi_conn_report
|
.. doxygenfunction:: esp_blufi_send_wifi_conn_report
|
||||||
|
.. doxygenfunction:: esp_blufi_get_version
|
||||||
|
|
||||||
|
|
|
@ -328,6 +328,8 @@ void app_main()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BLUFI_INFO("BLUFI VERSION %04x\n", esp_blufi_get_version());
|
||||||
|
|
||||||
blufi_security_init();
|
blufi_security_init();
|
||||||
esp_ble_gap_register_callback(gap_event_handler);
|
esp_ble_gap_register_callback(gap_event_handler);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue