13 #ifndef __GAMEBTCOMMS_H
14 #define __GAMEBTCOMMS_H
27 #include "MessageClient.h"
33 struct TBTCommsMsgBase;
87 EGameOver, EPlay, EPause
91 ENotConnected, EConnecting, EConnected
95 EInit, ERegisterUID, ERegisterDeviceName, ERegisterNetConfig, ERegisterRole, EHandleMessages
99 EToHost = 1, EToClient1 = 2, EToClient2 = 3, EToClient3 = 4, EToAll = 5, EInvalid = 0xff
109 TUint8 Length[KMaxQueueSize];
110 TUint8 Queue[KMaxQueueSize][KMaxMessageSize];
153 IMPORT_C
void StartHostL(TUint16 aStartPlayers, TUint16 aMinPlayers);
479 IMPORT_C TInt
ReconnectL(TBool aMustReconnectToAll = ETrue);
571 IMPORT_C TInt Connect();
572 IMPORT_C TInt DeclareRemoteDevice(
const TDeviceDetails &aDevice);
573 IMPORT_C TInt SetBluetoothPowerState(TBool aState);
574 IMPORT_C
void SetLocalDeviceName(THostName aHostName);
575 IMPORT_C
void BluetoothPowerState(TBool aState);
576 IMPORT_C
void Disconnect(TUint16 aClientId = 0, TBool aPermanently = EFalse);
577 IMPORT_C
void EndSession();
578 IMPORT_C
void SendData(TUint16 aClientId, TPtr8 aData);
579 IMPORT_C
void SetDiscoverabilityModeLimited(TBool aMode);
580 IMPORT_C
void SetHostAcceptMode(THostAcceptMode aMode);
581 IMPORT_C
void SetSearchModeLimited(TBool aMode);
585 void Update(TUint16 aClientId = EInvalid,
const char *aData = NULL, TUint16 aLength = 0,
const char *sDebug = NULL);
605 void MessageBox(
const TDesC &aMessage);
606 void HandleForegroundEventL(TBool aForeground);
615 TConnectionRole iConnectionRole;
616 TConnectionRole iConnectionRoleTemp;
617 TConnectState iConnectState;
618 TGameState iGameState;
619 TGameCommsState iGameCommsState;
620 TUint16 iStartPlayers;
622 CMessageClient *iClient;
624 char iRecvBuffer[512];
const TInt KBTHostConnectionId
Host connection Id.
Definition: GameBTCommsConsts.h:14
const TInt KBTMaxPlayers
Maximum number of players.
Definition: GameBTCommsConsts.h:13
This is the main interface to the library exposing all multidevice games operations available to a de...
Definition: GameBTComms.h:48
IMPORT_C TInt SendDataToHost(TDesC8 &aData)
Performs a synchronous data write operation to the host.
Definition: GameBTComms.cpp:153
IMPORT_C TConnectState ConnectState()
Indicates the state of the connection.
Definition: GameBTComms.cpp:100
IMPORT_C TInt EndMultiPlayerGame()
This is called when a player no longer wishes to be part of the game (no option of continuing allowed...
Definition: GameBTComms.cpp:189
IMPORT_C TInt ContinueMultiPlayerGame()
This is called to continue a multiplayer game with the same parties that was paused by receiving a MG...
Definition: GameBTComms.cpp:162
IMPORT_C TConnectionRole ConnectionRole()
Indicates whether the device is the host or a client.
Definition: GameBTComms.cpp:86
IMPORT_C TInt GetLocalDeviceName(THostName &aHostName)
Gets the name from the user's Bluetooth settings.
Definition: GameBTComms.cpp:107
IMPORT_C TBool IsShowingDeviceSelectDlg()
Determine whether the Symbian device selection dialog is on display.
Definition: GameBTComms.cpp:198
IMPORT_C void Disconnect()
When called from a client, the connection to the host is dropped.
Definition: GameBTComms.cpp:122
CGameBTComms()
Default C++ Constructor.
Definition: GameBTComms.cpp:52
IMPORT_C TGameState GameState()
Indicates the state of the game.
Definition: GameBTComms.cpp:93
MGameBTCommsNotify * iNotify
Stores a pointer to the user object that will receive callbacks.
Definition: GameBTComms.h:609
IMPORT_C TInt SendDataToClient(TUint16 aClientId, TDesC8 &aData)
Performs a synchronous data write operation to the specified client.
Definition: GameBTComms.cpp:136
IMPORT_C TInt PauseMultiPlayerGame()
Sets each device's game status to paused.
Definition: GameBTComms.cpp:180
RSGEDebugLog * iLog
Pointer to file of debug logging (if included in build!)
Definition: GameBTComms.h:611
IMPORT_C TInt DisconnectClient(TUint16 aClientId)
Disconnects the client specified.
Definition: GameBTComms.cpp:127
IMPORT_C void StartHostL(TUint16 aStartPlayers, TUint16 aMinPlayers)
Set device as a the host.
Definition: GameBTComms.cpp:64
IMPORT_C void StartClientL()
Set the device as a client.
Definition: GameBTComms.cpp:73
IMPORT_C TInt SendDataToAllClients(TDesC8 &aData)
Performs a synchronous data broadcast operation to all connected clients.
Definition: GameBTComms.cpp:144
TUint32 iGameUID
UID of the game to be played.
Definition: GameBTComms.h:610
static IMPORT_C CGameBTComms * NewL(MGameBTCommsNotify *aEventHandler, TUint32 aGameUID, RSGEDebugLog *aLog=NULL)
Creates a new CGameBTComms object.
Definition: GameBTComms.cpp:41
void ConstructL(MGameBTCommsNotify *aEventHandler, TUint32 aGameUID, RSGEDebugLog *aLog)
EPOC Constructor.
Definition: GameBTComms.cpp:372
IMPORT_C TInt ReconnectL(TBool aMustReconnectToAll=ETrue)
This is called to reconnect a disconnected device (for example after the application went into the ba...
Definition: GameBTComms.cpp:171
This is the notification interface provided by the library.
Definition: GameBTCommsNotify.h:35
Provides output to a debug log on device (E:\debug.log). This slows down performance markedly.
Definition: SGEDebugLog.h:27
Definition: GameBTComms.h:107