bluetooth/btstack/rfcomm/rfcommutil.h
changeset 0 29b1cd4cb562
child 13 16aa830c86c8
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2000-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 // Utility functions for Rfcomm
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef RFCOMMUTIL_H
       
    19 #define RFCOMMUTIL_H
       
    20 
       
    21 _LIT(KRFCOMMPanicName, "RFCOMM Panic");
       
    22 
       
    23 enum TRFCOMMPanic
       
    24 	{
       
    25 	ERfcommUnexpectedEvent = 0,
       
    26 	ERfcommNotBound = 1,
       
    27 	ERfcommProtocolOpenedAfterClose = 2,
       
    28 	ERfcommErrorSettingAddress = 3,
       
    29 	ERfcommPacketReassemblyError = 4,
       
    30 	ERfcommPacketLengthError = 5,
       
    31 	ERfcommConnectWithData = 6,
       
    32 	ERfcommPacketHasFCSSet = 7,
       
    33 	ERfcommCantCloseMuxChannel = 8,
       
    34 	ERfcommDataPacketTooLong = 9,
       
    35 	ERfcommTestDataTooLong = 10,
       
    36 	ERfcommInvalidPriority = 11,
       
    37 	ERfcommUnexpectedCanSend = 12,
       
    38 	ERfcommAddSAPInBadState = 13,
       
    39 	ERfcommInvalidRPNLength = 14,
       
    40 	ERfcommNextPacketAlreadySet = 15,
       
    41 	ERfcommDisconnectDataNotSupported = 16,
       
    42 	ERfcommReadForTooMuchData = 17,
       
    43 	ERfcommDataTooLong = 18,
       
    44 	ERfcommSendingWhileBlocked = 19,
       
    45 	ERfcommIdleTimeoutWhenNotIdle = 20,
       
    46 	ERfcommInvalidDLCI = 21,
       
    47 	ERfcommL2CAPMTUtooBig = 22,
       
    48 	ERfcommBadFrameCtrlField = 23,
       
    49 	ERfcommBadFrameAddrField = 24,
       
    50 	ERfcommChannelIdleTimeout = 25,
       
    51 	ERfcommChannelError = 26,
       
    52 	ERfcommSAPTwoIoctls = 27,
       
    53 	ERfcommNewDataCallBack = 28,
       
    54 	ERfcommIncomingNotSupported = 29,
       
    55 	ERfcommMismatchedAddressAndSAP = 30,
       
    56 	ERfcommNullSAPForListening = 31,
       
    57 	ERfcommNullSAPForMuxer = 32,
       
    58 	ERfcommBadDLCIForClone = 33,
       
    59 	ERfcommBadStateForCloning = 34,
       
    60 	ERfcommDequeingBadListeningSAP = 35,
       
    61 	ERfcommRequeuingListeningSAP = 36,
       
    62 	ERfcommBadCalculatedMTU = 37,
       
    63 	ERfcommUnknownChildConnectionNotified = 38,
       
    64 	ERfcommBadStateForDestruction = 39,
       
    65 	ERfcommNullMux = 40,
       
    66 	ERfcommUnexpectedSecurityRequesterCallback = 41,
       
    67 	ERfcommNoSecurityRequester = 42,
       
    68 	ERfcommUnknownChildSecurityFailed = 43,
       
    69 	ERfcommInvalidMuxInSAP = 44,
       
    70 	ERfcommStateDisconnectingWithNoData = 45,
       
    71 	ERfcommNullSAPForCallback = 46,
       
    72 	ERfcommFrameBeforeMuxUp = 47,
       
    73 	ERfcommBadOptionForRFCOMM = 48,
       
    74 	ERfcommMuxChannelOpeningAndClosing = 49,
       
    75 	ERfcommChannelUnhandledEvent = 50,
       
    76 	ERfcommPNMismatchedDLCI = 51,
       
    77 	ERfcommMuxChannelStateChangeToSelf = 52,
       
    78 	ERfcommUnexpectedCBFCCredit = 53,
       
    79 	ERfcommCBFCProxyForRemoteCreditGoingNegative = 54,
       
    80 	ERfcommCBFCLocalCreditGoingNegative = 55,
       
    81 	ERfcommNoPacket = 56,
       
    82 	ERfcommUnhandledIoctl = 57,
       
    83 	ERfcommInvalidSAPIoctlCancel =58,
       
    84 	ERfcommStateClosedWithData = 59,
       
    85 	ERfcommSAPAllocatedBetweenBindAndListen = 60,
       
    86 	ERfcommRequeuingBoundSAP = 61,
       
    87 	ERfcommDequeuingBadBoundSAP = 62,
       
    88 	ERfCommFlowStrategyOutOfBounds = 63,
       
    89 	ERfCommMuxerStateOutOfBounds = 64, 
       
    90 	ERfCommStateOutOfBounds = 65
       
    91 	};
       
    92 
       
    93 /**
       
    94 Panics raised by state machine default behaviour are multiplied by this
       
    95 factor.  The less signifigant digits are then available to carry a state
       
    96 index, allowing more information when fixing defects.
       
    97 
       
    98 For example, 'RFCOMM Panic 1008' is a UnexpectedEvent panic in the 
       
    99 'Listenning' state.
       
   100 */
       
   101 const TInt KStatePanicMultiplier = 10000;
       
   102 
       
   103 /**
       
   104 A delimiter to prevent a panic code of 0 creating ambigious panics.
       
   105 Without this panic code 0 in state 8 and panic code 8 (not in the state 
       
   106 machine) would be identical.
       
   107 */
       
   108 const TInt KStatePanicDelimiter = 1000; // '1' is the delimiter
       
   109 
       
   110 /**
       
   111 If for any reason the current state cannot be found, this value is placed
       
   112 in the state field of a panic.
       
   113 */
       
   114 const TInt KUnknownState = KStatePanicDelimiter - 1;
       
   115 
       
   116 void Panic(TRFCOMMPanic aPanic);
       
   117 
       
   118 void Panic(TRFCOMMPanic aPanic, TInt aState);
       
   119 
       
   120 #endif