mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #4338 from andreaslarssonublox/ublox_odin_driver_os_5_v1.3_rc2
u-blox ODIN driver v1.3 rc2 for mbed OS 5pull/4273/head
commit
5d0ce3c531
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -18,20 +18,26 @@
|
||||||
#define ODIN_WIFI_INTERFACE_H
|
#define ODIN_WIFI_INTERFACE_H
|
||||||
|
|
||||||
#include "WiFiInterface.h"
|
#include "WiFiInterface.h"
|
||||||
#include "Callback.h"
|
|
||||||
#include "mbed_events.h"
|
|
||||||
|
|
||||||
#include "rtos.h"
|
|
||||||
#include "cmsis_os.h"
|
|
||||||
#include "emac_api.h"
|
#include "emac_api.h"
|
||||||
|
|
||||||
|
#include "mbed.h"
|
||||||
|
#include "netsocket/WiFiAccessPoint.h"
|
||||||
#include "nsapi_types.h"
|
#include "nsapi_types.h"
|
||||||
#include "lwip/netif.h"
|
#include "lwip/netif.h"
|
||||||
|
#include "rtos.h"
|
||||||
|
#include "cb_wlan.h"
|
||||||
|
|
||||||
typedef Queue<void*, 1> MsgQueue;
|
#define ODIN_WIFI_MAX_MAC_ADDR_STR (18)
|
||||||
|
#define ODIN_WIFI_SCAN_CACHE_SIZE (5)
|
||||||
|
|
||||||
class OdinWiFiInterface;
|
struct odin_wifi_msg_s;
|
||||||
|
struct user_connect_s;
|
||||||
struct PrivContext;
|
struct user_scan_s;
|
||||||
|
struct user_ap_start_s;
|
||||||
|
struct wlan_status_started_s;
|
||||||
|
struct wlan_status_connected_s;
|
||||||
|
struct wlan_status_connection_failure_s;
|
||||||
|
struct wlan_scan_indication_s;
|
||||||
|
|
||||||
/** OdinWiFiInterface class
|
/** OdinWiFiInterface class
|
||||||
* Implementation of the WiFiInterface for the ODIN-W2 module
|
* Implementation of the WiFiInterface for the ODIN-W2 module
|
||||||
|
@ -74,7 +80,8 @@ public:
|
||||||
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0)
|
* @param channel Channel on which the connection is to be made, or 0 for any (Default: 0)
|
||||||
* @return 0 on success, or error code on failure
|
* @return 0 on success, or error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t connect(const char *ssid,
|
virtual nsapi_error_t connect(
|
||||||
|
const char *ssid,
|
||||||
const char *pass,
|
const char *pass,
|
||||||
nsapi_security_t security = NSAPI_SECURITY_NONE,
|
nsapi_security_t security = NSAPI_SECURITY_NONE,
|
||||||
uint8_t channel = 0);
|
uint8_t channel = 0);
|
||||||
|
@ -115,7 +122,7 @@ public:
|
||||||
/** Get the local network mask
|
/** Get the local network mask
|
||||||
*
|
*
|
||||||
* @return Null-terminated representation of the local network mask
|
* @return Null-terminated representation of the local network mask
|
||||||
* or null if no network mask has been recieved
|
* or null if no network mask has been received
|
||||||
*/
|
*/
|
||||||
virtual const char *get_netmask();
|
virtual const char *get_netmask();
|
||||||
|
|
||||||
|
@ -177,44 +184,161 @@ public:
|
||||||
* specified since the Wi-Fi driver might need some time to finish and cleanup.
|
* specified since the Wi-Fi driver might need some time to finish and cleanup.
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual void set_timeout(int timeout);
|
virtual nsapi_error_t set_timeout(int ms);
|
||||||
|
|
||||||
virtual NetworkStack *get_stack();
|
virtual NetworkStack *get_stack();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
nsapi_error_t connect_async(const char *ssid,
|
enum OdinWifiState {
|
||||||
const char *pass,
|
S_NOT_INITIALISED = 1,
|
||||||
nsapi_security_t security = NSAPI_SECURITY_NONE,
|
S_WAIT_START,
|
||||||
uint8_t channel = 0,
|
S_STARTED,
|
||||||
void *data = NULL,
|
S_WAIT_STOP,
|
||||||
unsigned timeout = 0);
|
|
||||||
|
S_STA_IDLE,
|
||||||
bool start(bool debug);
|
S_STA_WAIT_CONNECT,
|
||||||
bool stop();
|
S_STA_CONNECTED,
|
||||||
|
S_STA_DISCONNECTED_WAIT_CONNECT,
|
||||||
char _mac_addr_str[18];
|
S_STA_CONNECTION_FAIL_WAIT_DISCONNECT,
|
||||||
// Private context to share between C and C++ calls
|
//S_STA_LINK_LOSS_WAIT_DISCONNECT,
|
||||||
PrivContext* _priv_context;
|
S_STA_WAIT_DISCONNECT,
|
||||||
const char *_ssid;
|
|
||||||
const char *_pass;
|
S_AP_IDLE,
|
||||||
char _ip_address[IPADDR_STRLEN_MAX];
|
S_AP_WAIT_START,
|
||||||
char _netmask[IPADDR_STRLEN_MAX];
|
S_AP_STARTED,
|
||||||
char _gateway[IPADDR_STRLEN_MAX];
|
S_AP_WAIT_STOP,
|
||||||
nsapi_security_t _security;
|
S_AP_FAIL_WAIT_STOP,
|
||||||
uint8_t _channel;
|
S_AP_WAIT_DRV_STOP,
|
||||||
bool _use_dhcp;
|
S_AP_WAIT_DRV_START,
|
||||||
int _timeout;
|
|
||||||
// Event queue when the driver context need to be used
|
S_INVALID
|
||||||
EventQueue* _odin_event_queue;
|
};
|
||||||
int32_t target_id;
|
|
||||||
// Event queue for sending start up and connection events from driver to this class
|
struct sta_s {
|
||||||
MsgQueue _event_queue;
|
const char *ssid;
|
||||||
// Message queue for sending scan events from driver to this class
|
const char *passwd;
|
||||||
osMessageQId _scan_msg_queue_id;
|
nsapi_security_t security;
|
||||||
osMessageQDef_t _queue_def;
|
uint8_t channel;
|
||||||
|
bool use_dhcp;
|
||||||
|
int timeout_ms;
|
||||||
|
char ip_address[IPADDR_STRLEN_MAX];
|
||||||
|
char netmask[IPADDR_STRLEN_MAX];
|
||||||
|
char gateway[IPADDR_STRLEN_MAX];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ap_s {
|
||||||
|
const char *ssid;
|
||||||
|
const char *passwd;
|
||||||
|
nsapi_security_t security;
|
||||||
|
uint8_t channel;
|
||||||
|
bool use_dhcp;
|
||||||
|
|
||||||
|
char ip_address[IPADDR_STRLEN_MAX];
|
||||||
|
char netmask[IPADDR_STRLEN_MAX];
|
||||||
|
char gateway[IPADDR_STRLEN_MAX];
|
||||||
|
|
||||||
|
int cnt_connected;
|
||||||
|
|
||||||
|
nsapi_error_t error_code;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct scan_cache_s {
|
||||||
|
int count;
|
||||||
|
uint8_t last_channel;
|
||||||
|
cbWLAN_MACAddress bssid[ODIN_WIFI_SCAN_CACHE_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
OdinWifiState entry_connect_fail_wait_disconnect();
|
||||||
|
OdinWifiState entry_wait_connect();
|
||||||
|
OdinWifiState entry_wait_disconnect();
|
||||||
|
//OdinWifiState entry_link_loss_wait_disconnect(void);
|
||||||
|
OdinWifiState entry_ap_wait_start();
|
||||||
|
OdinWifiState entry_ap_started();
|
||||||
|
OdinWifiState entry_ap_wait_stop();
|
||||||
|
OdinWifiState entry_ap_fail_wait_stop();
|
||||||
|
OdinWifiState entry_ap_wait_drv_stop();
|
||||||
|
OdinWifiState entry_ap_wait_drv_start();
|
||||||
|
|
||||||
|
void handle_in_msg();
|
||||||
|
void handle_cached_msg();
|
||||||
|
|
||||||
|
void handle_user_connect(user_connect_s *user_connect);
|
||||||
|
void handle_user_disconnect();
|
||||||
|
void handle_user_scan(user_scan_s *user_scan);
|
||||||
|
void handle_user_connect_timeout();
|
||||||
|
void handle_user_stop();
|
||||||
|
|
||||||
|
void handle_user_ap_start(user_ap_start_s *user_ap_start);
|
||||||
|
void handle_user_ap_stop();
|
||||||
|
|
||||||
|
void handle_wlan_status_started(wlan_status_started_s *start);
|
||||||
|
void handle_wlan_status_stopped(void);
|
||||||
|
void handle_wlan_status_error(void);
|
||||||
|
void handle_wlan_status_connecting(void);
|
||||||
|
void handle_wlan_status_connected(wlan_status_connected_s *wlan_connect);
|
||||||
|
void handle_wlan_status_connection_failure(wlan_status_connection_failure_s *connect_failure);
|
||||||
|
void handle_wlan_status_disconnected(void);
|
||||||
|
void handle_wlan_scan_indication();
|
||||||
|
|
||||||
|
void handle_wlan_status_ap_up();
|
||||||
|
void handle_wlan_status_ap_down();
|
||||||
|
|
||||||
|
void init(bool debug);
|
||||||
|
nsapi_error_t wlan_set_channel(uint8_t channel);
|
||||||
|
nsapi_error_t wlan_connect(
|
||||||
|
const char *ssid,
|
||||||
|
const char *passwd,
|
||||||
|
nsapi_security_t security);
|
||||||
|
nsapi_error_t wlan_ap_start(
|
||||||
|
const char *ssid,
|
||||||
|
const char *pass,
|
||||||
|
nsapi_security_t security,
|
||||||
|
uint8_t channel);
|
||||||
|
|
||||||
|
void timeout_user_connect();
|
||||||
|
void update_scan_list(cbWLAN_ScanIndicationInfo *scan_info);
|
||||||
|
void send_user_response_msg(unsigned int type, nsapi_error_t error_code);
|
||||||
|
void wlan_status_indication(cbWLAN_StatusIndicationInfo status, void *data);
|
||||||
|
void wlan_scan_indication(cbWLAN_ScanIndicationInfo *scan_info, cb_boolean is_last_result);
|
||||||
|
|
||||||
|
static bool _wlan_initialized; // Controls that cbWLAN is initiated only once
|
||||||
|
static emac_interface_t* _emac; // Not possible to remove added interfaces to the network stack => static and re-use
|
||||||
|
static int32_t _target_id;
|
||||||
|
|
||||||
|
OdinWifiState _state;
|
||||||
|
OdinWifiState _state_sta;
|
||||||
|
OdinWifiState _state_ap;
|
||||||
|
|
||||||
|
struct sta_s _sta;
|
||||||
|
struct ap_s _ap;
|
||||||
|
nsapi_stack_t _stack;
|
||||||
|
char _mac_addr_str[ODIN_WIFI_MAX_MAC_ADDR_STR];
|
||||||
|
|
||||||
|
cbWLAN_StatusConnectedInfo _wlan_status_connected_info;
|
||||||
|
cbWLAN_StatusDisconnectedInfo _wlan_status_disconnected_info;
|
||||||
|
|
||||||
|
bool _scan_active;
|
||||||
|
WiFiAccessPoint *_scan_list;
|
||||||
|
nsapi_size_t _scan_list_size;
|
||||||
|
nsapi_size_t _scan_list_cnt;
|
||||||
|
struct scan_cache_s _scan_cache;
|
||||||
|
|
||||||
|
friend struct wlan_callb_s;
|
||||||
|
|
||||||
|
Mutex _mutex;
|
||||||
|
Queue<odin_wifi_msg_s, 6> _in_queue;
|
||||||
|
Queue<odin_wifi_msg_s, 1> _out_queue;
|
||||||
|
Queue<odin_wifi_msg_s, 1> _cache_queue;
|
||||||
|
MemoryPool<odin_wifi_msg_s, 7> *_msg_pool;
|
||||||
|
Thread _thread;
|
||||||
|
//Timeout _timeout; //Randomly lost interrupts/callbacks; replaced by Timer
|
||||||
|
Timer _timer;
|
||||||
|
|
||||||
|
bool _debug;
|
||||||
|
int _dbg_timeout;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*---------------------------------------------------------------------------
|
/*---------------------------------------------------------------------------
|
||||||
* Copyright (c) 2016, u-blox Malmö, All Rights Reserved
|
* Copyright (c) 2016, u-blox Malmö, All Rights Reserved
|
||||||
* SPDX-License-Identifier: LicenseRef-PBL
|
* SPDX-License-Identifier: LicenseRef-PBL
|
||||||
*
|
*
|
||||||
* This file and the related binary are licensed under the
|
* This file and the related binary are licensed under the
|
||||||
|
@ -65,6 +65,11 @@
|
||||||
|
|
||||||
#define PACKET_TYPE_ALL (PACKET_TYPE_DM1 | PACKET_TYPE_DH1 | PACKET_TYPE_DM3 | PACKET_TYPE_DH3 | PACKET_TYPE_DM5 | PACKET_TYPE_DH5)
|
#define PACKET_TYPE_ALL (PACKET_TYPE_DM1 | PACKET_TYPE_DH1 | PACKET_TYPE_DM3 | PACKET_TYPE_DH3 | PACKET_TYPE_DM5 | PACKET_TYPE_DH5)
|
||||||
|
|
||||||
|
#define BD_ADDR_IS_STATIC_RANDOM(BdAddress) ((BdAddress[0] & 0xC0) == 0xC0)
|
||||||
|
#define BD_ADDR_IS_NON_RESOLVABLE(BdAddress) ((BdAddress[0] & 0xC0) == 0x00)
|
||||||
|
#define BD_ADDR_IS_RESOLVABLE(BdAddress) ((BdAddress[0] & 0xC0) == 0x40)
|
||||||
|
|
||||||
|
#define BT_INVALID_STATIC_LINK_KEY (0)
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
* TYPES
|
* TYPES
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
|
|
|
@ -129,6 +129,17 @@ typedef struct
|
||||||
cb_char serviceName[cbBCM_SERVICE_NAME_MAX_LEN];
|
cb_char serviceName[cbBCM_SERVICE_NAME_MAX_LEN];
|
||||||
} cbBCM_ConnectionInfo;
|
} cbBCM_ConnectionInfo;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
cb_uint8 flags; /** Reserved for future use. */
|
||||||
|
cb_uint8 flowDirection; /** 0x00 for Outgoing Flow and 0x01 for Incoming Flow */
|
||||||
|
cb_uint8 serviceType; /** 0x00 No Traffic; 0x01 Best Effort; 0x02 Guaranteed */
|
||||||
|
cb_uint32 tokenRate; /** Token Rate in octets per second */
|
||||||
|
cb_uint32 tokenBucketSize; /** Token Bucket Size in octets */
|
||||||
|
cb_uint32 peakBandwidth; /** Peak Bandwidth in octets per second */
|
||||||
|
cb_uint32 latency; /** Latency in microseconds */
|
||||||
|
} cbBCM_FlowSpecParams;
|
||||||
|
|
||||||
typedef void (*cbBCM_ConnectInd)(
|
typedef void (*cbBCM_ConnectInd)(
|
||||||
cbBCM_Handle handle,
|
cbBCM_Handle handle,
|
||||||
cbBCM_ConnectionInfo info);
|
cbBCM_ConnectionInfo info);
|
||||||
|
@ -156,7 +167,7 @@ typedef struct
|
||||||
typedef void(*cbBCM_RoleDiscoveryCallback)(
|
typedef void(*cbBCM_RoleDiscoveryCallback)(
|
||||||
cbBCM_Handle handle,
|
cbBCM_Handle handle,
|
||||||
cb_int8 status,
|
cb_int8 status,
|
||||||
cb_int8 role);
|
cb_uint8 role);
|
||||||
|
|
||||||
typedef void (*cbBCM_RssiCallback)(
|
typedef void (*cbBCM_RssiCallback)(
|
||||||
cbBCM_Handle handle,
|
cbBCM_Handle handle,
|
||||||
|
@ -226,6 +237,13 @@ typedef void(*cbBCM_LinkQualityCallback)(
|
||||||
cbBCM_LinkQualityEvt linkQualityEvt,
|
cbBCM_LinkQualityEvt linkQualityEvt,
|
||||||
uint8 linkQuality);
|
uint8 linkQuality);
|
||||||
|
|
||||||
|
typedef void(*cbBCM_ServiceClassEnabled)(cb_uint8 serviceChannel);
|
||||||
|
|
||||||
|
typedef void(*cbBCM_SetFlowSpecCallback)(
|
||||||
|
cb_uint8 status,
|
||||||
|
cbBCM_Handle handle,
|
||||||
|
cbBCM_FlowSpecParams parameters);
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
* FUNCTIONS
|
* FUNCTIONS
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
|
@ -245,12 +263,14 @@ extern void cbBCM_init(void);
|
||||||
* @param pServerChannel Pointer to return variable. The server channel is used to identify
|
* @param pServerChannel Pointer to return variable. The server channel is used to identify
|
||||||
* incoming connections.
|
* incoming connections.
|
||||||
* @param pConnectionCallback Callback structure for connection management.
|
* @param pConnectionCallback Callback structure for connection management.
|
||||||
|
* @param pServiceClassEnabled Callback structure to inform when service is running.
|
||||||
* @return If the operation is successful cbBCM_OK is returned.
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
*/
|
*/
|
||||||
extern cb_int32 cbBCM_enableServerProfileSpp(
|
extern cb_int32 cbBCM_enableServerProfileSpp(
|
||||||
cb_char *pServiceName,
|
cb_char *pServiceName,
|
||||||
cb_uint8 *pServerChannel,
|
cb_uint8 *pServerChannel,
|
||||||
cbBCM_ConnectionCallback *pConnectionCallback);
|
cbBCM_ConnectionCallback *pConnectionCallback,
|
||||||
|
cbBCM_ServiceClassEnabled pServiceClassEnabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable a Dial Up Networking Profile (DUN)service record to
|
* Enable a Dial Up Networking Profile (DUN)service record to
|
||||||
|
@ -260,12 +280,14 @@ extern cb_int32 cbBCM_enableServerProfileSpp(
|
||||||
* @param pServerChannel Pointer to return variable. The server channel is used to identify
|
* @param pServerChannel Pointer to return variable. The server channel is used to identify
|
||||||
* incoming connections.
|
* incoming connections.
|
||||||
* @param pConnectionCallback Callback structure for connection management.
|
* @param pConnectionCallback Callback structure for connection management.
|
||||||
|
* @param pServiceClassEnabled Callback structure to inform when service is running.
|
||||||
* @return If the operation is successful cbBCM_OK is returned.
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
*/
|
*/
|
||||||
extern cb_int32 cbBCM_enableServerProfileDun(
|
extern cb_int32 cbBCM_enableServerProfileDun(
|
||||||
cb_char *pServiceName,
|
cb_char *pServiceName,
|
||||||
cb_uint8 *pServerChannel,
|
cb_uint8 *pServerChannel,
|
||||||
cbBCM_ConnectionCallback *pConnectionCallback);
|
cbBCM_ConnectionCallback *pConnectionCallback,
|
||||||
|
cbBCM_ServiceClassEnabled pServiceClassEnabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable a service record with an application specific UUID.
|
* Enable a service record with an application specific UUID.
|
||||||
|
@ -276,13 +298,15 @@ extern cb_int32 cbBCM_enableServerProfileDun(
|
||||||
* @param pServerChannel Pointer to return variable. The server channel is used to identify
|
* @param pServerChannel Pointer to return variable. The server channel is used to identify
|
||||||
* incoming connections.
|
* incoming connections.
|
||||||
* @param pConnectionCallback Callback structure for connection management.
|
* @param pConnectionCallback Callback structure for connection management.
|
||||||
|
* @param pServiceClassEnabled Callback structure to inform when service is running.
|
||||||
* @return If the operation is successful cbBCM_OK is returned.
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
*/
|
*/
|
||||||
extern cb_int32 cbBCM_enableServerProfileUuid128(
|
extern cb_int32 cbBCM_enableServerProfileUuid128(
|
||||||
cb_uint8 *pUuid128,
|
cb_uint8 *pUuid128,
|
||||||
cb_char *pServiceName,
|
cb_char *pServiceName,
|
||||||
cb_uint8 *pServerChannel,
|
cb_uint8 *pServerChannel,
|
||||||
cbBCM_ConnectionCallback *pConnectionCallback);
|
cbBCM_ConnectionCallback *pConnectionCallback,
|
||||||
|
cbBCM_ServiceClassEnabled pServiceClassEnabled);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,12 +319,14 @@ extern cb_int32 cbBCM_enableServerProfileUuid128(
|
||||||
* @param pServiceName The name of the service
|
* @param pServiceName The name of the service
|
||||||
* @param role The PAN role of the local device
|
* @param role The PAN role of the local device
|
||||||
* @param pConnectionCallback Callback structure for connection management.
|
* @param pConnectionCallback Callback structure for connection management.
|
||||||
|
* @param pServiceClassEnabled Callback structure to inform when service is running.
|
||||||
* @return If the operation is successful cbBCM_OK is returned.
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
*/
|
*/
|
||||||
extern cb_int32 cbBCM_enableServerProfilePan(
|
extern cb_int32 cbBCM_enableServerProfilePan(
|
||||||
cb_char *pServiceName,
|
cb_char *pServiceName,
|
||||||
cbBCM_PAN_Role role,
|
cbBCM_PAN_Role role,
|
||||||
cbBCM_ConnectionCallback *pConnectionCallback);
|
cbBCM_ConnectionCallback *pConnectionCallback,
|
||||||
|
cbBCM_ServiceClassEnabled pServiceClassEnabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable device id service record.The device id service record is a method by which
|
* Enable device id service record.The device id service record is a method by which
|
||||||
|
@ -393,7 +419,7 @@ extern cb_uint16 cbBCM_getMaxLinksLE(void);
|
||||||
* @param serverChannel RFCOMM server channel that shall be used. Set to
|
* @param serverChannel RFCOMM server channel that shall be used. Set to
|
||||||
* cbBCM_INVALID_SERVER_CHANNEL to perform automatic
|
* cbBCM_INVALID_SERVER_CHANNEL to perform automatic
|
||||||
* service search to find the server channel.
|
* service search to find the server channel.
|
||||||
* @param pAclParameters Link configuration including link supervision timeout
|
* @param pAclParameters Link configuration including link supervision timeout
|
||||||
* and master slave policy. Pass NULL to use default connection
|
* and master slave policy. Pass NULL to use default connection
|
||||||
* parameters.
|
* parameters.
|
||||||
* @param pConnectionCallback Callback structure for connection management.
|
* @param pConnectionCallback Callback structure for connection management.
|
||||||
|
@ -439,7 +465,7 @@ extern cb_int32 cbBCM_rspConnectSppCnf(
|
||||||
* @param serverChannel RFCOMM server channel that shall be used. Set to
|
* @param serverChannel RFCOMM server channel that shall be used. Set to
|
||||||
* cbBCM_INVALID_SERVER_CHANNEL to perform automatic
|
* cbBCM_INVALID_SERVER_CHANNEL to perform automatic
|
||||||
* service search to find the server channel.
|
* service search to find the server channel.
|
||||||
* @param pAclParameters Link configuration including link supervision timeout
|
* @param pAclParameters Link configuration including link supervision timeout
|
||||||
* and master slave policy. Pass NULL to use default connection
|
* and master slave policy. Pass NULL to use default connection
|
||||||
* parameters.
|
* parameters.
|
||||||
* @param pConnectionCallback Callback structure for connection management.
|
* @param pConnectionCallback Callback structure for connection management.
|
||||||
|
@ -457,7 +483,7 @@ extern cbBCM_Handle cbBCM_reqConnectDun(
|
||||||
* Accept or reject an incoming DUN connection. This is a
|
* Accept or reject an incoming DUN connection. This is a
|
||||||
* response to a cbBCM_ConnectInd connection indication.
|
* response to a cbBCM_ConnectInd connection indication.
|
||||||
*
|
*
|
||||||
* @param handle Connection handle
|
* @param handle Connection handle
|
||||||
* @param accept TRUE to accept the incoming connection.
|
* @param accept TRUE to accept the incoming connection.
|
||||||
FALSE to reject.
|
FALSE to reject.
|
||||||
* @return If the operation is successful cbBCM_OK is returned.
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
|
@ -505,7 +531,7 @@ extern cbBCM_Handle cbBCM_reqConnectUuid(
|
||||||
* Accept or reject an incoming SPP connection. This is a
|
* Accept or reject an incoming SPP connection. This is a
|
||||||
* response to a cbBCM_ConnectInd connection indication.
|
* response to a cbBCM_ConnectInd connection indication.
|
||||||
*
|
*
|
||||||
* @param handle Connection handle
|
* @param handle Connection handle
|
||||||
* @param accept TRUE to accept the incoming connection.
|
* @param accept TRUE to accept the incoming connection.
|
||||||
FALSE to reject.
|
FALSE to reject.
|
||||||
* @return If the operation is successful cbBCM_OK is returned.
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
|
@ -542,7 +568,7 @@ extern cbBCM_Handle cbBCM_reqConnectPan(
|
||||||
* Accept or reject an incoming PAN connection. This is a
|
* Accept or reject an incoming PAN connection. This is a
|
||||||
* response to a cbBCM_ConnectInd connection indication.
|
* response to a cbBCM_ConnectInd connection indication.
|
||||||
*
|
*
|
||||||
* @param handle Connection handle
|
* @param handle Connection handle
|
||||||
* @param accept TRUE to accept the incoming connection.
|
* @param accept TRUE to accept the incoming connection.
|
||||||
* FALSE to reject.
|
* FALSE to reject.
|
||||||
* @return If the operation is successful cbBCM_OK is returned.
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
|
@ -604,7 +630,7 @@ extern cbBCM_Handle cbBCM_reqConnectSps(
|
||||||
/**
|
/**
|
||||||
* Accept or reject an incoming SPS connection. This is a
|
* Accept or reject an incoming SPS connection. This is a
|
||||||
* response to a cbBCM_ConnectInd connection indication.
|
* response to a cbBCM_ConnectInd connection indication.
|
||||||
* @param handle Connection handle
|
* @param handle Connection handle
|
||||||
* @param accept TRUE to accept the incoming connection.
|
* @param accept TRUE to accept the incoming connection.
|
||||||
* FALSE to reject.
|
* FALSE to reject.
|
||||||
* @return If the operation is successful cbBCM_OK is returned.
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
|
@ -813,10 +839,50 @@ extern cb_int32 cbBCM_registerDataCallback(
|
||||||
extern cbBCM_Handle cbBCM_getProtocolHandle(
|
extern cbBCM_Handle cbBCM_getProtocolHandle(
|
||||||
cbBCM_Handle handle);
|
cbBCM_Handle handle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the bcm id from acl handle for an active connection.
|
||||||
|
*
|
||||||
|
* @param handle Connection handle
|
||||||
|
* @return bcm handle.
|
||||||
|
*/
|
||||||
|
extern cbBCM_Handle cbBCM_getIdFromAclHandle(TConnHandle aclHandle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the acl handle from bcm handle.
|
||||||
|
*
|
||||||
|
* @param handle bcm handle
|
||||||
|
* @return acl handle
|
||||||
|
*/
|
||||||
|
extern TConnHandle cbBCM_getAclFromIdHandle(cbBCM_Handle bcmHandle);
|
||||||
|
/**
|
||||||
|
* @brief This will send cbHCI_cmdFlowSpecification command for the specified link
|
||||||
|
* with the specified parameters.
|
||||||
|
* @param handle Connection handle
|
||||||
|
* @param parameters Flow Specification parameters. For details see Bluetooth Core
|
||||||
|
* Specification [Vol 3] Part A, Section 5.3
|
||||||
|
* @param flowSpecCallback Callback contains the data in Flow Specification Complete event
|
||||||
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
|
*/
|
||||||
|
extern cb_int32 cbBCM_setFlowSpecification(
|
||||||
|
cbBCM_Handle handle,
|
||||||
|
cbBCM_FlowSpecParams parameters,
|
||||||
|
cbBCM_SetFlowSpecCallback flowSpecCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Change which packet types can be used for the connection identified by the handle
|
||||||
|
* @param handle Connection handle
|
||||||
|
* @param aclPacketType bit map according to packet types defined in bt_types.h
|
||||||
|
* @return If the operation is successful cbBCM_OK is returned.
|
||||||
|
*/
|
||||||
|
extern cb_int32 cbBCM_changeConnectionPacketType(
|
||||||
|
cbBCM_Handle handle,
|
||||||
|
TPacketType aclPacketType);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* _CB_BT_CONN_MAN_H_ */
|
#endif /* _CB_BT_CONN_MAN_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,7 @@ typedef void (*cbBM_ChannelMapCallb)(
|
||||||
TChannelMap *pChMap);
|
TChannelMap *pChMap);
|
||||||
|
|
||||||
typedef void (*cbBM_InitComplete)(void);
|
typedef void (*cbBM_InitComplete)(void);
|
||||||
|
typedef void(*cbBM_LocalAddressCb)(void);
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
@ -149,6 +150,17 @@ typedef enum
|
||||||
cbBM_LE_ROLE_PERIPHERAL = 2,
|
cbBM_LE_ROLE_PERIPHERAL = 2,
|
||||||
} cbBM_LeRole;
|
} cbBM_LeRole;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
cb_uint8 flags;
|
||||||
|
cb_uint8 flowDirection;
|
||||||
|
cb_uint8 serviceType;
|
||||||
|
cb_uint32 tokenRate;
|
||||||
|
cb_uint32 tokenBucketSize;
|
||||||
|
cb_uint32 peakBandwidth;
|
||||||
|
cb_uint32 latency;
|
||||||
|
} cbBM_FlowSpecParams;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bluetooth Manager initialization parameters.
|
* Bluetooth Manager initialization parameters.
|
||||||
*/
|
*/
|
||||||
|
@ -157,12 +169,13 @@ typedef struct
|
||||||
TBdAddr address; /** Bluetooth address that shall be assigned to controller. Pass invalidBdAddress to use controller default address*/
|
TBdAddr address; /** Bluetooth address that shall be assigned to controller. Pass invalidBdAddress to use controller default address*/
|
||||||
cbBM_LeRole leRole; /** Bluetooth low energy role */
|
cbBM_LeRole leRole; /** Bluetooth low energy role */
|
||||||
cb_int8 maxOutputPower; /** Maximum output power. */
|
cb_int8 maxOutputPower; /** Maximum output power. */
|
||||||
cb_uint32 nvdsStartIdLinkKeysClassic; /** Start id for CLASSIC link keys storage in NVDS. */
|
cb_int32 nvdsStartIdLinkKeysClassic; /** Start id for CLASSIC link keys storage in NVDS. */
|
||||||
cb_uint32 maxLinkKeysClassic; /** Max number of CLASSIC link keys */
|
cb_int32 maxLinkKeysClassic; /** Max number of CLASSIC link keys */
|
||||||
cb_uint32 nvdsStartIdLinkKeysLe; /** Start id for BLE link keys storage in NVDS. */
|
cb_int32 nvdsStartIdLinkKeysLe; /** Start id for BLE link keys storage in NVDS. */
|
||||||
cb_uint32 maxLinkKeysLe; /** Max number of link keys BLE*/
|
cb_int32 maxLinkKeysLe; /** Max number of link keys BLE*/
|
||||||
} cbBM_InitParams;
|
} cbBM_InitParams;
|
||||||
|
|
||||||
|
typedef void(*cbBM_ServiceEnabled)(cb_uint8 serviceChannel);
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
* FUNCTIONS
|
* FUNCTIONS
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
|
@ -184,12 +197,70 @@ extern void cbBM_init(
|
||||||
cbBM_InitParams *pInitParameters,
|
cbBM_InitParams *pInitParameters,
|
||||||
cbBM_InitComplete initCompleteCallback);
|
cbBM_InitComplete initCompleteCallback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function sets the default link supervision timeout. The specified timeout will
|
||||||
|
* apply for new connections.
|
||||||
|
* @param linkSupervisionTimeout timeout in milliseconds
|
||||||
|
* @return If the operation is successful cbBM_OK is returned.
|
||||||
|
*/
|
||||||
|
extern cb_int32 cbBM_setLinkSupervisionTimeout(
|
||||||
|
cb_uint16 linkSupervisionTimeout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function gets the default link supervision timeout.
|
||||||
|
* @return link supervision timeout in milliseconds.
|
||||||
|
*/
|
||||||
|
extern cb_uint16 cbBM_getLinkSupervisionTimeout(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function enables or disables the fast connect feature (interlaced page scan).
|
||||||
|
* @param fastConnect
|
||||||
|
* @return cbBM_OK if in parameter is valid.
|
||||||
|
*/
|
||||||
|
extern cb_int32 cbBM_setFastConnect(
|
||||||
|
cb_boolean fastConnect);
|
||||||
|
/**
|
||||||
|
* This function gets whether the fast connect feature is enabled or disabled.
|
||||||
|
* @return TRUE if feature is enabled
|
||||||
|
*/
|
||||||
|
extern cb_boolean cbBM_getFastConnect(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function enables or disables the fast discovery feature (interlaced inquiry scan).
|
||||||
|
* @param fastDiscovery
|
||||||
|
* @return cbBM_OK if in parameter is valid.
|
||||||
|
*/
|
||||||
|
extern cb_int32 cbBM_setFastDiscovery(
|
||||||
|
cb_boolean fastDiscovery);
|
||||||
|
/**
|
||||||
|
* This function gets whether the fast discovery feature is enabled or disabled.
|
||||||
|
* @return TRUE if feature is enabled
|
||||||
|
*/
|
||||||
|
extern cb_boolean cbBM_getFastDiscovery(void);
|
||||||
/**
|
/**
|
||||||
* This function sets all default parameters for LE.
|
* This function sets all default parameters for LE.
|
||||||
* This function needs to be called before the cbBM_init.
|
* This function needs to be called before the cbBM_init.
|
||||||
*/
|
*/
|
||||||
extern void cbBM_setDefaultValuesLeParams(void);
|
extern void cbBM_setDefaultValuesLeParams(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function executes HCI_cmdWrScanEnable command according to parameters.
|
||||||
|
* @param discoverableMode discoverable mode
|
||||||
|
* @param connectableMode connectable mode
|
||||||
|
* @return true if HCI command could be executed.
|
||||||
|
*/
|
||||||
|
extern cb_int32 cbBM_updateScan(
|
||||||
|
cbBM_DiscoverableMode discoverableMode,
|
||||||
|
cbBM_ConnectableMode connectableMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current Bluetooth address of the device from radio. This can
|
||||||
|
* be a way to get a alive-message from the radio.
|
||||||
|
*
|
||||||
|
* @param callback to application when address has been read.
|
||||||
|
*/
|
||||||
|
extern void cbBM_checkRadioAlive(cbBM_LocalAddressCb callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current Bluetooth address of the device.
|
* Get the current Bluetooth address of the device.
|
||||||
* @param pAddress Pointer to return variable.
|
* @param pAddress Pointer to return variable.
|
||||||
|
@ -335,9 +406,11 @@ extern cb_int32 cbBM_remoteName(
|
||||||
* Add service class to inquiry response data. Typically
|
* Add service class to inquiry response data. Typically
|
||||||
* not used by the application.
|
* not used by the application.
|
||||||
* @param uuid16 The UUID to add
|
* @param uuid16 The UUID to add
|
||||||
|
* @param pCallback callback to indicate service is enabled.
|
||||||
|
* @param serviceChannel channel the service is started on.
|
||||||
* @return If the operation is successful cbBM_OK is returned.
|
* @return If the operation is successful cbBM_OK is returned.
|
||||||
*/
|
*/
|
||||||
extern cb_int32 cbBM_addServiceClass(cb_uint16 uuid16);
|
extern cb_int32 cbBM_addServiceClass(cb_uint16 uuid16, cbBM_ServiceEnabled pCallback,cb_uint8 serviceChannel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if service class is already registered.
|
* Check if service class is already registered.
|
||||||
|
@ -350,9 +423,11 @@ cb_boolean cbBM_isServiceClassRegistered(cb_uint16 uuid16 );
|
||||||
* Add service class to inquiry response data. Typically
|
* Add service class to inquiry response data. Typically
|
||||||
* not used by the application.
|
* not used by the application.
|
||||||
* @param uuid128 The UUID to add.
|
* @param uuid128 The UUID to add.
|
||||||
|
* @param pCallback callback to indicate service is enabled.
|
||||||
|
* @param serviceChannel channel the service is started on.
|
||||||
* @return If the operation is successful cbBM_OK is returned.
|
* @return If the operation is successful cbBM_OK is returned.
|
||||||
*/
|
*/
|
||||||
extern cb_int32 cbBM_add128BitsServiceClass(cb_uint8* uuid128);
|
extern cb_int32 cbBM_add128BitsServiceClass(cb_uint8* uuid128, cbBM_ServiceEnabled pCallback, cb_uint8 serviceChannel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set maximum Bluetooth Classic ACL links the stack
|
* Set maximum Bluetooth Classic ACL links the stack
|
||||||
|
@ -521,7 +596,7 @@ extern cb_int32 cbBM_deviceDiscoveryLeCancel(void);
|
||||||
/**
|
/**
|
||||||
* Perform a remote name request for Bluetooth Low Energy.
|
* Perform a remote name request for Bluetooth Low Energy.
|
||||||
* @param pAddress Pointer to address of remote device.
|
* @param pAddress Pointer to address of remote device.
|
||||||
* @param remoteNameCallback Callback used to notify the the completion of the
|
* @param remoteNameCallback Callback used to notify the the completion of the
|
||||||
* name request.
|
* name request.
|
||||||
* @return If the operation is successfully initiated cbBM_OK is returned.
|
* @return If the operation is successfully initiated cbBM_OK is returned.
|
||||||
*/
|
*/
|
||||||
|
@ -560,6 +635,9 @@ void cbBM_getConnectParameters(TAclParamsLe* aclParams);
|
||||||
*/
|
*/
|
||||||
void cbBM_getRemoteNameReqParameters(TAclParamsLe* aclParams);
|
void cbBM_getRemoteNameReqParameters(TAclParamsLe* aclParams);
|
||||||
|
|
||||||
|
|
||||||
|
cb_int32 cbBM_setForceClassicNotSupportedInAdv(cb_boolean enforceDisable);
|
||||||
|
cb_boolean cbBM_getForceClassicNotSupportedInAdv(void);
|
||||||
/*
|
/*
|
||||||
* Sets the LE parameter.
|
* Sets the LE parameter.
|
||||||
* @newValue new parameter value.
|
* @newValue new parameter value.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
*
|
||||||
* Component : Bluetooth Serial
|
* Component : Bluetooth PAN Data Manager
|
||||||
* File : cb_bt_pan.h
|
* File : cb_bt_pan.h
|
||||||
*
|
*
|
||||||
* Description : Data management for PAN profile
|
* Description : Data management for PAN profile
|
||||||
|
|
|
@ -346,7 +346,7 @@ extern cb_int32 cbBSM_getAllNumberBondedDevices(
|
||||||
* @return If the operation is successful cbBSM_OK is returned.
|
* @return If the operation is successful cbBSM_OK is returned.
|
||||||
*/
|
*/
|
||||||
extern cb_int32 cbBSM_getBondedDevice(
|
extern cb_int32 cbBSM_getBondedDevice(
|
||||||
uint32 deviceIndex,
|
cb_int32 deviceIndex,
|
||||||
TBdAddr* pBdAddr,
|
TBdAddr* pBdAddr,
|
||||||
cb_boolean pIsLe);
|
cb_boolean pIsLe);
|
||||||
|
|
||||||
|
@ -365,6 +365,14 @@ extern cb_int32 cbBSM_deleteBondedDevice(TBdAddr* pBdAddress);
|
||||||
*/
|
*/
|
||||||
extern cb_int32 cbBSM_deleteAllBondedDevices(void);
|
extern cb_int32 cbBSM_deleteAllBondedDevices(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the static Link Keys for both classic and LE.
|
||||||
|
* nvdsId: nvds id for the static link key,
|
||||||
|
* (0) disables the use of a static link key.
|
||||||
|
*
|
||||||
|
* @return cbBSM_OK.
|
||||||
|
*/
|
||||||
|
cb_int32 cbBSM_setStaticLinkKeyNvdsId(cb_int32 nvdsId);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -89,7 +89,7 @@ extern cb_int32 cbBTM_enableDUT(cbBTM_TestCallback callback);
|
||||||
* 0x03 = BT EDR 3MB (8-DPSK)
|
* 0x03 = BT EDR 3MB (8-DPSK)
|
||||||
* 0x04 = BT LE (BLE, GMSK)
|
* 0x04 = BT LE (BLE, GMSK)
|
||||||
* 0x05 = ANT (GFSK)
|
* 0x05 = ANT (GFSK)
|
||||||
* @param testPattern Range: 0x00 - 0x07
|
* @param testPattern Range: 0x00 - 0x07
|
||||||
* 0x00 = PN9
|
* 0x00 = PN9
|
||||||
* 0x01 = PN15
|
* 0x01 = PN15
|
||||||
* 0x02 = ZOZO (101010101010101010)
|
* 0x02 = ZOZO (101010101010101010)
|
||||||
|
@ -165,7 +165,7 @@ extern cb_int32 cbBTM_tiDrpbTesterConRx(
|
||||||
* @param frequencyMode 0x00 = Hopping 0x03 = Single frequency
|
* @param frequencyMode 0x00 = Hopping 0x03 = Single frequency
|
||||||
* @param txSingleFrequency Transmission frequency in MHz,Range 2402 - 2480, 0xFFFF = no TX
|
* @param txSingleFrequency Transmission frequency in MHz,Range 2402 - 2480, 0xFFFF = no TX
|
||||||
* @param rxSingleFrequency Transmission frequency in MHz,Range 2402 - 2480, 0xFFFF = no RX
|
* @param rxSingleFrequency Transmission frequency in MHz,Range 2402 - 2480, 0xFFFF = no RX
|
||||||
* @param aclDataPattern ACL TX packet data pattern Range: 0x00 - 0x05
|
* @param aclDataPattern ACL TX packet data pattern Range: 0x00 - 0x05
|
||||||
* 0x00 = All 0
|
* 0x00 = All 0
|
||||||
* 0x01 = All 1
|
* 0x01 = All 1
|
||||||
* 0x02 = ZOZO (101010101010101010)
|
* 0x02 = ZOZO (101010101010101010)
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*---------------------------------------------------------------------------
|
||||||
|
* Copyright (c) 2016, u-blox Malmö, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: LicenseRef-PBL
|
||||||
|
*
|
||||||
|
* This file and the related binary are licensed under the
|
||||||
|
* Permissive Binary License, Version 1.0 (the "License");
|
||||||
|
* you may not use these files except in compliance with the License.
|
||||||
|
*
|
||||||
|
* You may obtain a copy of the License here:
|
||||||
|
* LICENSE-permissive-binary-license-1.0.txt and at
|
||||||
|
* https://www.mbed.com/licenses/PBL-1.0
|
||||||
|
*
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* Component : WLAN
|
||||||
|
* File : cb_cert_utils.h
|
||||||
|
*
|
||||||
|
* Description :
|
||||||
|
*-------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file cb_cert_utils.h The main WLAN component interface.
|
||||||
|
* All functions declared extern needs to be provided by another/upper layer.
|
||||||
|
* @ingroup wlan
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _CB_CERT_UTILS_H_
|
||||||
|
#define _CB_CERT_UTILS_H_
|
||||||
|
|
||||||
|
#include "cb_types.h"
|
||||||
|
#include "cb_status.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
* DEFINES
|
||||||
|
*=========================================================================*/
|
||||||
|
#define cbCERT_CRT_MAX_CHAIN_LENGTH 5ul
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
* TYPES
|
||||||
|
*=========================================================================*/
|
||||||
|
|
||||||
|
typedef struct cbCERT_Stream_s cbCERT_Stream;
|
||||||
|
typedef cb_uint32 cbCERT_StreamPosition;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stream vtable interface used by WLAN supplicant to access SSL certificates
|
||||||
|
* for WPA Enterprise authentication.
|
||||||
|
*
|
||||||
|
* @ingroup wlan
|
||||||
|
*/
|
||||||
|
struct cbCERT_Stream_s {
|
||||||
|
cb_int32(*read)(const cbCERT_Stream *stream, void *buf, cb_uint32 count); /**< Read function pointer, place count bytes in buf. */
|
||||||
|
cb_int32(*write)(const cbCERT_Stream *stream, void *buf, cb_uint32 count); /**< Read function pointer, place count bytes in buf. */
|
||||||
|
void(*rewind)(const cbCERT_Stream *stream); /**< Rewind function pointer, rewind stream internal iterator to the beginning. Mandatory for all streams. */
|
||||||
|
void(*setPosition)(const cbCERT_Stream *stream, cbCERT_StreamPosition position); /**< Set absolute position. */
|
||||||
|
cbCERT_StreamPosition(*getPosition)(const cbCERT_Stream *stream); /**< Get current position. */
|
||||||
|
cb_uint32(*getSize)(const cbCERT_Stream *stream); /**< GetSize function pointer, return total size of stream contents. */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*===========================================================================
|
||||||
|
* CERT API
|
||||||
|
*=========================================================================*/
|
||||||
|
|
||||||
|
cbRTSL_Status cbCERT_Util_parseDERCert(cbCERT_Stream const * const certificate, cbCERT_Stream const * const outputStream);
|
||||||
|
cbRTSL_Status cbCERT_Util_parseDERKey(cbCERT_Stream const * const key, cbCERT_Stream const * const outputStream);
|
||||||
|
cbRTSL_Status cbCERT_Util_parsePEMCert(cbCERT_Stream const * const certificate, cbCERT_Stream const * const outputStream);
|
||||||
|
cbRTSL_Status cbCERT_Util_parsePEMKey(cbCERT_Stream const * const certificate, cb_char const * const key, cb_uint32 keyLength, cbCERT_Stream const * const outputStream);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _CB_CERT_UTILS_H_ */
|
||||||
|
|
|
@ -31,9 +31,9 @@
|
||||||
* app must wait until all responses from an outstanding request have been
|
* app must wait until all responses from an outstanding request have been
|
||||||
* received.
|
* received.
|
||||||
* - In the callback of the request another request can not be done except when
|
* - In the callback of the request another request can not be done except when
|
||||||
* - The request is interrupted by setting the return value to FALSE
|
* the request is interrupted by setting the return value to FALSE
|
||||||
* or when in the last callback which contains an error code.
|
* or when in the last callback which contains an error code.
|
||||||
* - Most of the GATT requests can be interrupted by returning FALSE in the
|
* - Most of the GATT requests can be interrupted by returning FALSE in the
|
||||||
* callback.
|
* callback.
|
||||||
*
|
*
|
||||||
* See Bluetooth 4.0 specification for more info on GATT and ATT chapters:
|
* See Bluetooth 4.0 specification for more info on GATT and ATT chapters:
|
||||||
|
|
|
@ -76,7 +76,7 @@ extern "C" {
|
||||||
* cbGATT_CLIENT_CHAR_CONFIG - callback that is called when remote device writes the client config cbGATT_ServerWriteClientConfig
|
* cbGATT_CLIENT_CHAR_CONFIG - callback that is called when remote device writes the client config cbGATT_ServerWriteClientConfig
|
||||||
* cbGATT_SERVER_CHAR_CONFIG - callback that is called when remote device writes the server config cbGATT_ServerWriteServerConfig
|
* cbGATT_SERVER_CHAR_CONFIG - callback that is called when remote device writes the server config cbGATT_ServerWriteServerConfig
|
||||||
* cbGATT_CHAR_USER_DESC and all other CHARACTERISTICS value - cbGATT_ServerWriteAttr callback
|
* cbGATT_CHAR_USER_DESC and all other CHARACTERISTICS value - cbGATT_ServerWriteAttr callback
|
||||||
* @param pAttrHandle Pointer where to write the attribute handle in case it's needed by the app.
|
* @param pAttrHandle Pointer where to write the attribute handle in case it's needed by the app.
|
||||||
* If not needed, pass NULL. Will be written after the service has been added.
|
* If not needed, pass NULL. Will be written after the service has been added.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -152,7 +152,7 @@ typedef cbGATT_ErrorCode (*cbGATT_ServerReadAttr)(
|
||||||
* @param pAttr Pointer to attribute record
|
* @param pAttr Pointer to attribute record
|
||||||
* @param pAttrValue Pointer where to get the data
|
* @param pAttrValue Pointer where to get the data
|
||||||
* @param length The length.
|
* @param length The length.
|
||||||
* @param writeMethod Which write method the client is using.
|
* @param writeMethod Which write method the client is using.
|
||||||
* This depends on the properties in the attribute table.
|
* This depends on the properties in the attribute table.
|
||||||
* @param offset The offset of the written data
|
* @param offset The offset of the written data
|
||||||
* @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed.
|
* @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed.
|
||||||
|
@ -183,7 +183,7 @@ typedef cbGATT_ErrorCode (*cbGATT_ServerReadClientConfig)(
|
||||||
* @param connHandle Connection handle
|
* @param connHandle Connection handle
|
||||||
* @param attrHandle Handle of the attribute value
|
* @param attrHandle Handle of the attribute value
|
||||||
* @param config The config to be stored
|
* @param config The config to be stored
|
||||||
* @param writeMethod Which write method the client is using.
|
* @param writeMethod Which write method the client is using.
|
||||||
* This depends on the properties in the attribute table.
|
* This depends on the properties in the attribute table.
|
||||||
* @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed.
|
* @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed.
|
||||||
*/
|
*/
|
||||||
|
@ -210,7 +210,7 @@ typedef cbGATT_ErrorCode (*cbGATT_ServerReadServerConfig)(
|
||||||
* @param connHandle Connection handle
|
* @param connHandle Connection handle
|
||||||
* @param attrHandle Handle of the attribute value
|
* @param attrHandle Handle of the attribute value
|
||||||
* @param config The config to be stored
|
* @param config The config to be stored
|
||||||
* @param writeMethod Which write method the client is using.
|
* @param writeMethod Which write method the client is using.
|
||||||
* This depends on the properties in the attribute table.
|
* This depends on the properties in the attribute table.
|
||||||
* @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed.
|
* @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed.
|
||||||
*/
|
*/
|
||||||
|
@ -254,7 +254,7 @@ cb_int32 cbGATT_deregisterAllServers(void);
|
||||||
/**
|
/**
|
||||||
* Send notification to GATT client. The characteristicValueNotificationCnf
|
* Send notification to GATT client. The characteristicValueNotificationCnf
|
||||||
* callback will be called when finished and a new notification can be sent.
|
* callback will be called when finished and a new notification can be sent.
|
||||||
* The client config notification must have been enabled by the GATT client
|
* The client config notification must have been enabled by the GATT client
|
||||||
* before an notification can be sent.
|
* before an notification can be sent.
|
||||||
* @param connHandle Connection handle
|
* @param connHandle Connection handle
|
||||||
* @param attrHandle Handle of the attribute value
|
* @param attrHandle Handle of the attribute value
|
||||||
|
@ -264,16 +264,16 @@ cb_int32 cbGATT_deregisterAllServers(void);
|
||||||
* @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed.
|
* @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed.
|
||||||
*/
|
*/
|
||||||
cb_int32 cbGATT_notification(
|
cb_int32 cbGATT_notification(
|
||||||
TConnHandle connHandle,
|
TConnHandle connHandle,
|
||||||
cb_uint16 attrHandle,
|
cb_uint16 attrHandle,
|
||||||
cb_uint8* pData,
|
cb_uint8* pData,
|
||||||
cb_uint16 length,
|
cb_uint16 length,
|
||||||
cb_uint8 appHandle);
|
cb_uint8 appHandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send indication to GATT client. The characteristicValueIndicationCnf
|
* Send indication to GATT client. The characteristicValueIndicationCnf
|
||||||
* callback will be called when finished and a new indication can be sent.
|
* callback will be called when finished and a new indication can be sent.
|
||||||
* The client config indication must have been enabled by the GATT client
|
* The client config indication must have been enabled by the GATT client
|
||||||
* before an indication can be sent.
|
* before an indication can be sent.
|
||||||
* @param connHandle Connection handle
|
* @param connHandle Connection handle
|
||||||
* @param attrHandle Handle of the attribute value
|
* @param attrHandle Handle of the attribute value
|
||||||
|
@ -283,17 +283,17 @@ cb_int32 cbGATT_notification(
|
||||||
* @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed.
|
* @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed.
|
||||||
*/
|
*/
|
||||||
cb_int32 cbGATT_indication(
|
cb_int32 cbGATT_indication(
|
||||||
TConnHandle connHandle,
|
TConnHandle connHandle,
|
||||||
cb_uint16 attrHandle,
|
cb_uint16 attrHandle,
|
||||||
cb_uint8* pData,
|
cb_uint8* pData,
|
||||||
cb_uint16 length,
|
cb_uint16 length,
|
||||||
cb_uint8 appHandle);
|
cb_uint8 appHandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay write respone to client, see cbGATT_ServerWriteAttr
|
* Delay write respone to client, see cbGATT_ServerWriteAttr
|
||||||
* @param connHandle Connection handle
|
* @param connHandle Connection handle
|
||||||
* @param attrHandle Handle of the attribute value
|
* @param attrHandle Handle of the attribute value
|
||||||
* @param errorCode Error code, use cbGATT_ERROR_CODE_OK if OK otherwise some cbGATT_ERROR_CODE_*
|
* @param errorCode Error code, use cbGATT_ERROR_CODE_OK if OK otherwise some cbGATT_ERROR_CODE_*
|
||||||
* @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed.
|
* @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed.
|
||||||
*/
|
*/
|
||||||
cb_int32 cbGATT_writeRsp(
|
cb_int32 cbGATT_writeRsp(
|
||||||
|
@ -305,15 +305,15 @@ cb_int32 cbGATT_writeRsp(
|
||||||
* Add service list to attribute database
|
* Add service list to attribute database
|
||||||
* @param pAttrList Attribute list
|
* @param pAttrList Attribute list
|
||||||
* @param attrListSize Size of the attribute list
|
* @param attrListSize Size of the attribute list
|
||||||
* @param startHandle Start handle. Note that startHandle for the application
|
* @param startHandle Start handle. Note that startHandle for the application
|
||||||
* should start at lowest 1024, cbGATT_APP_START_SERVICE_HANDLE.
|
* should start at lowest 1024, cbGATT_APP_START_SERVICE_HANDLE.
|
||||||
* 1-1023 is reserved for GATT/GAP and other u-blox services.
|
* 1-1023 is reserved for GATT/GAP and other u-blox services.
|
||||||
* @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed.
|
* @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed.
|
||||||
*/
|
*/
|
||||||
cb_int32 cbGATT_addService(
|
cb_int32 cbGATT_addService(
|
||||||
const cbGATT_Attribute* pAttrList,
|
const cbGATT_Attribute* pAttrList,
|
||||||
cb_uint16 attrListSize,
|
cb_uint16 attrListSize,
|
||||||
cb_int16 startHandle);
|
cb_uint16 startHandle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NOTE: Only for tests
|
* NOTE: Only for tests
|
||||||
|
|
|
@ -59,6 +59,11 @@ typedef enum {
|
||||||
cbHW_IRQ_LOW = 12U
|
cbHW_IRQ_LOW = 12U
|
||||||
}cbHW_PRIO_LVL;
|
}cbHW_PRIO_LVL;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
cbHW_SYSTICK_DISABLED,
|
||||||
|
cbHW_SYSTICK_LOW_FREQ,
|
||||||
|
cbHW_SYSTICK_DEFAULT,
|
||||||
|
} cbHW_SysTickMode;
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
* TYPES
|
* TYPES
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
|
@ -79,6 +84,7 @@ void cbHW_enterSleepMode(void);
|
||||||
void cbHW_enterStopMode(void);
|
void cbHW_enterStopMode(void);
|
||||||
void cbHW_setWakeupEvent(void);
|
void cbHW_setWakeupEvent(void);
|
||||||
void cbHW_resetWakeupEvent(void);
|
void cbHW_resetWakeupEvent(void);
|
||||||
|
void cbHW_setSysTickMode(cbHW_SysTickMode sysTickMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait for specified amount of microseconds. May be interrupt dependent.
|
* Wait for specified amount of microseconds. May be interrupt dependent.
|
||||||
|
@ -143,4 +149,3 @@ void cbHW_enableAllIrq(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
|
|
||||||
#define OK(status) (status == cbSTATUS_OK)
|
#define OK(status) (status == cbSTATUS_OK)
|
||||||
|
#define BUSY(status) (status == cbSTATUS_BUSY)
|
||||||
|
#define ERR(status) (status == cbSTATUS_ERROR)
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
* TYPES
|
* TYPES
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
|
@ -36,6 +38,7 @@
|
||||||
cbSTATUS_OK,
|
cbSTATUS_OK,
|
||||||
cbSTATUS_ERROR,
|
cbSTATUS_ERROR,
|
||||||
cbSTATUS_BUSY,
|
cbSTATUS_BUSY,
|
||||||
|
cbSTATUS_RECEIVE_DATA_MODE,
|
||||||
cbSTATUS_TIMEOUT
|
cbSTATUS_TIMEOUT
|
||||||
|
|
||||||
} cbRTSL_Status;
|
} cbRTSL_Status;
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "cb_types.h"
|
#include "cb_types.h"
|
||||||
#include "cb_wlan_types.h"
|
#include "cb_wlan_types.h"
|
||||||
|
#include "cb_cert_utils.h"
|
||||||
#include "cb_status.h"
|
#include "cb_status.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -75,25 +76,6 @@ extern "C" {
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
* TYPES
|
* TYPES
|
||||||
*=========================================================================*/
|
*=========================================================================*/
|
||||||
|
|
||||||
typedef struct cbWLAN_Stream_s cbWLAN_Stream;
|
|
||||||
typedef cb_uint32 cbWLAN_StreamPosition;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stream vtable interface used by WLAN supplicant to access SSL certificates
|
|
||||||
* for WPA Enterprise authentication.
|
|
||||||
*
|
|
||||||
* @ingroup wlan
|
|
||||||
*/
|
|
||||||
struct cbWLAN_Stream_s {
|
|
||||||
cb_int32 (*read)(const cbWLAN_Stream *stream, void *buf, cb_uint32 count); /**< Read function pointer, place count bytes in buf. */
|
|
||||||
cb_int32 (*write)(const cbWLAN_Stream *stream, void *buf, cb_uint32 count); /**< Read function pointer, place count bytes in buf. */
|
|
||||||
void (*rewind)(const cbWLAN_Stream *stream); /**< Rewind function pointer, rewind stream internal iterator to the beginning. Mandatory for all streams. */
|
|
||||||
void (*setPosition)(const cbWLAN_Stream *stream, cbWLAN_StreamPosition position); /**< Set absolute position. */
|
|
||||||
cbWLAN_StreamPosition (*getPosition)(const cbWLAN_Stream *stream); /**< Get current position. */
|
|
||||||
cb_uint32 (*getSize)(const cbWLAN_Stream *stream); /**< GetSize function pointer, return total size of stream contents. */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start parameters passed to WLAN driver.
|
* Start parameters passed to WLAN driver.
|
||||||
*
|
*
|
||||||
|
@ -178,8 +160,8 @@ typedef struct cbWLAN_EnterpriseConnectParameters {
|
||||||
cb_uint8 username[cbWLAN_MAX_USERNAME_LENGTH]; /**< Username string. */
|
cb_uint8 username[cbWLAN_MAX_USERNAME_LENGTH]; /**< Username string. */
|
||||||
cb_uint8 passphrase[cbWLAN_MAX_PASSPHRASE_LENGTH]; /**< Passphrase string. */
|
cb_uint8 passphrase[cbWLAN_MAX_PASSPHRASE_LENGTH]; /**< Passphrase string. */
|
||||||
cb_uint8 domain[cbWLAN_MAX_DOMAIN_LENGTH]; /**< Domain string. */
|
cb_uint8 domain[cbWLAN_MAX_DOMAIN_LENGTH]; /**< Domain string. */
|
||||||
cbWLAN_Stream *clientCertificate; /**< Stream handle to provide SSL certificate for authentication. */
|
cbCERT_Stream *clientCertificate; /**< Stream handle to provide SSL certificate for authentication. */
|
||||||
cbWLAN_Stream *clientPrivateKey; /**< STream handle to provide SSL private key for authentication. */
|
cbCERT_Stream *clientPrivateKey; /**< STream handle to provide SSL private key for authentication. */
|
||||||
} cbWLAN_EnterpriseConnectParameters;
|
} cbWLAN_EnterpriseConnectParameters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -200,9 +182,10 @@ typedef struct cbWLAN_CommonApParameters {
|
||||||
* @ingroup wlan
|
* @ingroup wlan
|
||||||
*/
|
*/
|
||||||
typedef struct cbWLAN_WPAPSKApParameters {
|
typedef struct cbWLAN_WPAPSKApParameters {
|
||||||
cbWLAN_CipherSuite rsnCiphers; /**< Bit field indicating which ciphers that shall be displayed in RSN information elements. If 0 no RSN information elements is added to beacons and probe responses. */
|
cbWLAN_CipherSuite rsnCiphers; /**< Bit field indicating which ciphers that shall be displayed in RSN information elements. If 0 no RSN information elements is added to beacons and probe responses. */
|
||||||
cbWLAN_CipherSuite wpaCiphers; /**< Bit field indicating which ciphers that shall be displayed in WPA information elements. If 0 no WPA information elements is added to beacons and probe responses. */
|
cbWLAN_CipherSuite wpaCiphers; /**< Bit field indicating which ciphers that shall be displayed in WPA information elements. If 0 no WPA information elements is added to beacons and probe responses. */
|
||||||
cbWLAN_WPAPSK psk; /**< WPA pre-shared key*/
|
cbWLAN_WPAPSK psk; /**< WPA pre-shared key*/
|
||||||
|
cb_uint32 gtkRekeyInterval; /**< Group rekey interval in seconds */
|
||||||
} cbWLAN_WPAPSKApParameters;
|
} cbWLAN_WPAPSKApParameters;
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,8 +269,11 @@ typedef enum {
|
||||||
cbWLAN_IOCTL_GET_DTIM_ENABLE, //!< Get DTIM enable 0, disable 1 enable
|
cbWLAN_IOCTL_GET_DTIM_ENABLE, //!< Get DTIM enable 0, disable 1 enable
|
||||||
cbWLAN_IOCTL_SET_SLEEP_TIMEOUT, //!< Set enter power save entry delay (in ms). Power save mode will be entered only if there no activity during this delay
|
cbWLAN_IOCTL_SET_SLEEP_TIMEOUT, //!< Set enter power save entry delay (in ms). Power save mode will be entered only if there no activity during this delay
|
||||||
cbWLAN_IOCTL_GET_SLEEP_TIMEOUT, //!< Get enter power save entry delay (in ms). Power save mode will be entered only if there no activity during this delay
|
cbWLAN_IOCTL_GET_SLEEP_TIMEOUT, //!< Get enter power save entry delay (in ms). Power save mode will be entered only if there no activity during this delay
|
||||||
|
|
||||||
cbWLAN_IOCTL_LAST,
|
cbWLAN_IOCTL_LAST,
|
||||||
|
cbWLAN_IOCTL_SET_GSETTING = 1000, //!< Pipe to @ref cbWM_gSet.
|
||||||
|
cbWLAN_IOCTL_SET_TSETTING = 2000, //!< Pipe to @ref cbWM_tSet.
|
||||||
|
cbWLAN_IOCTL_GET_GSETTING = 3000, //!< Pipe to @ref cbWM_gGet.
|
||||||
|
cbWLAN_IOCTL_GET_TSETTING = 4000, //!< Pipe to @ref cbWM_tGet.
|
||||||
} cbWLAN_Ioctl;
|
} cbWLAN_Ioctl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue