williamr@2
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
// Declares the cdmau address classes and constants.
|
williamr@2
|
15 |
//
|
williamr@2
|
16 |
//
|
williamr@2
|
17 |
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
/**
|
williamr@2
|
21 |
@file
|
williamr@2
|
22 |
@publishedAll
|
williamr@2
|
23 |
@interim
|
williamr@2
|
24 |
*/
|
williamr@2
|
25 |
|
williamr@2
|
26 |
#if !(defined __CDMASMSADDR_H__)
|
williamr@2
|
27 |
#define __CDMASMSADDR_H__
|
williamr@2
|
28 |
|
williamr@2
|
29 |
#include <smsuaddr.h>
|
williamr@2
|
30 |
#include "tia637.h"
|
williamr@2
|
31 |
|
williamr@2
|
32 |
// CDMA SMS PROT public constants start
|
williamr@2
|
33 |
_LIT(KCdmaSmsDatagram,"CDMA SMS Datagram");
|
williamr@2
|
34 |
/** Cdma SMS sockets family identifier. */
|
williamr@2
|
35 |
const TUint KCdmaSMSAddrFamily = 0x012;
|
williamr@2
|
36 |
/** Cdmd SMS sockets protocol ID. */
|
williamr@2
|
37 |
const TUint KCdmaSMSDatagramProtocol = KSMSDatagramProtocol;
|
williamr@2
|
38 |
|
williamr@2
|
39 |
// Followings are the Ioctl commands used in cdmssmsprot
|
williamr@2
|
40 |
// Ioctl commands that are supported in both cdma and gsm include the following from smsuaddr.h:
|
williamr@2
|
41 |
// KIoctlDeleteSmsMessage = 0x0300;
|
williamr@2
|
42 |
// KIoctlEnumerateSmsMessages = 0x0301;
|
williamr@2
|
43 |
// KIoctlReadMessageSucceeded = 0x0304;
|
williamr@2
|
44 |
// KIoctlReadMessageFailed = 0x0305;
|
williamr@2
|
45 |
// KIoctlSendSmsMessage = 0x0306;
|
williamr@2
|
46 |
// KIoctlWriteSmsMessage = 0x0307;
|
williamr@2
|
47 |
|
williamr@2
|
48 |
// Gsm Ioctl commands 0x0308-0x0310 are not supported for cdma
|
williamr@2
|
49 |
|
williamr@2
|
50 |
/** Ioctl command for retrieving message identifier token object
|
williamr@2
|
51 |
|
williamr@2
|
52 |
@capability NetworkServices
|
williamr@2
|
53 |
@see RSocket::Ioctl(TUint aLevel,TUint aName,TDes8* aOption)
|
williamr@2
|
54 |
*/
|
williamr@2
|
55 |
const TUint KIoctlGetMsgId=0x0311;
|
williamr@2
|
56 |
|
williamr@2
|
57 |
/** Ioctl command for retrieving the last transport layer acknowledgement cause code
|
williamr@2
|
58 |
This command is valid only after a KIoctlSendSmsMessage ioctl command and
|
williamr@2
|
59 |
aReqestStatus return one of the KErrCdmaSms extended errors and
|
williamr@2
|
60 |
bearer reply option parameter was present in the previous sent message.
|
williamr@2
|
61 |
Otherwise the cause error received will be meaningless
|
williamr@2
|
62 |
|
williamr@2
|
63 |
@capability NetworkServices
|
williamr@2
|
64 |
@see RSocket::Ioctl(TUint aLevel,TUint aName,TDes8* aOption)
|
williamr@2
|
65 |
*/
|
williamr@2
|
66 |
const TUint KIoctlGetLastSendError=0x0312;
|
williamr@2
|
67 |
/** Value that aOptions could take when client demand traffic channel to stay open.
|
williamr@2
|
68 |
Used only for KIoctlSendSmsMessage Ioctl command */
|
williamr@2
|
69 |
const TUint KKeepChannelOpen=0x01;
|
williamr@2
|
70 |
|
williamr@2
|
71 |
/** Maximum size of storage location */
|
williamr@2
|
72 |
const TInt KCdmaMaxLocationStorageSize=256;
|
williamr@2
|
73 |
|
williamr@2
|
74 |
typedef TBuf8<KCdmaMaxLocationStorageSize> TCdmaSmsStorageLocation;
|
williamr@2
|
75 |
|
williamr@2
|
76 |
|
williamr@2
|
77 |
// CDMA SMS PROT public constants end
|
williamr@2
|
78 |
|
williamr@2
|
79 |
/**
|
williamr@2
|
80 |
Sockets for CDMA SMS messages must be bound to an address. The 'address'
|
williamr@2
|
81 |
provides a rule that tells the CDMA SMS stack which received messages should
|
williamr@2
|
82 |
be given to the socket; see TCdmaSmsAddr for a more detailed explanation.
|
williamr@2
|
83 |
|
williamr@2
|
84 |
Each address must belong to a family. The family must be one of the values
|
williamr@2
|
85 |
listed below.
|
williamr@2
|
86 |
*/
|
williamr@2
|
87 |
enum TCdmaSmsAddrFamily
|
williamr@2
|
88 |
{
|
williamr@2
|
89 |
// as in GSMU
|
williamr@2
|
90 |
/** This indicates that the address's family has not been set
|
williamr@2
|
91 |
*/
|
williamr@2
|
92 |
ECdmaSmsAddrUnbound=ESmsAddrUnbound,
|
williamr@2
|
93 |
/** Sockets bound to a ECdmaSmsAddrSendOnly address can only be for
|
williamr@2
|
94 |
sending CDMA SMS messages; they will not receive any messages until they
|
williamr@2
|
95 |
are bound to a different address.
|
williamr@2
|
96 |
|
williamr@2
|
97 |
Note that a socket bound to any address family except for
|
williamr@2
|
98 |
ECdmaSmsAddrLocalOperation can be used to send messages; not just
|
williamr@2
|
99 |
ECdmaSmsAddrSendOnly
|
williamr@2
|
100 |
*/
|
williamr@2
|
101 |
ECdmaSmsAddrSendOnly=ESmsAddrSendOnly,
|
williamr@2
|
102 |
/** Sockets bound to a ECdmaSmsAddrLocalOperation address can only be used
|
williamr@2
|
103 |
for local protocol operations such as enumerating, writing and deleting
|
williamr@2
|
104 |
messages. These sockets cannot be used for sending or receiving messages
|
williamr@2
|
105 |
until they are bound to a different address.
|
williamr@2
|
106 |
|
williamr@2
|
107 |
Any socket kind of binded address and be used for writing and deleting messages.
|
williamr@2
|
108 |
Only LocalOperation can be used for enumerating messages.
|
williamr@2
|
109 |
*/
|
williamr@2
|
110 |
ECdmaSmsAddrLocalOperation=ESmsAddrLocalOperation,
|
williamr@2
|
111 |
/**
|
williamr@2
|
112 |
Sockets bound to a ECdmaSmsWemtAddrMatchIEI address will receive messages
|
williamr@2
|
113 |
on the WEMT teleservice that have a particular Information Element
|
williamr@2
|
114 |
Identifier (IEI).
|
williamr@2
|
115 |
|
williamr@2
|
116 |
As well as setting the address's family to ECdmaSmsWemtAddrMatchIEI, set
|
williamr@2
|
117 |
the address's 'port'to one of the IEIs in TSmsInformationElementIdentifier;
|
williamr@2
|
118 |
see CSmsInformationElement..
|
williamr@2
|
119 |
|
williamr@2
|
120 |
The following example binds a socket so that it will receive messages on
|
williamr@2
|
121 |
the WEMT teleservice that have the IEI "Special SMS Message Indication":
|
williamr@2
|
122 |
|
williamr@2
|
123 |
@code
|
williamr@2
|
124 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsWemtAddrMatchIEI);
|
williamr@2
|
125 |
smsaddr.SetPort(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication);
|
williamr@2
|
126 |
ret=socket.Bind(smsaddr);
|
williamr@2
|
127 |
@endcode
|
williamr@2
|
128 |
*/
|
williamr@2
|
129 |
ECdmaSmsWemtAddrMatchIEI=ESmsAddrMatchIEI,
|
williamr@2
|
130 |
/**
|
williamr@2
|
131 |
Sockets bound to a ECdmaSmsAddrMatchText address will receive messages
|
williamr@2
|
132 |
whose user data matches contains particular text. The messages
|
williamr@2
|
133 |
teleservice does not matter.
|
williamr@2
|
134 |
|
williamr@2
|
135 |
As well as setting the address's family to ECdmaSmsAddrMatchText, use
|
williamr@2
|
136 |
TCdmaSmsAddr::SetTextMatch to specify an ASCII string. This string is
|
williamr@2
|
137 |
compared to the user data in the message. If the two match then the
|
williamr@2
|
138 |
message is delivered to the socket. The string can contain the wildcards
|
williamr@2
|
139 |
'?' to match one instance of any character and '*' to match any number of
|
williamr@2
|
140 |
characters.
|
williamr@2
|
141 |
|
williamr@2
|
142 |
@code
|
williamr@2
|
143 |
// match messages that start with 12345
|
williamr@2
|
144 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrMatchText);
|
williamr@2
|
145 |
smsaddr.SetTextMatch(_L8("12345"));
|
williamr@2
|
146 |
ret=socketMatchText.Bind(smsaddr);
|
williamr@2
|
147 |
|
williamr@2
|
148 |
// match messages that end with 12345
|
williamr@2
|
149 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrMatchText);
|
williamr@2
|
150 |
smsaddr.SetTextMatch(_L8("*12345"));
|
williamr@2
|
151 |
ret=socketMatchText.Bind(smsaddr);
|
williamr@2
|
152 |
|
williamr@2
|
153 |
// match message that contain 12345
|
williamr@2
|
154 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrMatchText);
|
williamr@2
|
155 |
smsaddr.SetTextMatch(_L8("*12345*"));
|
williamr@2
|
156 |
ret=socketMatchText.Bind(smsaddr);
|
williamr@2
|
157 |
@endcode
|
williamr@2
|
158 |
*/
|
williamr@2
|
159 |
ECdmaSmsAddrMatchText=ESmsAddrMatchText,
|
williamr@2
|
160 |
/**
|
williamr@2
|
161 |
Sockets bound to a ECdmaSmsWemtAddrApplication8BitPort address will
|
williamr@2
|
162 |
receive messages on the WEMT teleservice that are from a particular 8 bit
|
williamr@2
|
163 |
application port.
|
williamr@2
|
164 |
|
williamr@2
|
165 |
As well as setting the address's family to ECdmaSmsWemtAddrMatchIEI, set
|
williamr@2
|
166 |
the address's 'port' to an 8-bit number.
|
williamr@2
|
167 |
|
williamr@2
|
168 |
The following example binds a socket so that it will receive messages on
|
williamr@2
|
169 |
the WEMT teleservice that are on the port 83:
|
williamr@2
|
170 |
|
williamr@2
|
171 |
@code
|
williamr@2
|
172 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsWemtAddrApplication8BitPort);
|
williamr@2
|
173 |
smsaddr.SetPort(83);
|
williamr@2
|
174 |
ret=socket.Bind(smsaddr);
|
williamr@2
|
175 |
@endcode
|
williamr@2
|
176 |
*/
|
williamr@2
|
177 |
ECdmaSmsWemtAddrApplication8BitPort=ESmsAddrApplication8BitPort,
|
williamr@2
|
178 |
/**
|
williamr@2
|
179 |
This is similar to ECdmaSmsWemtAddrApplication8BitPort, except that the
|
williamr@2
|
180 |
WEMT message must be from a particular 16 bit application port. The
|
williamr@2
|
181 |
address's port must be set to a 16-bit number. For example:
|
williamr@2
|
182 |
|
williamr@2
|
183 |
@code
|
williamr@2
|
184 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsWemtAddrApplication16BitPort);
|
williamr@2
|
185 |
smsaddr.SetPort(1000);
|
williamr@2
|
186 |
ret=socket.Bind(smsaddr);
|
williamr@2
|
187 |
@endcode
|
williamr@2
|
188 |
*/
|
williamr@2
|
189 |
ECdmaSmsWemtAddrApplication16BitPort=ESmsAddrApplication16BitPort,
|
williamr@2
|
190 |
|
williamr@2
|
191 |
// new values
|
williamr@2
|
192 |
|
williamr@2
|
193 |
/**
|
williamr@2
|
194 |
Sockets bound to a ECdmaSmsAddrTeleservice address will receive messages
|
williamr@2
|
195 |
on a particular teleservice.
|
williamr@2
|
196 |
|
williamr@2
|
197 |
As well as setting the address's family to ECdmaSmsAddrTeleservice, use
|
williamr@2
|
198 |
TCdmaSmsAddr::SetTeleserviceId to set the required teleservice. For
|
williamr@2
|
199 |
example, to receive messages on the WEMT teleservice:
|
williamr@2
|
200 |
|
williamr@2
|
201 |
@code
|
williamr@2
|
202 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrTeleservice);
|
williamr@2
|
203 |
smsaddr.SetTeleserviceId(KTeleserviceWEMT);
|
williamr@2
|
204 |
ret=socket.Bind(smsaddr);
|
williamr@2
|
205 |
@endcode
|
williamr@2
|
206 |
*/
|
williamr@2
|
207 |
ECdmaSmsAddrTeleservice =10,
|
williamr@2
|
208 |
/**
|
williamr@2
|
209 |
Sockets bound to a ECdmaSmsWemtAddrWdp address will receive messages on
|
williamr@2
|
210 |
the WAP teleservice that are for a particular WDP port.
|
williamr@2
|
211 |
|
williamr@2
|
212 |
As well as setting the address's family to ECdmaSmsWemtAddrWdp, set the
|
williamr@2
|
213 |
address's 'port' to a WDP port. For example:
|
williamr@2
|
214 |
|
williamr@2
|
215 |
@code
|
williamr@2
|
216 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrWdp);
|
williamr@2
|
217 |
smsaddr.SetPort(wdpPort);
|
williamr@2
|
218 |
ret=socket.Bind(smsaddr);
|
williamr@2
|
219 |
@endcode
|
williamr@2
|
220 |
*/
|
williamr@2
|
221 |
ECdmaSmsAddrWdp =11,
|
williamr@2
|
222 |
/**
|
williamr@2
|
223 |
Sockets bound to a ECdmaSmsAddrBroadcast address will receive broadcast
|
williamr@2
|
224 |
messages. Note that broadcast messages cannot be received using other
|
williamr@2
|
225 |
address family.
|
williamr@2
|
226 |
|
williamr@2
|
227 |
Broadcast messages belong to a service category. A socket can
|
williamr@2
|
228 |
be bound so that it receives broadcast messages from a specified service
|
williamr@2
|
229 |
category. Alternatively it can receive all broadcast messages, whatever
|
williamr@2
|
230 |
the service category.
|
williamr@2
|
231 |
|
williamr@2
|
232 |
As well as setting the address's family to ECdmaSmsAddrBroadcast, use
|
williamr@2
|
233 |
TCdmaSmsAddr::SetPort to set the required service category from those in
|
williamr@2
|
234 |
tia637::TServiceCategory.
|
williamr@2
|
235 |
|
williamr@2
|
236 |
@code
|
williamr@2
|
237 |
// Receive messages from the Emergency Broadcast service catagory
|
williamr@2
|
238 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrBroadcast);
|
williamr@2
|
239 |
smsaddr.SetPort(KEmergencyBroadcasts);
|
williamr@2
|
240 |
ret=broadcastSocket.Bind(smsaddr);
|
williamr@2
|
241 |
|
williamr@2
|
242 |
// Receive messages from any service category by setting the port to zero
|
williamr@2
|
243 |
smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrBroadcast);
|
williamr@2
|
244 |
smsaddr.SetPort(0);
|
williamr@2
|
245 |
ret=broadcastSocket2.Bind(smsaddr);
|
williamr@2
|
246 |
@endcode
|
williamr@2
|
247 |
*/
|
williamr@2
|
248 |
ECdmaSmsAddrBroadcast=12
|
williamr@2
|
249 |
};
|
williamr@2
|
250 |
|
williamr@2
|
251 |
|
williamr@2
|
252 |
/**
|
williamr@2
|
253 |
Sockets for CDMA SMS messages must be bound to an address. A
|
williamr@2
|
254 |
socket's address can be thought of as a rule that tells the sockets server
|
williamr@2
|
255 |
which messages should be delivered to the socket. When the CDMA SMS stack
|
williamr@2
|
256 |
receives a message, it compares the message to the address (or rule) of each
|
williamr@2
|
257 |
of the CDMA SMS sockets. If the message's contents match one of the rules,
|
williamr@2
|
258 |
the SMS stack uses Symbian OS's sockets server to pass the message to an
|
williamr@2
|
259 |
appropriate socket.
|
williamr@2
|
260 |
|
williamr@2
|
261 |
The address is an instance of TCdmaSmsAddr. Create an instance then use its
|
williamr@2
|
262 |
setter methods to configure up the address. Before receiving SMS messages,
|
williamr@2
|
263 |
RSocket::Bind must be called to bind a socket to a appropriate address.
|
williamr@2
|
264 |
|
williamr@2
|
265 |
Each address must belong to a family. This broadly defines the type of rule
|
williamr@2
|
266 |
used to match messages to socket. Set an address's family with
|
williamr@2
|
267 |
SetCdmaSmsAddrFamily. Depending upon the family, call methods to set further
|
williamr@2
|
268 |
address variables, thus refining the rule further. To understand address
|
williamr@2
|
269 |
better, see the descriptions of the address families in TCdmaSmsAddrFamily.
|
williamr@2
|
270 |
|
williamr@2
|
271 |
Two sockets cannot be bound to the same address - the second attempt to bind a
|
williamr@2
|
272 |
socket will fail.
|
williamr@2
|
273 |
|
williamr@2
|
274 |
Sometimes, a message is received matches several addresses, and so could
|
williamr@2
|
275 |
be sent to more than one socket. The messages are compared to address in a
|
williamr@2
|
276 |
particular order; see CdmaSmsAddressPriority below for more information.
|
williamr@2
|
277 |
*/
|
williamr@2
|
278 |
class TCdmaSmsAddr : public TSockAddr
|
williamr@2
|
279 |
{
|
williamr@2
|
280 |
public:
|
williamr@2
|
281 |
/** Maximum length of the text pattern used to match the incoming text. */
|
williamr@2
|
282 |
enum { EMaxTextMatchLength = 24 };
|
williamr@2
|
283 |
public:
|
williamr@2
|
284 |
IMPORT_C TCdmaSmsAddr();
|
williamr@2
|
285 |
IMPORT_C TCdmaSmsAddrFamily CdmaSmsAddrFamily() const;
|
williamr@2
|
286 |
IMPORT_C void SetCdmaSmsAddrFamily(TCdmaSmsAddrFamily aFamily);
|
williamr@2
|
287 |
IMPORT_C TPtrC8 TextMatch() const;
|
williamr@2
|
288 |
IMPORT_C void SetTextMatch(const TDesC8& aText);
|
williamr@2
|
289 |
IMPORT_C TInt NumTextMatchChar() const;
|
williamr@2
|
290 |
IMPORT_C TBool operator==(const TCdmaSmsAddr& aAddr) const;
|
williamr@2
|
291 |
IMPORT_C TInt CdmaSmsAddressPriority()const;
|
williamr@2
|
292 |
IMPORT_C tia637::TTeleserviceId TeleserviceId() const;
|
williamr@2
|
293 |
IMPORT_C void SetTeleserviceId(tia637::TTeleserviceId aTeleserviceId);
|
williamr@2
|
294 |
};
|
williamr@2
|
295 |
|
williamr@2
|
296 |
#endif //__CDMASMSADDR_H__
|