|
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: ?Description |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MMSCONNECTION_H |
|
20 #define MMSCONNECTION_H |
|
21 |
|
22 #include "monitor.h" |
|
23 #include "connectionlistener.h" |
|
24 #include "mmsplatformservice.h" |
|
25 #include "mmsserverconnection.h" |
|
26 #include "serverconnectionfactory.h" |
|
27 |
|
28 using namespace java::push; |
|
29 using namespace java::util; |
|
30 namespace java |
|
31 { |
|
32 namespace wma |
|
33 { |
|
34 /** |
|
35 * CJavaMmsConnection implements ConnectionListener. |
|
36 * It offers the functionality of sending the message and |
|
37 * to retrieve the received message. |
|
38 */ |
|
39 class MmsConnection: public ConnectionListener |
|
40 { |
|
41 public: |
|
42 /** |
|
43 * Private Contructor. |
|
44 * @param aServerConnection - boolean variable which indicates |
|
45 * server connection or client connection |
|
46 * @param aUri - string which contains the uri on which the connection is |
|
47 * opened. |
|
48 */ |
|
49 MmsConnection(bool aServerConnection, std::wstring aUri); |
|
50 /** |
|
51 * Destructor |
|
52 */ |
|
53 ~MmsConnection(); |
|
54 /** |
|
55 * checks for any missed messages while opening a connection. |
|
56 * waits for incoming message & notifies the java side. |
|
57 * @param[in] aJni Jni interface pointer |
|
58 * @param[in] apeer jobject |
|
59 */ |
|
60 void open(JNIEnv& aJni, jobject aPeer); |
|
61 |
|
62 /** |
|
63 * Sending the Multimedia Message. |
|
64 * param aJni - Jni interface pointer |
|
65 * param aMsg - multimedia message as byte array |
|
66 */ |
|
67 jint sendMMS(JNIEnv& aJni, jbyteArray aMsg, jint aOffset, jint aMsgLength, |
|
68 jstring aAddress); |
|
69 |
|
70 /** |
|
71 * This method initializes the object |
|
72 * @param aJni - jni interface pointer |
|
73 * @param aPeer - java side peer object |
|
74 */ |
|
75 void initialize(JNIEnv& aJni, jobject aPeer); |
|
76 |
|
77 /** |
|
78 * Retrieves the Multimedia Message. |
|
79 * @param aJni - Jni interface pointer |
|
80 */ |
|
81 jbyteArray retrieveMMSMessage(JNIEnv& aJni); |
|
82 |
|
83 /** |
|
84 * from ConnectionListener. |
|
85 * This function is called when a Multimedia Message |
|
86 * arrives at the registered Application ID. |
|
87 */ |
|
88 void msgArrived(const std::wstring&); |
|
89 |
|
90 /** |
|
91 * Method to close the connection. |
|
92 */ |
|
93 void close(JNIEnv& aJni, jobject aPeer); |
|
94 |
|
95 /** |
|
96 * from ConnectionListener. |
|
97 * This function is called when the error has occured. |
|
98 * while receiving the message. |
|
99 */ |
|
100 void error(const std::wstring& aUri, int aErrCode, |
|
101 const std::string& aErrText); |
|
102 |
|
103 private: |
|
104 |
|
105 //Error variable to track errors while receiving |
|
106 int mError; |
|
107 //Uri string on which the connection is opened |
|
108 std::wstring mUri; |
|
109 //boolean variable to identify server/client connection |
|
110 bool mIsServerConnection; |
|
111 //boolean variable to control the notifier thread |
|
112 bool mReceiveOperation; |
|
113 MmsServerConnection* mServerConn; |
|
114 java::util::Monitor* mMessageMonitor; |
|
115 ServerConnectionFactory* mServerConnectionFactory; |
|
116 MMSPlatformService* mMmsPlatformService; |
|
117 }; |
|
118 } //namespace wma |
|
119 } //namespace java |
|
120 #endif // MMSCONNECTION_H |