|
1 // Copyright (c) 2008-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 #include "datamonmessagesecom.h" |
|
17 |
|
18 #include <comms-infras/es_datamon_apiext.h> |
|
19 |
|
20 |
|
21 using namespace ESock; |
|
22 |
|
23 Meta::SMetaDataECom* CDataMonitoringMsgFactory::NewMessageL(TAny* aParams) |
|
24 { |
|
25 TInt32 type = reinterpret_cast<TInt32>(aParams); |
|
26 |
|
27 switch(type) |
|
28 { |
|
29 case EDataMonitoringMsgDataTransferred: |
|
30 return new(ELeave) CDataTransferred; |
|
31 case EDataMonitoringMsgDataSentNotification: |
|
32 return new(ELeave) CDataSent; |
|
33 case EDataMonitoringMsgDataReceivedNotification: |
|
34 return new(ELeave) CDataReceived; |
|
35 default: |
|
36 User::Leave(KErrNotFound); |
|
37 } |
|
38 |
|
39 return NULL; |
|
40 } |
|
41 |
|
42 /*------------------------------------------------------- |
|
43 Server -> Client messages |
|
44 -------------------------------------------------------*/ |
|
45 |
|
46 START_ATTRIBUTE_TABLE(CDataTransferred, KDataMonitoringMessagesImplementationUid, EDataMonitoringMsgDataTransferred) |
|
47 REGISTER_ATTRIBUTE(CDataTransferred, iReceivedBytes, TMeta<TUint>) |
|
48 REGISTER_ATTRIBUTE(CDataTransferred, iSentBytes, TMeta<TUint>) |
|
49 END_ATTRIBUTE_TABLE() |
|
50 |
|
51 START_ATTRIBUTE_TABLE(CDataSent, KDataMonitoringMessagesImplementationUid, EDataMonitoringMsgDataSentNotification) |
|
52 REGISTER_ATTRIBUTE(CDataSent, iSentBytes, TMeta<TUint>) |
|
53 END_ATTRIBUTE_TABLE() |
|
54 |
|
55 START_ATTRIBUTE_TABLE(CDataReceived, KDataMonitoringMessagesImplementationUid, EDataMonitoringMsgDataReceivedNotification) |
|
56 REGISTER_ATTRIBUTE(CDataReceived, iReceivedBytes, TMeta<TUint>) |
|
57 END_ATTRIBUTE_TABLE() |
|
58 |
|
59 void CDataTransferred::DispatchL(MDataMonitorProtocolResp& aProtocol) |
|
60 { |
|
61 aProtocol.DataTransferred(iReceivedBytes, iSentBytes); |
|
62 } |
|
63 |
|
64 void CDataSent::DispatchL(MDataMonitorProtocolResp& aProtocol) |
|
65 { |
|
66 aProtocol.DataSentNotification(iSentBytes); |
|
67 } |
|
68 |
|
69 void CDataReceived::DispatchL(MDataMonitorProtocolResp& aProtocol) |
|
70 { |
|
71 aProtocol.DataReceivedNotification(iReceivedBytes); |
|
72 } |
|
73 |
|
74 |