51 lines
1.4 KiB
C
Executable File
51 lines
1.4 KiB
C
Executable File
#ifndef __BLE_CLIENT_H__
|
|
#define __BLE_CLIENT_H__
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
//WIFI
|
|
#include <modules/wifi.h>
|
|
#include <components/event.h>
|
|
#include <components/netif.h>
|
|
#include <string.h>
|
|
|
|
|
|
|
|
typedef enum boarding_state
|
|
{
|
|
BOARDING_STATE_IDLE, //0 无操作
|
|
BOARDING_STATE_SCAN, //1 正在扫描SSID
|
|
BOARDING_STATE_SETWIFI, //2 正在设置SSID PWD
|
|
BOARDING_STATE_DONE, //3 已经连接WIFI
|
|
BOARDING_STATE_FAIL, //4 失败
|
|
BOARDING_STATE_CLOSE, //5 蓝牙已经关闭
|
|
BOARDING_STATE_PASSWORD_ERROR, //6 密码错误
|
|
BOARDING_STATE_AP_NOFOUND //7 AP 不存在
|
|
} boarding_state;
|
|
|
|
typedef struct ble_boarding_cb_ops{
|
|
/**
|
|
* 小程序发送AT+START 触发开始扫描wifi
|
|
* 回调prf_id att_idx用于回传WIFI列表
|
|
*/
|
|
void (*event_start_boarding)();
|
|
void (*event_wifi_info)(char* ssid, int ssid_len ,char* password,int password_len);
|
|
void (*event_agora_info)(char* license, int license_len);
|
|
}ble_boarding_cb_ops_t;
|
|
|
|
int ble_client_boarding_init();
|
|
int ble_boarding_set_callback(ble_boarding_cb_ops_t *cb_ops);
|
|
int ble_boarding_set_state(boarding_state state);
|
|
boarding_state ble_boarding_get_state();
|
|
void ble_set_wifi_scan_result(wifi_scan_result_t *result);
|
|
char* ble_get_ssid_addr();
|
|
int dm_ble_boarding_handle(char *pcWriteBuffer, int xWriteBufferLen, int argc, char **argv);
|
|
|
|
int ble_client_is_connect();
|
|
int ble_client_boarding_deinit();
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif |