#include <string.h>
#include <stdio.h>
#include "compiler.h"
#include "appEngine_t2bf_atmel.h"
#include "t2bf.h"
#include "time.h"
#include "unistr.h"
Macros | |
#define | T2BF_LITE_COD { 0x18, 0x01, 0x01 } |
#define | T2BFENG_MAX_NAME_LENGTH 20 |
#define | T2BFENG_MAX_SEARCH_RESULT 10 |
#define | T2BFENG_MAX_SEARCH_TIMEOUT 15 |
Typedefs | |
typedef uint16 | TMyNameString [T2BFENG_MAX_NAME_LENGTH] |
Enumerations | |
enum | TAppEngineStateEnum { AppEngine_Idle_State, AppEngine_Inquiry_State, AppEngine_Connecting_State, AppEngine_Connected_State, AppEngine_Disconnecting_State } |
Functions | |
void | AppEngineBtCb (TT2BFBtEvent event, TBdAddr bdAddr, TServiceId id) |
Callback function that handles events from t2BF. More... | |
void | AppEngineConnectButton (void) |
Handles functionality coupled to press of the Connect button. More... | |
boolean | AppEngineInit (TAppEnginePrintCb *pCb, TString deviceName) |
Initializes the Bluetooth functionality. More... | |
void | AppEngineInquiryButton (void) |
Handles functionality coupled to press of the Inquiry button. More... | |
boolean | AppEngineInternalSendData (uint16 dataLength, uint8 *pData) |
Sends data over SPP. More... | |
void | AppEngineJoystickButton (TAppEngineJoystick joystick) |
Sends a letter for each direction on the joystick. More... | |
void | AppEngineNotifyCallback (TString textToDisplay) |
Callback function used to access write functionality defined by the application. More... | |
void | AppEngineSelectDeviceButton (void) |
Handles functionality coupled to press of the Select button. More... | |
void | AppEngineSppCb (TT2BFSppEvent event, TPort port) |
Callback function that handles events related to the SPP connection. More... | |
void | AppEngineTimeoutCb (uint32 value) |
#define T2BF_LITE_COD { 0x18, 0x01, 0x01 } |
Referenced by AppEngineInit().
#define T2BFENG_MAX_NAME_LENGTH 20 |
Referenced by AppEngineInquiryButton(), and AppEngineSelectDeviceButton().
#define T2BFENG_MAX_SEARCH_RESULT 10 |
Referenced by AppEngineInquiryButton().
#define T2BFENG_MAX_SEARCH_TIMEOUT 15 |
Referenced by AppEngineInquiryButton().
typedef uint16 TMyNameString[T2BFENG_MAX_NAME_LENGTH] |
enum TAppEngineStateEnum |
void AppEngineBtCb | ( | TT2BFBtEvent | event, |
TBdAddr | bdAddr, | ||
TServiceId | id | ||
) |
Callback function that handles events from t2BF.
event | Specifies the occurred event. |
bdAddr | Identifies the remote unit, if applicable. |
TServiceId | Identifies to t2BF module the issued the event. |
None. |
References AppEngine_Idle_State, AppEngineNotifyCallback(), myBytes, myBytesBuffer, myState, T2BF_BT_EVENT_INQUIRY_COMPLETE, and T2BF_BT_EVENT_INQUIRY_RESULT.
Referenced by AppEngineInit().
void AppEngineConnectButton | ( | void | ) |
Handles functionality coupled to press of the Connect button.
None |
None |
References AppEngine_Connected_State, AppEngine_Connecting_State, AppEngine_Disconnecting_State, AppEngine_Idle_State, AppEngineNotifyCallback(), myBdAddr, mySppPort, myState, NULL, T2BF_STATUS_OK, T2BFSppConnect(), and T2BFSppDisconnect().
Referenced by app_engine().
boolean AppEngineInit | ( | TAppEnginePrintCb * | pCb, |
TString | deviceName | ||
) |
Initializes the Bluetooth functionality.
pCb | Pointer to callback function that shall receive events from t2BF |
deviceName | Sets the user friendly name that are used when this unit is discovered by others. |
true | Initialization successful. |
false | Baud rate set point is out of range for the given input clock frequency. |
References AppEngine_Idle_State, AppEngineBtCb(), AppEngineNotifyCallback(), AppEngineSppCb(), myBdAddr, myName, mySppPort, myState, myStatus, NULL, pMyCb, T2BF_AUTO_AUTH_ALLOW, T2BF_LITE_COD, T2BF_SEC_LEVEL_2, T2BF_SEC_NORMAL, T2BF_STATUS_OK, T2BFAutoAuthentication(), T2BFDiscoverable(), T2BFInit(), T2BFSppCreatePort(), T2BFSppOpen(), T2BFStart(), T2BFWriteName(), T2BFWritePin(), UNISTR_CHARSET_ASCII, UNISTR_ENCODING_NONE, and UNISTRToUtf16().
Referenced by app_engine().
void AppEngineInquiryButton | ( | void | ) |
Handles functionality coupled to press of the Inquiry button.
None |
None |
References AppEngine_Idle_State, AppEngine_Inquiry_State, AppEngineNotifyCallback(), DEVICE_CLASS_ALL, myBytes, myIndex, myState, pMyBdAddress, pMyName, SERVICE_CLASS_ALL, T2BF_STATUS_OK, T2BFENG_MAX_NAME_LENGTH, T2BFENG_MAX_SEARCH_RESULT, T2BFENG_MAX_SEARCH_TIMEOUT, T2BFInquiryStart(), and T2BFInquiryStop().
Referenced by app_engine().
Sends data over SPP.
dataLength | Defines the length of the data that shall be sent using SPP. |
pData | Points to data area containing data to be sent. |
true | Transmission succeeded. |
false | Transmission failed. |
References AppEngine_Connected_State, AppEngineNotifyCallback(), mySppPort, myState, and T2BFSppTx().
Referenced by AppEngineJoystickButton().
void AppEngineJoystickButton | ( | TAppEngineJoystick | joystick | ) |
Sends a letter for each direction on the joystick.
joystick | Identifies what direction the joystick has been pulled in. |
None. |
References AppEngine_Down, AppEngine_Left, AppEngine_Push, AppEngine_Right, AppEngine_Up, and AppEngineInternalSendData().
Referenced by app_engine().
void AppEngineNotifyCallback | ( | TString | textToDisplay | ) |
Callback function used to access write functionality defined by the application.
textToDisplay | String to print. |
None. |
References pMyCb.
Referenced by AppEngineBtCb(), AppEngineConnectButton(), AppEngineInit(), AppEngineInquiryButton(), AppEngineInternalSendData(), AppEngineSelectDeviceButton(), and AppEngineSppCb().
void AppEngineSelectDeviceButton | ( | void | ) |
Handles functionality coupled to press of the Select button.
None |
None |
References AppEngine_Idle_State, AppEngineNotifyCallback(), myBdAddr, myIndex, myState, pMyBdAddress, pMyName, and T2BFENG_MAX_NAME_LENGTH.
Referenced by app_engine().
void AppEngineSppCb | ( | TT2BFSppEvent | event, |
TPort | port | ||
) |
Callback function that handles events related to the SPP connection.
event | Specifies the occurred event. |
port | Identifies the port on which the event occurred. |
None. |
References AppEngine_Connected_State, AppEngine_Idle_State, AppEngineNotifyCallback(), myBytes, myBytesBuffer, mySppPort, myState, T2BF_SPP_EVENT_CONNECTED, T2BF_SPP_EVENT_CONNECTION_LOST, T2BF_SPP_EVENT_DATA, T2BF_SPP_EVENT_DISCONNECTED, T2BFDiscoverable(), T2BFSppRx(), and T2BFSppRxCount().
Referenced by AppEngineInit().
void AppEngineTimeoutCb | ( | uint32 | value | ) |
TBdAddr myBdAddr |
Referenced by AppEngineConnectButton(), AppEngineInit(), and AppEngineSelectDeviceButton().
uint16 myBytes |
Referenced by AppEngineBtCb(), AppEngineInquiryButton(), and AppEngineSppCb().
uint8 myBytesBuffer[22] |
Referenced by AppEngineBtCb(), and AppEngineSppCb().
uint8 myIndex = 0 |
Referenced by AppEngineInquiryButton(), and AppEngineSelectDeviceButton().
TUTF16String myName = NULL |
Referenced by AppEngineInit().
TPort mySppPort |
Referenced by AppEngineConnectButton(), AppEngineInit(), AppEngineInternalSendData(), and AppEngineSppCb().
TAppEngineStateEnum myState = AppEngine_Idle_State |
TT2BFStatus myStatus |
Referenced by AppEngineInit().
|
static |
Referenced by AppEngineInquiryButton(), and AppEngineSelectDeviceButton().
TAppEnginePrintCb* pMyCb |
Referenced by AppEngineInit(), and AppEngineNotifyCallback().
|
static |
|
static |
Referenced by AppEngineInquiryButton(), and AppEngineSelectDeviceButton().