Skip to content

Commit 6d5f72f

Browse files
author
Owen L - SFE
committed
Compile full ble example
But it still isn't working
1 parent 48caa15 commit 6d5f72f

File tree

149 files changed

+35872
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+35872
-4
lines changed

cores/arduino/am_sdk_ap3/third_party/exactle/sw/apps/app/app_disc.c

Lines changed: 763 additions & 0 deletions
Large diffs are not rendered by default.

cores/arduino/am_sdk_ap3/third_party/exactle/sw/apps/app/app_main.c

Lines changed: 446 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
/*************************************************************************************************/
2+
/*!
3+
* \file app_main.h
4+
*
5+
* \brief Application framework main module.
6+
*
7+
* $Date: 2017-05-24 18:03:34 -0500 (Wed, 24 May 2017) $
8+
* $Revision: 12288 $
9+
*
10+
* Copyright (c) 2011-2017 ARM Ltd., all rights reserved.
11+
* ARM Ltd. confidential and proprietary.
12+
*
13+
* IMPORTANT. Your use of this file is governed by a Software License Agreement
14+
* ("Agreement") that must be accepted in order to download or otherwise receive a
15+
* copy of this file. You may not use or copy this file for any purpose other than
16+
* as described in the Agreement. If you do not agree to all of the terms of the
17+
* Agreement do not use this file and delete all copies in your possession or control;
18+
* if you do not have a copy of the Agreement, you must contact ARM Ltd. prior
19+
* to any use, copying or further distribution of this software.
20+
*/
21+
/*************************************************************************************************/
22+
#ifndef APP_MAIN_H
23+
#define APP_MAIN_H
24+
25+
#include "wsf_os.h"
26+
#include "wsf_timer.h"
27+
#include "dm_api.h"
28+
#include "app_api.h"
29+
#include "app_db.h"
30+
#include "app_cfg.h"
31+
32+
#ifdef __cplusplus
33+
extern "C" {
34+
#endif
35+
36+
37+
/**************************************************************************************************
38+
Macros
39+
**************************************************************************************************/
40+
41+
/*! No security record handle */
42+
#define APP_DB_HDL_NONE NULL
43+
44+
/*! Scanning mode types */
45+
#define APP_SCAN_MODE_LEG 0 /*! Legacy scanning mode */
46+
#define APP_SCAN_MODE_EXT 1 /*! Extended scanning mode */
47+
#define APP_SCAN_MODE_NONE 255 /*! Unknown scanning mode */
48+
49+
/*! App WSF handler event bitmasks */
50+
#define APP_BTN_DOWN_EVT 0x10 /*! Button pressed down event */
51+
52+
/*! App WSF message event starting values */
53+
#define APP_MSG_START 0x00
54+
#define APP_SLAVE_MSG_START 0x10
55+
#define APP_MASTER_MSG_START 0x20
56+
57+
/*! App WSF message event enumeration */
58+
enum
59+
{
60+
APP_BTN_POLL_IND = APP_MSG_START, /*! Button poll timer expired */
61+
APP_UI_TIMER_IND /*! UI timer expired */
62+
};
63+
64+
/*! App slave WSF message event enumeration */
65+
enum
66+
{
67+
APP_CONN_UPDATE_TIMEOUT_IND = APP_SLAVE_MSG_START /*! Connection parameter update timer expired */
68+
};
69+
70+
/**************************************************************************************************
71+
Data Types
72+
**************************************************************************************************/
73+
74+
/* Message handling function type */
75+
typedef void (*appMsgHandler_t)(wsfMsgHdr_t *pMsg);
76+
77+
/* Advertising callback function type */
78+
typedef void(*appAdvCback_t)(dmEvt_t *pMsg);
79+
80+
typedef struct
81+
{
82+
appDevInfo_t scanResults[APP_SCAN_RESULT_MAX]; /*! Scan result storage */
83+
uint8_t numScanResults; /*! Number of scan results */
84+
uint8_t idx; /*! Index of address being resolved in scan result list */
85+
appDbHdl_t dbHdl; /*! Database record handle for address being resolved */
86+
bool_t inProgress; /*! TRUE if address resolution is in progress */
87+
uint8_t scanMode; /*! Scan and connect mode in use */
88+
} appMasterCb_t;
89+
90+
/*! Slave control block */
91+
typedef struct
92+
{
93+
uint8_t *pAdvData[DM_NUM_ADV_SETS][APP_NUM_DATA_LOCATIONS]; /*! Advertising data pointers */
94+
uint16_t advDataLen[DM_NUM_ADV_SETS][APP_NUM_DATA_LOCATIONS]; /*! Advertising data lengths */
95+
uint16_t advDataBufLen[DM_NUM_ADV_SETS][APP_NUM_DATA_LOCATIONS]; /*! Length of advertising data buffer maintained by Application */
96+
uint16_t advDataOffset[DM_NUM_ADV_SETS][APP_NUM_DATA_LOCATIONS]; /*! Advertising data offsets */
97+
uint16_t maxAdvDataLen[DM_NUM_ADV_SETS]; /*! Maximum advertising data length supported by Controller */
98+
bool_t bondable; /*! TRUE if in bondable mode */
99+
bool_t advDataSynced[DM_NUM_ADV_SETS]; /*! TRUE if advertising/scan data is synced */
100+
uint8_t advState[DM_NUM_ADV_SETS]; /*! Advertising state */
101+
uint8_t advType[DM_NUM_ADV_SETS]; /*! Advertising type */
102+
bool_t advTypeChanged[DM_NUM_ADV_SETS]; /*! TRUE if advertising type is changed */
103+
uint8_t discMode; /*! Discoverable/connectable mode */
104+
bdAddr_t peerAddr; /*! Peer address */
105+
uint8_t peerAddrType; /*! Peer address type */
106+
bool_t findLtk; /*! TRUE if LTK request received while resolving address */
107+
appDbHdl_t dbHdl; /*! Database record handle for address being resolved */
108+
bool_t inProgress; /*! TRUE if address resolution is in progress */
109+
appAdvCback_t advStopCback; /*! Advertising stopped callback */
110+
appAdvCback_t advRestartCback; /*! Advertising restart callback */
111+
} appSlaveCb_t;
112+
113+
/*! Connection control block */
114+
typedef struct
115+
{
116+
appDbHdl_t dbHdl; /*! Device database handle */
117+
dmConnId_t connId; /*! Connection ID */
118+
bool_t bonded; /*! TRUE if bonded with peer device */
119+
bool_t bondByLtk; /*! TRUE if bonded state being determined by LTK */
120+
bool_t bondByPairing; /*! TRUE if bonded state being determined by pairing */
121+
bool_t initiatingSec; /*! TRUE if initiating security */
122+
bool_t setConnectable; /*! TRUE if switching to connectable mode */
123+
bool_t connWasIdle; /*! TRUE if connection was idle at last check */
124+
uint8_t rcvdKeys; /*! Bitmask of keys received during pairing */
125+
uint8_t attempts; /*! Connection parameter update attempts */
126+
uint8_t updateState; /*! Connection Update State */
127+
wsfTimer_t updateTimer; /*! Connection parameter update timer */
128+
} appConnCb_t;
129+
130+
/*! Main control block */
131+
typedef struct
132+
{
133+
appMsgHandler_t slaveCback; /*! Slave message handler callback */
134+
appMsgHandler_t masterCback; /*! Slave message handler callback */
135+
} appCb_t;
136+
137+
/**************************************************************************************************
138+
Global Variables
139+
**************************************************************************************************/
140+
141+
/*! Connection control block array */
142+
extern appConnCb_t appConnCb[DM_CONN_MAX];
143+
144+
/*! WSF handler ID */
145+
extern wsfHandlerId_t appHandlerId;
146+
147+
/*! Main control block */
148+
extern appCb_t appCb;
149+
150+
/*! Master control block */
151+
extern appMasterCb_t appMasterCb;
152+
153+
/*! Slave control block */
154+
extern appSlaveCb_t appSlaveCb;
155+
156+
/**************************************************************************************************
157+
Function Declarations
158+
**************************************************************************************************/
159+
160+
bool_t appCheckBonded(dmConnId_t connId);
161+
bool_t appCheckBondByLtk(dmConnId_t connId);
162+
uint8_t appNumConns(uint8_t role);
163+
164+
void appUiBtnPoll(void);
165+
void appUiTimerExpired(wsfMsgHdr_t *pMsg);
166+
167+
/* slave utility functions */
168+
extern void appSlaveResetAdvDataOffset(uint8_t advHandle);
169+
extern void appAdvStart(uint8_t numSets, uint8_t *pAdvHandles, uint16_t *pInterval, uint16_t *pDuration,
170+
uint8_t *pMaxEaEvents, bool_t cfgAdvParam);
171+
extern void appAdvSetData(uint8_t advHandle, uint8_t location, uint16_t len, uint8_t *pData, uint16_t bufLen,
172+
uint16_t maxLen);
173+
extern void appSlaveAdvStart(uint8_t numSets, uint8_t *pAdvHandles, uint16_t *pInterval, uint16_t *pDuration,
174+
uint8_t *pMaxEaEvents, bool_t cfgAdvParam, uint8_t mode);
175+
extern void appAdvStop(uint8_t numSets, uint8_t *pAdvHandles);
176+
extern bool_t appAdvSetAdValue(uint8_t advHandle, uint8_t location, uint8_t adType, uint8_t len,
177+
uint8_t *pValue);
178+
extern void appSetAdvType(uint8_t advHandle, uint8_t advType, uint16_t interval, uint16_t duration,
179+
uint8_t maxEaEvents, bool_t cfgAdvParam);
180+
extern void appConnAccept(uint8_t advHandle, uint8_t advType, uint16_t interval, uint16_t duration,
181+
uint8_t maxEaEvents, uint8_t addrType, uint8_t *pAddr);
182+
183+
/* master utility functions */
184+
extern dmConnId_t appConnOpen(uint8_t initPhys, uint8_t addrType, uint8_t *pAddr, appDbHdl_t dbHdl);
185+
186+
#ifdef __cplusplus
187+
};
188+
#endif
189+
190+
#endif /* APP_MAIN_H */

0 commit comments

Comments
 (0)