21 #include "tmsutility.h" |
21 #include "tmsutility.h" |
22 |
22 |
23 using namespace TMS; |
23 using namespace TMS; |
24 |
24 |
25 // ----------------------------------------------------------------------------- |
25 // ----------------------------------------------------------------------------- |
26 // CTarEventHandler::CTarEventHandler |
26 // TMSTarEventHandler::TMSTarEventHandler |
27 // C++ default constructor can NOT contain any code, that |
27 // C++ default constructor can NOT contain any code, that |
28 // might leave. |
28 // might leave. |
29 // ----------------------------------------------------------------------------- |
29 // ----------------------------------------------------------------------------- |
30 // |
30 // |
31 CTarEventHandler::CTarEventHandler(TMSServer* aServer) : |
31 TMSTarEventHandler::TMSTarEventHandler(TMSServer* aServer) : |
32 CActive(EPriorityStandard), |
32 CActive(EPriorityStandard), |
33 iTMSSer(aServer) |
33 iTMSSer(aServer) |
34 { |
34 { |
35 } |
35 } |
36 |
36 |
37 // ----------------------------------------------------------------------------- |
37 // ----------------------------------------------------------------------------- |
38 // CTarEventHandler::ConstructL |
38 // TMSTarEventHandler::ConstructL |
39 // Symbian 2nd phase constructor can leave. |
39 // Symbian 2nd phase constructor can leave. |
40 // ----------------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------------- |
41 // |
41 // |
42 void CTarEventHandler::ConstructL() |
42 void TMSTarEventHandler::ConstructL() |
43 { |
43 { |
44 TRACE_PRN_FN_ENT; |
44 TRACE_PRN_FN_ENT; |
45 CActiveScheduler::Add(this); |
45 CActiveScheduler::Add(this); |
46 User::LeaveIfError(iProperty.Attach(KTMSPropertyCategory, ERoutingPs)); |
46 User::LeaveIfError(iProperty.Attach(KTMSPropertyCategory, ERoutingPs)); |
|
47 iStatus = KRequestPending; |
47 iProperty.Subscribe(iStatus); |
48 iProperty.Subscribe(iStatus); |
48 SetActive(); |
49 SetActive(); |
49 TRACE_PRN_FN_EXT; |
50 TRACE_PRN_FN_EXT; |
50 } |
51 } |
51 |
52 |
52 // ----------------------------------------------------------------------------- |
53 // ----------------------------------------------------------------------------- |
53 // CTarEventHandler::NewL |
54 // TMSTarEventHandler::NewL |
54 // Two-phased constructor. |
55 // Two-phased constructor. |
55 // ----------------------------------------------------------------------------- |
56 // ----------------------------------------------------------------------------- |
56 // |
57 // |
57 CTarEventHandler* CTarEventHandler::NewL(TMSServer* aServer) |
58 TMSTarEventHandler* TMSTarEventHandler::NewL(TMSServer* aServer) |
58 { |
59 { |
59 CTarEventHandler* self = new (ELeave) CTarEventHandler(aServer); |
60 TMSTarEventHandler* self = new (ELeave) TMSTarEventHandler(aServer); |
60 CleanupStack::PushL(self); |
61 CleanupStack::PushL(self); |
61 self->ConstructL(); |
62 self->ConstructL(); |
62 CleanupStack::Pop(self); |
63 CleanupStack::Pop(self); |
63 return self; |
64 return self; |
64 } |
65 } |
65 |
66 |
66 // Destructor |
67 // Destructor |
67 CTarEventHandler::~CTarEventHandler() |
68 TMSTarEventHandler::~TMSTarEventHandler() |
68 { |
69 { |
69 TRACE_PRN_FN_ENT; |
70 TRACE_PRN_FN_ENT; |
70 if (IsActive()) |
71 if (IsActive()) |
71 { |
72 { |
72 Cancel(); |
73 Cancel(); |
74 iProperty.Close(); |
75 iProperty.Close(); |
75 TRACE_PRN_FN_EXT; |
76 TRACE_PRN_FN_EXT; |
76 } |
77 } |
77 |
78 |
78 // ----------------------------------------------------------------------------- |
79 // ----------------------------------------------------------------------------- |
79 // CTarEventHandler::DoCancel |
80 // TMSTarEventHandler::DoCancel |
80 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
81 // |
82 // |
82 void CTarEventHandler::DoCancel() |
83 void TMSTarEventHandler::DoCancel() |
83 { |
84 { |
84 TRACE_PRN_FN_ENT; |
85 TRACE_PRN_FN_ENT; |
85 iProperty.Cancel(); |
86 iProperty.Cancel(); |
86 TRACE_PRN_FN_EXT; |
87 TRACE_PRN_FN_EXT; |
87 } |
88 } |
88 |
89 |
89 // ----------------------------------------------------------------------------- |
90 // ----------------------------------------------------------------------------- |
90 // CTarEventHandler::RunL |
91 // TMSTarEventHandler::RunL |
91 // ----------------------------------------------------------------------------- |
92 // ----------------------------------------------------------------------------- |
92 // |
93 // |
93 void CTarEventHandler::RunL() |
94 void TMSTarEventHandler::RunL() |
94 { |
95 { |
95 TRACE_PRN_FN_ENT; |
96 TRACE_PRN_FN_ENT; |
96 // Subscribe immediately before analyzing the notification to ensure that we |
97 // Subscribe immediately before analyzing the notification to ensure that we |
97 // don't miss further updates. |
98 // don't miss further updates. |
98 if (iStatus.Int() == KErrNone) |
99 if (iStatus.Int() == KErrNone) |
99 { |
100 { |
|
101 iStatus = KRequestPending; |
100 iProperty.Subscribe(iStatus); |
102 iProperty.Subscribe(iStatus); |
101 SetActive(); |
103 SetActive(); |
102 TRoutingMsgBufPckg routingpckg; |
104 TRoutingMsgBufPckg routingpckg; |
103 iProperty.Get(routingpckg); |
105 iProperty.Get(routingpckg); |
104 iTMSSer->NotifyTarClients(routingpckg); |
106 iTMSSer->NotifyTarClients(routingpckg); |