|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef STATSERIALBLUETOOTH_H |
|
22 #define STATSERIALBLUETOOTH_H |
|
23 |
|
24 #include "statcommon.h" |
|
25 #include "stattransport.h" |
|
26 |
|
27 // COM port settings |
|
28 #define STATBT_WRITETOTALTIMEOUTMULTIPLIER 10 |
|
29 #define STATBT_WRITETOTALTIMEOUTCONSTANT 10 |
|
30 #define STATBT_READINTERVALTIMEOUT 100 |
|
31 #define STATBT_READTOTALTIMEOUTMULTIPLIER 100 |
|
32 #define STATBT_READTOTALTIMEOUTCONSTANT 120000 |
|
33 |
|
34 #define STATBT_BAUDRATE CBR_115200 |
|
35 #define STATBT_BYTESIZE 8 |
|
36 #define STATBT_PARITY NOPARITY |
|
37 #define STATBT_STOPBITS ONESTOPBIT |
|
38 |
|
39 |
|
40 class CSTATSerialBluetooth : public CSTATTransport |
|
41 { |
|
42 public: |
|
43 CSTATSerialBluetooth(); |
|
44 ~CSTATSerialBluetooth(); |
|
45 int Initialise(void); |
|
46 int Connect(const char *pAddress = NULL); |
|
47 int Send(const char cIdentifier, const char *pData = NULL, const unsigned long ulLength = 0); |
|
48 int Receive(char *cIdentifier, char **ppData = NULL, unsigned long *pLength = NULL); |
|
49 int Disconnect(void); |
|
50 int Release(void); |
|
51 |
|
52 private: |
|
53 bool OpenComPort(const char *pAddress); |
|
54 int ReceiveBytes( char *buff, unsigned long size ); |
|
55 |
|
56 HANDLE hComPort; // com port to work with |
|
57 char *pTemp; // holds received data |
|
58 }; |
|
59 |
|
60 #endif |