19 |
19 |
20 #include "ccommandmodereq.h" |
20 #include "ccommandmodereq.h" |
21 #include "modemattrace.h" |
21 #include "modemattrace.h" |
22 #include "modematclientsrv.h" |
22 #include "modematclientsrv.h" |
23 #include "rmodematcontroller.h" |
23 #include "rmodematcontroller.h" |
|
24 #include "OstTraceDefinitions.h" |
|
25 #ifdef OST_TRACE_COMPILER_IN_USE |
|
26 #include "ccommandmodereqTraces.h" |
|
27 #endif |
24 |
28 |
25 const TUint KCommandModeBufLength = 1; |
29 const TUint KCommandModeBufLength = 1; |
26 |
30 |
27 CCommandModeReq::CCommandModeReq( RModemAtController* aClient ) : |
31 CCommandModeReq::CCommandModeReq( RModemAtController* aClient ) : |
28 CActive( EPriorityNormal ), |
32 CActive( EPriorityNormal ), |
29 iClient( aClient ), |
33 iClient( aClient ), |
30 iResponseBuf(NULL), |
34 iResponseBuf(NULL), |
31 iResponse(NULL,0) |
35 iResponse(NULL,0) |
32 { |
36 { |
|
37 OstTrace0( TRACE_NORMAL, CCOMMANDMODEREQ_CCOMMANDMODEREQ, "CCommandModeReq::CCommandModeReq" ); |
33 C_TRACE((_L("CCommandModeReq::CCommandModeReq()"))); |
38 C_TRACE((_L("CCommandModeReq::CCommandModeReq()"))); |
34 CActiveScheduler::Add( this ); |
39 CActiveScheduler::Add( this ); |
35 iResponseBuf = HBufC8::NewL( KCommandModeBufLength ); |
40 iResponseBuf = HBufC8::NewL( KCommandModeBufLength ); |
36 iResponse.Set( iResponseBuf->Des() ); |
41 iResponse.Set( iResponseBuf->Des() ); |
37 iClient->SendReceiveCommandMode( iResponse, iStatus ); |
42 iClient->SendReceiveCommandMode( iResponse, iStatus ); |
38 SetActive(); |
43 SetActive(); |
39 } |
44 } |
40 |
45 |
41 CCommandModeReq::~CCommandModeReq() |
46 CCommandModeReq::~CCommandModeReq() |
42 { |
47 { |
|
48 OstTrace0( TRACE_NORMAL, DUP1_CCOMMANDMODEREQ_CCOMMANDMODEREQ, "CCommandModeReq::~CCommandModeReq" ); |
43 C_TRACE((_L("CCommandModeReq::~CCommandModeReq()"))); |
49 C_TRACE((_L("CCommandModeReq::~CCommandModeReq()"))); |
44 Cancel(); |
50 Cancel(); |
45 delete iResponseBuf; |
51 delete iResponseBuf; |
46 iResponseBuf = NULL; |
52 iResponseBuf = NULL; |
47 } |
53 } |
48 |
54 |
49 void CCommandModeReq::RunL() |
55 void CCommandModeReq::RunL() |
50 { |
56 { |
|
57 OstTrace0( TRACE_NORMAL, CCOMMANDMODEREQ_RUNL, "CCommandModeReq::RunL" ); |
51 C_TRACE((_L("CCommandModeReq::RunL()"))); |
58 C_TRACE((_L("CCommandModeReq::RunL()"))); |
52 |
59 |
53 if( iStatus.Int() == KErrNone ) |
60 if( iStatus.Int() == KErrNone ) |
54 { |
61 { |
55 C_TRACE((_L("CCommandModeReq RunL response: 0x%x"), &iResponse)); |
62 C_TRACE((_L("CCommandModeReq RunL response: 0x%x"), &iResponse)); |
56 TLex8 lex( iResponse ); |
63 TLex8 lex( iResponse ); |
57 TInt mode( 0 ); |
64 TInt mode( 0 ); |
58 if( lex.Val( mode ) == KErrNone ) |
65 if( lex.Val( mode ) == KErrNone ) |
59 { |
66 { |
|
67 OstTrace1( TRACE_NORMAL, DUP1_CCOMMANDMODEREQ_RUNL, "CCommandModeReq command mode;mode=%d;changed", mode ); |
60 C_TRACE((_L("CCommandModeReq command mode %d changed"), mode)); |
68 C_TRACE((_L("CCommandModeReq command mode %d changed"), mode)); |
61 iClient->CommandModeChanged( iStatus.Int(), (TCommandMode) mode ); |
69 iClient->CommandModeChanged( iStatus.Int(), (TCommandMode) mode ); |
62 // Start receiving again |
70 // Start receiving again |
63 iResponse.Zero(); |
71 iResponse.Zero(); |
64 iClient->SendReceiveCommandMode( iResponse, iStatus ); |
72 iClient->SendReceiveCommandMode( iResponse, iStatus ); |
65 SetActive(); |
73 SetActive(); |
66 } |
74 } |
67 else |
75 else |
68 { |
76 { |
|
77 OstTrace1( TRACE_NORMAL, DUP2_CCOMMANDMODEREQ_RUNL, "CCommandModeReq RunL lex failed;lex.Val( mode )=%d", lex.Val( mode ) ); |
69 C_TRACE((_L("CCommandModeReq RunL lex failed %d"), lex.Val( mode ))); |
78 C_TRACE((_L("CCommandModeReq RunL lex failed %d"), lex.Val( mode ))); |
70 delete this; |
79 delete this; |
71 } |
80 } |
72 } |
81 } |
73 else if( iStatus.Int() == KErrCancel ) |
82 else if( iStatus.Int() == KErrCancel ) |
74 { |
83 { |
|
84 OstTrace0( TRACE_NORMAL, DUP3_CCOMMANDMODEREQ_RUNL, "CCommandModeReq RunL cancelled - delete" ); |
75 C_TRACE((_L("CCommandModeReq RunL cancelled - delete"))); |
85 C_TRACE((_L("CCommandModeReq RunL cancelled - delete"))); |
76 delete this; |
86 delete this; |
77 } |
87 } |
78 } |
88 } |
79 |
89 |
80 void CCommandModeReq::DoCancel() |
90 void CCommandModeReq::DoCancel() |
81 { |
91 { |
|
92 OstTrace0( TRACE_NORMAL, CCOMMANDMODEREQ_DOCANCEL, "CCommandModeReq::DoCancel" ); |
82 C_TRACE((_L("CCommandModeReq::DoCancel()"))); |
93 C_TRACE((_L("CCommandModeReq::DoCancel()"))); |
83 iClient->SendReceiveCommandModeCancel(); |
94 iClient->SendReceiveCommandModeCancel(); |
84 } |
95 } |
85 |
96 |