cbsref/csyrefplugins/csy27010/inc/CommFrameReaderAo.h
changeset 49 f50f4094acd7
equal deleted inserted replaced
48:14460bf2a402 49:f50f4094acd7
       
     1 //
       
     2 // * Copyright 2004 Neusoft America Inc.
       
     3 // * All rights reserved.
       
     4 // * This component and the accompanying materials are made available
       
     5 // * under the terms of the 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 // * Contributors:
       
    10 // * Keith Collins (Neusoft America Inc.)  original software development and additional code and modifications.
       
    11 // * Thomas Gahagen (Neusoft America Inc.)  additional code and modifications.
       
    12 // * Zhen Yuan (Neusoft America Inc.)  additional code and modifications.
       
    13 // *
       
    14 // * Description: This file contains the declaration for class CCommFrameReaderAo.
       
    15 // *              Class CCommFrameReaderAo is used to request a read from the serial port LDD.
       
    16 // *              Class CommFrameReaderAo is an active object and is run by the active
       
    17 // *              scheduler when the LDD has completed the CSY's read request.
       
    18 // *
       
    19 //
       
    20 
       
    21 // CommFrameReader.h
       
    22 
       
    23 /** @file CommFrameReaderAo.h
       
    24  *
       
    25  * 
       
    26  */
       
    27 
       
    28 #ifndef _CCOMMFRAMEREADERAO_H_
       
    29 #define _CCOMMFRAMEREADERAO_H_
       
    30 
       
    31 #include "CommReadWriteBaseAo.h"
       
    32 #include "CsyGlobals.h"
       
    33 
       
    34 class CCsyMsgBufBpFrame;
       
    35 
       
    36 /** @class CCommFrameReaderAo CommFrameReaderAo.h "CommFrameReaderAo.h"
       
    37  *  @brief Class CCommFrameReaderAo is used to request a read from 
       
    38  *  the serial port LDD. Class CommFrameReaderAo is an active object
       
    39  *  and is run by the active scheduler when the LDD has completed
       
    40  *  the CSY's read request. There is one instance of CCommFrameReaderAo.
       
    41  */
       
    42 class CCommFrameReaderAo : public CCommReadWriteBaseAo
       
    43 	{
       
    44 public:
       
    45 	enum TCsyFrameReaderState
       
    46 		{
       
    47 		ECsyWaitingForStartFlag  = 0,
       
    48 		ECsyWaitingForFrameStart = 1,
       
    49 		ECsyWaitingForFrameData  = 2,
       
    50 		ECsyWaitingForEndOfFrame = 3
       
    51 		};
       
    52 
       
    53 	static CCommFrameReaderAo* NewL(CPortFactory* aParent, CMux0710Protocol* aMux0710Protocol);
       
    54 	~CCommFrameReaderAo();
       
    55 
       
    56 	void Read();
       
    57 	void ReadCancel();
       
    58 
       
    59 public:// from CActive
       
    60 	virtual void DoCancel();
       
    61 	virtual void RunL();
       
    62 
       
    63 private:
       
    64 	CCommFrameReaderAo(CPortFactory* aParent, CMux0710Protocol* aMux0710Protocol);
       
    65 	void ConstructL();
       
    66 
       
    67 	void NonMuxed();
       
    68 	void BasicOption();
       
    69 	void AdvancedOption();
       
    70  
       
    71 	TBool CheckFCS(TDes8& aBuffer, TInt aLen, TUint8 aSuppliedChecksum);
       
    72 
       
    73 	void AddToReceivedFramesList(CCsyMsgBufBpFrame* aBpFrame);
       
    74 
       
    75 private:
       
    76 	TCsyFrameReaderState	iFrameReaderState;
       
    77 	CCsyMsgBufBpFrame*		iFrameBuf;
       
    78 
       
    79 	TBool iESCRecved;
       
    80 
       
    81 	};
       
    82 
       
    83 #endif  //_CCOMMFRAMEREADERAO_H_