Cordio Stack and Cordio Profiles  r2p3-02rel0
Application Framework User Interface API

Data Structures

struct  appUiSound_t
 Sound data structure. More...
 
struct  appUiLed_t
 LED data structure. More...
 
struct  appUiCback_t
 Callback structure. More...
 

Macros

#define APP_UI_LED_NONE   0x00
 LED values. More...
 
#define APP_UI_LED_1   0x01
 LED 1.
 
#define APP_UI_LED_2   0x02
 LED 2.
 
#define APP_UI_LED_3   0x04
 LED 3.
 
#define APP_UI_LED_4   0x08
 LED 4.
 
#define APP_UI_LED_WRAP   0xFF
 Wrap to beginning of sequence.
 
#define APP_UI_SOUND_WRAP   0xFFFF
 Sound tone value for wrap/repeat.
 

Typedefs

typedef void(* appUiBtnCback_t) (uint8_t btn)
 Button press callback.
 
typedef void(* appUiActionCback_t) (uint8_t event)
 Action event callback.
 
typedef void(* appUiBtnPollCback_t) (void)
 Button Poll callback.
 

Enumerations

enum  {
  APP_UI_NONE,
  APP_UI_RESET_CMPL,
  APP_UI_DISCOVERABLE,
  APP_UI_ADV_START,
  APP_UI_ADV_STOP,
  APP_UI_SCAN_START,
  APP_UI_SCAN_STOP,
  APP_UI_SCAN_REPORT,
  APP_UI_CONN_OPEN,
  APP_UI_CONN_CLOSE,
  APP_UI_SEC_PAIR_CMPL,
  APP_UI_SEC_PAIR_FAIL,
  APP_UI_SEC_ENCRYPT,
  APP_UI_SEC_ENCRYPT_FAIL,
  APP_UI_PASSKEY_PROMPT,
  APP_UI_ALERT_CANCEL,
  APP_UI_ALERT_LOW,
  APP_UI_ALERT_HIGH,
  APP_UI_ADV_SET_START_IND,
  APP_UI_ADV_SET_STOP_IND,
  APP_UI_SCAN_REQ_RCVD_IND,
  APP_UI_EXT_SCAN_START_IND,
  APP_UI_EXT_SCAN_STOP_IND,
  APP_UI_PER_ADV_SET_START_IND,
  APP_UI_PER_ADV_SET_STOP_IND,
  APP_UI_PER_ADV_SYNC_EST_IND,
  APP_UI_PER_ADV_SYNC_LOST_IND,
  APP_UI_HW_ERROR
}
 UI event enumeration. More...
 
enum  {
  APP_UI_BTN_NONE,
  APP_UI_BTN_1_DOWN,
  APP_UI_BTN_1_SHORT,
  APP_UI_BTN_1_MED,
  APP_UI_BTN_1_LONG,
  APP_UI_BTN_1_EX_LONG,
  APP_UI_BTN_2_DOWN,
  APP_UI_BTN_2_SHORT,
  APP_UI_BTN_2_MED,
  APP_UI_BTN_2_LONG,
  APP_UI_BTN_2_EX_LONG
}
 Button press enumeration. More...
 

APP Terminal Functions

Open a terminal interface to the application.

void AppTerminalInit (void)
 Initialize terminal. More...
 

APP User Interface

Commands that may be sent via terminal to the application.

void AppUiAction (uint8_t event)
 Perform a user interface action based on the event value passed to the function. More...
 
void AppUiDisplayPasskey (uint32_t passkey)
 Display a passkey. More...
 
void AppUiDisplayConfirmValue (uint32_t confirm)
 Display a confirmation value. More...
 
void AppUiDisplayRssi (int8_t rssi)
 Display an RSSI value. More...
 
void AppUiBtnRegister (appUiBtnCback_t btnCback)
 Register a callback function to receive button presses. More...
 
void AppUiActionRegister (appUiActionCback_t actionCback)
 Register a callback function to receive action events. More...
 
void AppUiBtnPollRegister (appUiBtnPollCback_t btnPollCback)
 Register a callback function to receive APP_BTN_POLL_IND events. More...
 
void AppUiBtnPressed (void)
 Handle a hardware button press. This function is called to handle WSF event APP_BTN_DOWN_EVT. More...
 
void AppUiSoundPlay (const appUiSound_t *pSound)
 Play a sound. More...
 
void AppUiSoundStop (void)
 Stop the sound that is currently playing. More...
 
void AppUiLedStart (const appUiLed_t *pLed)
 Start LED blinking. More...
 
void AppUiLedStop (void)
 Stop LED blinking. More...
 
void AppUiBtnTest (uint8_t btn)
 Button test function– for test purposes only. More...
 

Description

Macro Definition Documentation

#define APP_UI_LED_NONE   0x00

LED values.

No LED

Definition at line 83 of file app_ui.h.

Enumeration Type Documentation

anonymous enum

UI event enumeration.

Enumerator
APP_UI_NONE 

No event.

APP_UI_RESET_CMPL 

Reset complete.

APP_UI_DISCOVERABLE 

Enter discoverable mode.

APP_UI_ADV_START 

Advertising started.

APP_UI_ADV_STOP 

Advertising stopped.

APP_UI_SCAN_START 

Scanning started.

APP_UI_SCAN_STOP 

Scanning stopped.

APP_UI_SCAN_REPORT 

Scan data received from peer device.

APP_UI_CONN_OPEN 

Connection opened.

APP_UI_CONN_CLOSE 

Connection closed.

APP_UI_SEC_PAIR_CMPL 

Pairing completed successfully.

APP_UI_SEC_PAIR_FAIL 

Pairing failed or other security failure.

APP_UI_SEC_ENCRYPT 

Connection encrypted.

APP_UI_SEC_ENCRYPT_FAIL 

Encryption failed.

APP_UI_PASSKEY_PROMPT 

Prompt user to enter passkey.

APP_UI_ALERT_CANCEL 

Cancel a low or high alert.

APP_UI_ALERT_LOW 

Low alert.

APP_UI_ALERT_HIGH 

High alert.

APP_UI_ADV_SET_START_IND 

Advertising set(s) started.

APP_UI_ADV_SET_STOP_IND 

Advertising set(s) stopped.

APP_UI_SCAN_REQ_RCVD_IND 

Scan request received.

APP_UI_EXT_SCAN_START_IND 

Extended scanning started.

APP_UI_EXT_SCAN_STOP_IND 

Extended scanning stopped.

APP_UI_PER_ADV_SET_START_IND 

Periodic advertising set started.

APP_UI_PER_ADV_SET_STOP_IND 

Periodic advertising set stopped.

APP_UI_PER_ADV_SYNC_EST_IND 

Periodic advertising sync established.

APP_UI_PER_ADV_SYNC_LOST_IND 

Periodic advertising sync lost.

APP_UI_HW_ERROR 

Hardware error.

Definition at line 34 of file app_ui.h.

35 {
36  APP_UI_NONE, /*!< \brief No event */
37  APP_UI_RESET_CMPL, /*!< \brief Reset complete */
38  APP_UI_DISCOVERABLE, /*!< \brief Enter discoverable mode */
39  APP_UI_ADV_START, /*!< \brief Advertising started */
40  APP_UI_ADV_STOP, /*!< \brief Advertising stopped */
41  APP_UI_SCAN_START, /*!< \brief Scanning started */
42  APP_UI_SCAN_STOP, /*!< \brief Scanning stopped */
43  APP_UI_SCAN_REPORT, /*!< \brief Scan data received from peer device */
44  APP_UI_CONN_OPEN, /*!< \brief Connection opened */
45  APP_UI_CONN_CLOSE, /*!< \brief Connection closed */
46  APP_UI_SEC_PAIR_CMPL, /*!< \brief Pairing completed successfully */
47  APP_UI_SEC_PAIR_FAIL, /*!< \brief Pairing failed or other security failure */
48  APP_UI_SEC_ENCRYPT, /*!< \brief Connection encrypted */
49  APP_UI_SEC_ENCRYPT_FAIL, /*!< \brief Encryption failed */
50  APP_UI_PASSKEY_PROMPT, /*!< \brief Prompt user to enter passkey */
51  APP_UI_ALERT_CANCEL, /*!< \brief Cancel a low or high alert */
52  APP_UI_ALERT_LOW, /*!< \brief Low alert */
53  APP_UI_ALERT_HIGH, /*!< \brief High alert */
54  APP_UI_ADV_SET_START_IND, /*!< \brief Advertising set(s) started */
55  APP_UI_ADV_SET_STOP_IND, /*!< \brief Advertising set(s) stopped */
56  APP_UI_SCAN_REQ_RCVD_IND, /*!< \brief Scan request received */
57  APP_UI_EXT_SCAN_START_IND, /*!< \brief Extended scanning started */
58  APP_UI_EXT_SCAN_STOP_IND, /*!< \brief Extended scanning stopped */
59  APP_UI_PER_ADV_SET_START_IND, /*!< \brief Periodic advertising set started */
60  APP_UI_PER_ADV_SET_STOP_IND, /*!< \brief Periodic advertising set stopped */
61  APP_UI_PER_ADV_SYNC_EST_IND, /*!< \brief Periodic advertising sync established */
62  APP_UI_PER_ADV_SYNC_LOST_IND, /*!< \brief Periodic advertising sync lost */
63  APP_UI_HW_ERROR /*!< \brief Hardware error */
64 };
Periodic advertising set stopped.
Definition: app_ui.h:60
Advertising set(s) stopped.
Definition: app_ui.h:55
Low alert.
Definition: app_ui.h:52
Periodic advertising set started.
Definition: app_ui.h:59
Hardware error.
Definition: app_ui.h:63
Advertising stopped.
Definition: app_ui.h:40
Pairing completed successfully.
Definition: app_ui.h:46
High alert.
Definition: app_ui.h:53
Periodic advertising sync established.
Definition: app_ui.h:61
Periodic advertising sync lost.
Definition: app_ui.h:62
Extended scanning stopped.
Definition: app_ui.h:58
Advertising set(s) started.
Definition: app_ui.h:54
Prompt user to enter passkey.
Definition: app_ui.h:50
Connection encrypted.
Definition: app_ui.h:48
Scanning started.
Definition: app_ui.h:41
No event.
Definition: app_ui.h:36
Scan data received from peer device.
Definition: app_ui.h:43
Extended scanning started.
Definition: app_ui.h:57
Encryption failed.
Definition: app_ui.h:49
Connection opened.
Definition: app_ui.h:44
Scan request received.
Definition: app_ui.h:56
Advertising started.
Definition: app_ui.h:39
Enter discoverable mode.
Definition: app_ui.h:38
Reset complete.
Definition: app_ui.h:37
Scanning stopped.
Definition: app_ui.h:42
Cancel a low or high alert.
Definition: app_ui.h:51
Pairing failed or other security failure.
Definition: app_ui.h:47
Connection closed.
Definition: app_ui.h:45
anonymous enum

Button press enumeration.

Enumerator
APP_UI_BTN_NONE 

No button press.

APP_UI_BTN_1_DOWN 

Button 1 on down press.

APP_UI_BTN_1_SHORT 

Button 1 short press.

APP_UI_BTN_1_MED 

Button 1 medium press.

APP_UI_BTN_1_LONG 

Button 1 long press.

APP_UI_BTN_1_EX_LONG 

Button 1 extra long press.

APP_UI_BTN_2_DOWN 

Button 2 on down press.

APP_UI_BTN_2_SHORT 

Button 2 short press.

APP_UI_BTN_2_MED 

Button 2 medium press.

APP_UI_BTN_2_LONG 

Button 2 long press.

APP_UI_BTN_2_EX_LONG 

Button 2 extra long press.

Definition at line 67 of file app_ui.h.

68 {
69  APP_UI_BTN_NONE, /*!< \brief No button press */
70  APP_UI_BTN_1_DOWN, /*!< \brief Button 1 on down press */
71  APP_UI_BTN_1_SHORT, /*!< \brief Button 1 short press */
72  APP_UI_BTN_1_MED, /*!< \brief Button 1 medium press */
73  APP_UI_BTN_1_LONG, /*!< \brief Button 1 long press */
74  APP_UI_BTN_1_EX_LONG, /*!< \brief Button 1 extra long press */
75  APP_UI_BTN_2_DOWN, /*!< \brief Button 2 on down press */
76  APP_UI_BTN_2_SHORT, /*!< \brief Button 2 short press */
77  APP_UI_BTN_2_MED, /*!< \brief Button 2 medium press */
78  APP_UI_BTN_2_LONG, /*!< \brief Button 2 long press */
79  APP_UI_BTN_2_EX_LONG /*!< \brief Button 2 extra long press */
80 };
No button press.
Definition: app_ui.h:69
Button 1 extra long press.
Definition: app_ui.h:74
Button 1 on down press.
Definition: app_ui.h:70
Button 2 medium press.
Definition: app_ui.h:77
Button 2 short press.
Definition: app_ui.h:76
Button 1 short press.
Definition: app_ui.h:71
Button 1 long press.
Definition: app_ui.h:73
Button 1 medium press.
Definition: app_ui.h:72
Button 2 extra long press.
Definition: app_ui.h:79
Button 2 on down press.
Definition: app_ui.h:75
Button 2 long press.
Definition: app_ui.h:78

Function Documentation

void AppTerminalInit ( void  )

Initialize terminal.

Returns
None.
void AppUiAction ( uint8_t  event)

Perform a user interface action based on the event value passed to the function.

Parameters
eventUser interface event value.
Returns
None.
void AppUiDisplayPasskey ( uint32_t  passkey)

Display a passkey.

Parameters
passkeyPasskey to display.
Returns
None.
void AppUiDisplayConfirmValue ( uint32_t  confirm)

Display a confirmation value.

Parameters
confirmConfirm value to display.
Returns
None.
void AppUiDisplayRssi ( int8_t  rssi)

Display an RSSI value.

Parameters
rssiRssi value to display.
Returns
None.
void AppUiBtnRegister ( appUiBtnCback_t  btnCback)

Register a callback function to receive button presses.

Parameters
btnCbackCallback function.
Returns
None.
Note
Registered by application to receive button events
void AppUiActionRegister ( appUiActionCback_t  actionCback)

Register a callback function to receive action events.

Parameters
actionCbackCallback function.
Returns
None.
Note
Registered by platform
void AppUiBtnPollRegister ( appUiBtnPollCback_t  btnPollCback)

Register a callback function to receive APP_BTN_POLL_IND events.

Parameters
btnPollCbackCallback function.
Returns
None.
Note
Registered by platform
void AppUiBtnPressed ( void  )

Handle a hardware button press. This function is called to handle WSF event APP_BTN_DOWN_EVT.

Returns
None.
void AppUiSoundPlay ( const appUiSound_t pSound)

Play a sound.

Parameters
pSoundPointer to sound tone/duration array.
Returns
None.
void AppUiSoundStop ( void  )

Stop the sound that is currently playing.

Returns
None.
void AppUiLedStart ( const appUiLed_t pLed)

Start LED blinking.

Parameters
pLedPointer to LED data structure.
Returns
None.
void AppUiLedStop ( void  )

Stop LED blinking.

Returns
None.
void AppUiBtnTest ( uint8_t  btn)

Button test function– for test purposes only.

Parameters
btnbutton press
Returns
None.