|
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef BTCOMMUTIL_H__ |
|
17 #define BTCOMMUTIL_H__ |
|
18 |
|
19 _LIT(KBTCommPanicName, "BTComm Panic"); |
|
20 |
|
21 enum TBTCommPanic |
|
22 { |
|
23 EBTCommBadEventForThisState, // we should have never received this event in this state |
|
24 EBTCommPortBufferTerminatorCharNoOtherThanExpected, |
|
25 EBTCommPortBufferTerminatedCharsFoundBogus, |
|
26 EBTCommPortReaderPotentialLossOfIncomingData, |
|
27 EBTCommOpenStateWriteToClientPossibleLossOfData, |
|
28 EBTCommCloseWhileWaitingForSockServHandle, |
|
29 EBTCommESockSessionAttachNotDone, |
|
30 EBTCommPortStateOutOfBounds |
|
31 }; |
|
32 |
|
33 /** |
|
34 Panics raised by state machine default behaviour are multiplied by this |
|
35 factor. The less signifigant digits are then available to carry a state |
|
36 index, allowing more information when fixing defects. |
|
37 |
|
38 For example, a bad event passed to the BTComm state machine may raise panic |
|
39 'BTComm Panic 1008' if it occurs in the 'Connecting' state. |
|
40 */ |
|
41 const TInt KStatePanicMultiplier = 10000; |
|
42 |
|
43 /** |
|
44 A delimiter to prevent a panic code of 0 creating ambigious panics. |
|
45 Without this panic code 0 in state 8 and panic code 8 (not in the state |
|
46 machine) would be identical. |
|
47 */ |
|
48 const TInt KStatePanicDelimiter = 1000; // '1' is the delimiter |
|
49 |
|
50 /** |
|
51 If for any reason the current state cannot be found, this value is placed |
|
52 in the state field of a panic. |
|
53 */ |
|
54 const TInt KUnknownState = KStatePanicDelimiter - 1; |
|
55 |
|
56 class BTCommUtil |
|
57 { |
|
58 public: |
|
59 static void Panic(TBTCommPanic aPanic); |
|
60 static void Panic(TBTCommPanic aPanic, TInt aState); |
|
61 }; |
|
62 |
|
63 #endif |