#include "white_interface.h"
Functions | |
unsigned int | strlen (const char *s) |
Returns the length of a string in byte. More... | |
char * | strcpy (char *to, const char *from) |
Copy a string onto another thus replacing it. More... | |
void | connect (void) |
Where all the fun begins... More... | |
int | vccPrintPdxDebugInfo (const char *format,...) |
To display messages in VCC. | |
void | poin_entry_Init () |
void | poin_entry_Run () |
Variables | |
L2CA_Packet | L2CA_packet_out |
The packet prepared to be sent to L2CAP. More... | |
L2CA_Packet * | L2CA_packet_in |
The address of the packet arrived at the L2CA_Packet_In port from L2CAP. More... | |
L2CA_Packet | L2CA_packet |
Where the value of *L2CA_packet_in is copied. More... | |
int | FLAG = 1 |
A flag to make sure connect() (Connect Request) is called once only. More... | |
char | in_String [20] |
This is where a string from the game device is stored before it's sent to L2CAP. More... | |
char | out_String [20] |
This is where a string from L2CAP is stored. More... | |
int | connected |
The primary indication of a connection event. More... | |
int | configured |
This is set to 1 when Master and Slave are configured. More... | |
int | connection_established |
This is set to 1 when Master and Slave are connected. More... | |
TBluetoothDeviceAddress | BD_ADDR |
Unique Bluetooth address of target device (48-bit). | |
ID_t | Identifier = 0x00 |
This value must match the value received in the L2CA_ConnectInd event. | |
CID_t | CID = 0x00 |
Channel Identifier representing local end-point of the communication channel. | |
Response_t | L2CA_response = 0x0 |
0x0 indicates a successful operation. | |
Status_t | status = 0x0 |
0x0 means "No further information". | |
OutMTU_t | OutMTU = 0x0 |
Maximum transmission unit the local channel (LCID) will send. | |
vccUnsigned32 | TokenRate = 0x0 |
One of QoS paramters dealing with the traffic characteristics of the outgoing data flow that are specified in Configuration packets' "OutFlow" parameter. | |
vccUnsighed32 | TokenBucketSize = 0x0 |
Another QoS parameter within the same flowspec as TokenRate. | |
vccUnsighed32 | PeakBandwidth = 0x0 |
Another QoS parameter within the same flowspec as TokenRate. | |
vccUnsigned32 | Latency = 0x0 |
Another QoS parameter within the same flowspec as TokenRate. | |
vccUnsighed32 | DelayVariation = 0x0 |
Another QoS parameter within the same flowspec as TokenRAte. | |
Result_t | Result = 0x0 |
0x0 indicates a successfull operation. | |
N_t | N = 0x0 |
Number of bytes transferred to InBuffer in a Read Confirm packet. |
|
Where all the fun begins... When connect() is called, it will prepare a Connection Request packet by setting up several parameters before the packet is sent to the lower layers.
|
|
This function is VCC specific and it's body is executed once by VCC before the program is started. It is often used to initialise variables. Here, the "connected", "configured" and "connection_established" variables are initialised to false (=0). |
|
VCC keeps itself very busy by looping the input ports of a function unit. Whenever an input port received something, the body of poin_entry_Run() will be executed. This function can be separated into four parts :
|
|
Copy a string onto another thus replacing it. This c library function is called to copy a string from one location to another.
|
|
Returns the length of a string in byte. This c library function is called to find out the length of a string in bytes.
|
|
This is set to 1 when Master and Slave are configured. configured is first set to false (=0) in poin_entry_Init(). When either Master or Slave had received a Configuration Indication it will return a Configuration Response packet. Then it will immediately set up a Read Request packet and sends it to L2CAP to be ready for any incoming data. After that configurated is set to true (=1). Usually Slave will be configured just before Master. |
|
The primary indication of a connection event. connected is first set to false (=0) in poin_entry_Init(). After Slave had received the Connection Indication packet and sent back a Connection Response packet back to the Master, connected is set to true (=1). However, although it is set to true Master and Slave are NOT truely connected, yet. They are connected when "connection_established" is true. This variable is not very important. |
|
This is set to 1 when Master and Slave are connected. connection_established is also first set to false (=0) in poin_entry_Init(). This variable is set to true (=0) right after where the configured variable is set to true. Not only it informs the players that the connection has truely been made, it is also used as a flag to prevent any incoming string from the upper layer before a full connection from entering GBI through the Input port.
|
|
A flag to make sure connect() (Connect Request) is called once only. connect() is called only by the Master and when the FLAG is true (=1). Then FLAG will be set to false (=0) to make sure that connect() would never be called again. |
|
This is where a string from the game device is stored before it's sent to L2CAP. A 20 bytes array of character type that is used for storing aa string from the upper layer (Game). In this practical the length of a message is limited to less than 20 bytes. |
|
Where the value of *L2CA_packet_in is copied. Don't really think it is being used at all! |
|
The address of the packet arrived at the L2CA_Packet_In port from L2CAP.
*L2CA_packet_in points to the location of the packet arrived from L2CAP. It is used it the switch statements to check what kind of service incoming packet is asking. |
|
The packet prepared to be sent to L2CAP. L2CA_packet_out is the packet of data sent from GBI down to L2CAP. It contains the vital information about the type of service primitive event it is carrying (eg. Connection Request) and the parameter values for such an event. This packet is sent out via the L2CA_Packet_Out port. |
|
This is where a string from L2CAP is stored. GBI copies byte by byte the data from the InBuffer of a Read Confirm packet into this 20 bytes array of character type buffer. Then the content in out_String would be posted to the upper layer (Game). |