|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "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 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CSMSPLATFORMSERVICES60IMPL_H |
|
19 #define CSMSPLATFORMSERVICES60IMPL_H |
|
20 |
|
21 #include <gsmubuf.h> |
|
22 #include <gsmuelem.h> |
|
23 #include <smsuaddr.h> |
|
24 |
|
25 |
|
26 #include "smsplatformservice.h" |
|
27 |
|
28 class CSmsMessage; |
|
29 |
|
30 namespace java |
|
31 { |
|
32 namespace wma |
|
33 { |
|
34 /** |
|
35 * CJavaMessageConnection implements CJavaMessageConnectionBase. |
|
36 * It offers methods for sending , to get the |
|
37 * number of data segments required to send the message and to |
|
38 * receive the message. |
|
39 */ |
|
40 class CSmsPlatformServiceS60Impl: public CBase,public SmsPlatformService |
|
41 { |
|
42 |
|
43 public: |
|
44 //Constructor |
|
45 CSmsPlatformServiceS60Impl(std::wstring aUri); |
|
46 //Destructor |
|
47 ~CSmsPlatformServiceS60Impl(); |
|
48 /** |
|
49 * Gets the Time stamp of the received message. |
|
50 * @return jlong The time value as jlong. |
|
51 */ |
|
52 jlong getTimeStamp(); |
|
53 /** |
|
54 * Gets the Remote Host Address. |
|
55 * @param[in] aJni Jni interface pointer. |
|
56 * @return jstring The RemoteHostAddress as jstring. |
|
57 */ |
|
58 |
|
59 jstring getHostAddress(JNIEnv& aJni); |
|
60 /** |
|
61 * gets the received message as jobject to java side. |
|
62 * @param[in] aJni Jni interface pointer. |
|
63 * @param[in] aMsgType Message type of the received message. |
|
64 * @return jobject The received message as jobject. |
|
65 */ |
|
66 jobject getMessageData(JNIEnv& aJni, const int aMessageType); |
|
67 /** |
|
68 * Method to send the message. |
|
69 * @return int The success or Failure value. |
|
70 */ |
|
71 |
|
72 int send(); |
|
73 /** |
|
74 * Gets the Message type of the received Message. |
|
75 * @param[in] aServerConn - reference to server connection |
|
76 * @return int The type of the Message either Binary/Text Message. |
|
77 */ |
|
78 |
|
79 int receivedMessageType(ServerConnectionBase& aServerConn); |
|
80 /** |
|
81 * Initializing function |
|
82 */ |
|
83 void initialize(); |
|
84 /** |
|
85 * function that calculates and returns numberofDataSegments required to send |
|
86 * the Message provided. |
|
87 * @param[in] aMesgtype MessageType |
|
88 * @param[in] aLength length of the message |
|
89 * @param[in] aport port number |
|
90 * @param[in] ahostaddress Destination address |
|
91 * @param[in] adata Message data |
|
92 * @return int number of data segments. |
|
93 */ |
|
94 int getSmsDataSegments(const int aMesgType, const int aLength, |
|
95 const int aHostPort,const char* ahostAddress, const char*); |
|
96 |
|
97 private: |
|
98 |
|
99 /** |
|
100 * Converts the CString to Descriptor |
|
101 * @param[in] aData Message Data |
|
102 * @param[in] aMsgType Message type |
|
103 * @param[in] aLength Message length |
|
104 */ |
|
105 HBufC* convertToDes(const char* aData, const int aMsgType, |
|
106 const int aLength); |
|
107 /** |
|
108 * Gets the best Message encoding for the message provided. |
|
109 * @param[in] asmsData Message data for which the best encoding to be found |
|
110 * @param[in] amsgType Message type of the message provided |
|
111 * @param[in] aFs handle to File server |
|
112 * @return TSmsAlphabet Best Message encoding type. |
|
113 */ |
|
114 TSmsDataCodingScheme::TSmsAlphabet getEncodingSchemeL(const TDesC& asmsData, |
|
115 const TInt amsgType, |
|
116 RFs& aFs); |
|
117 private: |
|
118 //sending port |
|
119 int mSendPort; |
|
120 //Uri of the opened connection. |
|
121 std::wstring mUri; |
|
122 //handle to RSocket |
|
123 RSocket mSmsSendSocket; |
|
124 // handle to socket server |
|
125 RSocketServ mSocketServer; |
|
126 //SMS address for a socket. |
|
127 TSockAddr mSmsSendAddress; |
|
128 //Represents a complete SMS message. |
|
129 CSmsMessage* mSendMessage; |
|
130 // buffer to be used when sending |
|
131 TPckgBuf<TUint> mSmsSendDummyBuf; |
|
132 //Buffer to hold the sms message parameters |
|
133 TJavaMessageParametersBuf* mMessageParameters; |
|
134 |
|
135 }; |
|
136 } //namespace wma |
|
137 } //namespace java |
|
138 #endif // CSMSPLATFORMSERVICES60IMPL_H |