1.1 --- a/epoc32/include/cdmasmsaddr.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,296 +0,0 @@
1.4 -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// 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
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -// Declares the cdmau address classes and constants.
1.18 -//
1.19 -//
1.20 -
1.21 -
1.22 -
1.23 -/**
1.24 - @file
1.25 - @publishedAll
1.26 - @interim
1.27 -*/
1.28 -
1.29 -#if !(defined __CDMASMSADDR_H__)
1.30 -#define __CDMASMSADDR_H__
1.31 -
1.32 -#include <smsuaddr.h>
1.33 -#include "tia637.h"
1.34 -
1.35 -// CDMA SMS PROT public constants start
1.36 -_LIT(KCdmaSmsDatagram,"CDMA SMS Datagram");
1.37 -/** Cdma SMS sockets family identifier. */
1.38 -const TUint KCdmaSMSAddrFamily = 0x012;
1.39 -/** Cdmd SMS sockets protocol ID. */
1.40 -const TUint KCdmaSMSDatagramProtocol = KSMSDatagramProtocol;
1.41 -
1.42 -// Followings are the Ioctl commands used in cdmssmsprot
1.43 -// Ioctl commands that are supported in both cdma and gsm include the following from smsuaddr.h:
1.44 -// KIoctlDeleteSmsMessage = 0x0300;
1.45 -// KIoctlEnumerateSmsMessages = 0x0301;
1.46 -// KIoctlReadMessageSucceeded = 0x0304;
1.47 -// KIoctlReadMessageFailed = 0x0305;
1.48 -// KIoctlSendSmsMessage = 0x0306;
1.49 -// KIoctlWriteSmsMessage = 0x0307;
1.50 -
1.51 -// Gsm Ioctl commands 0x0308-0x0310 are not supported for cdma
1.52 -
1.53 -/** Ioctl command for retrieving message identifier token object
1.54 -
1.55 -@capability NetworkServices
1.56 -@see RSocket::Ioctl(TUint aLevel,TUint aName,TDes8* aOption)
1.57 -*/
1.58 -const TUint KIoctlGetMsgId=0x0311;
1.59 -
1.60 -/** Ioctl command for retrieving the last transport layer acknowledgement cause code
1.61 -This command is valid only after a KIoctlSendSmsMessage ioctl command and
1.62 - aReqestStatus return one of the KErrCdmaSms extended errors and
1.63 - bearer reply option parameter was present in the previous sent message.
1.64 -Otherwise the cause error received will be meaningless
1.65 -
1.66 -@capability NetworkServices
1.67 -@see RSocket::Ioctl(TUint aLevel,TUint aName,TDes8* aOption)
1.68 -*/
1.69 -const TUint KIoctlGetLastSendError=0x0312;
1.70 -/** Value that aOptions could take when client demand traffic channel to stay open.
1.71 - Used only for KIoctlSendSmsMessage Ioctl command */
1.72 -const TUint KKeepChannelOpen=0x01;
1.73 -
1.74 -/** Maximum size of storage location */
1.75 -const TInt KCdmaMaxLocationStorageSize=256;
1.76 -
1.77 -typedef TBuf8<KCdmaMaxLocationStorageSize> TCdmaSmsStorageLocation;
1.78 -
1.79 -
1.80 -// CDMA SMS PROT public constants end
1.81 -
1.82 -/**
1.83 -Sockets for CDMA SMS messages must be bound to an address. The 'address'
1.84 -provides a rule that tells the CDMA SMS stack which received messages should
1.85 -be given to the socket; see TCdmaSmsAddr for a more detailed explanation.
1.86 -
1.87 -Each address must belong to a family. The family must be one of the values
1.88 -listed below.
1.89 -*/
1.90 -enum TCdmaSmsAddrFamily
1.91 - {
1.92 - // as in GSMU
1.93 - /** This indicates that the address's family has not been set
1.94 - */
1.95 - ECdmaSmsAddrUnbound=ESmsAddrUnbound,
1.96 - /** Sockets bound to a ECdmaSmsAddrSendOnly address can only be for
1.97 - sending CDMA SMS messages; they will not receive any messages until they
1.98 - are bound to a different address.
1.99 -
1.100 - Note that a socket bound to any address family except for
1.101 - ECdmaSmsAddrLocalOperation can be used to send messages; not just
1.102 - ECdmaSmsAddrSendOnly
1.103 - */
1.104 - ECdmaSmsAddrSendOnly=ESmsAddrSendOnly,
1.105 - /** Sockets bound to a ECdmaSmsAddrLocalOperation address can only be used
1.106 - for local protocol operations such as enumerating, writing and deleting
1.107 - messages. These sockets cannot be used for sending or receiving messages
1.108 - until they are bound to a different address.
1.109 -
1.110 - Any socket kind of binded address and be used for writing and deleting messages.
1.111 - Only LocalOperation can be used for enumerating messages.
1.112 - */
1.113 - ECdmaSmsAddrLocalOperation=ESmsAddrLocalOperation,
1.114 - /**
1.115 - Sockets bound to a ECdmaSmsWemtAddrMatchIEI address will receive messages
1.116 - on the WEMT teleservice that have a particular Information Element
1.117 - Identifier (IEI).
1.118 -
1.119 - As well as setting the address's family to ECdmaSmsWemtAddrMatchIEI, set
1.120 - the address's 'port'to one of the IEIs in TSmsInformationElementIdentifier;
1.121 - see CSmsInformationElement..
1.122 -
1.123 - The following example binds a socket so that it will receive messages on
1.124 - the WEMT teleservice that have the IEI "Special SMS Message Indication":
1.125 -
1.126 - @code
1.127 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsWemtAddrMatchIEI);
1.128 - smsaddr.SetPort(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication);
1.129 - ret=socket.Bind(smsaddr);
1.130 - @endcode
1.131 - */
1.132 - ECdmaSmsWemtAddrMatchIEI=ESmsAddrMatchIEI,
1.133 - /**
1.134 - Sockets bound to a ECdmaSmsAddrMatchText address will receive messages
1.135 - whose user data matches contains particular text. The messages
1.136 - teleservice does not matter.
1.137 -
1.138 - As well as setting the address's family to ECdmaSmsAddrMatchText, use
1.139 - TCdmaSmsAddr::SetTextMatch to specify an ASCII string. This string is
1.140 - compared to the user data in the message. If the two match then the
1.141 - message is delivered to the socket. The string can contain the wildcards
1.142 - '?' to match one instance of any character and '*' to match any number of
1.143 - characters.
1.144 -
1.145 - @code
1.146 - // match messages that start with 12345
1.147 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrMatchText);
1.148 - smsaddr.SetTextMatch(_L8("12345"));
1.149 - ret=socketMatchText.Bind(smsaddr);
1.150 -
1.151 - // match messages that end with 12345
1.152 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrMatchText);
1.153 - smsaddr.SetTextMatch(_L8("*12345"));
1.154 - ret=socketMatchText.Bind(smsaddr);
1.155 -
1.156 - // match message that contain 12345
1.157 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrMatchText);
1.158 - smsaddr.SetTextMatch(_L8("*12345*"));
1.159 - ret=socketMatchText.Bind(smsaddr);
1.160 - @endcode
1.161 - */
1.162 - ECdmaSmsAddrMatchText=ESmsAddrMatchText,
1.163 - /**
1.164 - Sockets bound to a ECdmaSmsWemtAddrApplication8BitPort address will
1.165 - receive messages on the WEMT teleservice that are from a particular 8 bit
1.166 - application port.
1.167 -
1.168 - As well as setting the address's family to ECdmaSmsWemtAddrMatchIEI, set
1.169 - the address's 'port' to an 8-bit number.
1.170 -
1.171 - The following example binds a socket so that it will receive messages on
1.172 - the WEMT teleservice that are on the port 83:
1.173 -
1.174 - @code
1.175 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsWemtAddrApplication8BitPort);
1.176 - smsaddr.SetPort(83);
1.177 - ret=socket.Bind(smsaddr);
1.178 - @endcode
1.179 - */
1.180 - ECdmaSmsWemtAddrApplication8BitPort=ESmsAddrApplication8BitPort,
1.181 - /**
1.182 - This is similar to ECdmaSmsWemtAddrApplication8BitPort, except that the
1.183 - WEMT message must be from a particular 16 bit application port. The
1.184 - address's port must be set to a 16-bit number. For example:
1.185 -
1.186 - @code
1.187 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsWemtAddrApplication16BitPort);
1.188 - smsaddr.SetPort(1000);
1.189 - ret=socket.Bind(smsaddr);
1.190 - @endcode
1.191 - */
1.192 - ECdmaSmsWemtAddrApplication16BitPort=ESmsAddrApplication16BitPort,
1.193 -
1.194 - // new values
1.195 -
1.196 - /**
1.197 - Sockets bound to a ECdmaSmsAddrTeleservice address will receive messages
1.198 - on a particular teleservice.
1.199 -
1.200 - As well as setting the address's family to ECdmaSmsAddrTeleservice, use
1.201 - TCdmaSmsAddr::SetTeleserviceId to set the required teleservice. For
1.202 - example, to receive messages on the WEMT teleservice:
1.203 -
1.204 - @code
1.205 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrTeleservice);
1.206 - smsaddr.SetTeleserviceId(KTeleserviceWEMT);
1.207 - ret=socket.Bind(smsaddr);
1.208 - @endcode
1.209 - */
1.210 - ECdmaSmsAddrTeleservice =10,
1.211 - /**
1.212 - Sockets bound to a ECdmaSmsWemtAddrWdp address will receive messages on
1.213 - the WAP teleservice that are for a particular WDP port.
1.214 -
1.215 - As well as setting the address's family to ECdmaSmsWemtAddrWdp, set the
1.216 - address's 'port' to a WDP port. For example:
1.217 -
1.218 - @code
1.219 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrWdp);
1.220 - smsaddr.SetPort(wdpPort);
1.221 - ret=socket.Bind(smsaddr);
1.222 - @endcode
1.223 - */
1.224 - ECdmaSmsAddrWdp =11,
1.225 - /**
1.226 - Sockets bound to a ECdmaSmsAddrBroadcast address will receive broadcast
1.227 - messages. Note that broadcast messages cannot be received using other
1.228 - address family.
1.229 -
1.230 - Broadcast messages belong to a service category. A socket can
1.231 - be bound so that it receives broadcast messages from a specified service
1.232 - category. Alternatively it can receive all broadcast messages, whatever
1.233 - the service category.
1.234 -
1.235 - As well as setting the address's family to ECdmaSmsAddrBroadcast, use
1.236 - TCdmaSmsAddr::SetPort to set the required service category from those in
1.237 - tia637::TServiceCategory.
1.238 -
1.239 - @code
1.240 - // Receive messages from the Emergency Broadcast service catagory
1.241 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrBroadcast);
1.242 - smsaddr.SetPort(KEmergencyBroadcasts);
1.243 - ret=broadcastSocket.Bind(smsaddr);
1.244 -
1.245 - // Receive messages from any service category by setting the port to zero
1.246 - smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrBroadcast);
1.247 - smsaddr.SetPort(0);
1.248 - ret=broadcastSocket2.Bind(smsaddr);
1.249 - @endcode
1.250 - */
1.251 - ECdmaSmsAddrBroadcast=12
1.252 - };
1.253 -
1.254 -
1.255 -/**
1.256 -Sockets for CDMA SMS messages must be bound to an address. A
1.257 -socket's address can be thought of as a rule that tells the sockets server
1.258 -which messages should be delivered to the socket. When the CDMA SMS stack
1.259 -receives a message, it compares the message to the address (or rule) of each
1.260 -of the CDMA SMS sockets. If the message's contents match one of the rules,
1.261 -the SMS stack uses Symbian OS's sockets server to pass the message to an
1.262 -appropriate socket.
1.263 -
1.264 -The address is an instance of TCdmaSmsAddr. Create an instance then use its
1.265 -setter methods to configure up the address. Before receiving SMS messages,
1.266 -RSocket::Bind must be called to bind a socket to a appropriate address.
1.267 -
1.268 -Each address must belong to a family. This broadly defines the type of rule
1.269 -used to match messages to socket. Set an address's family with
1.270 -SetCdmaSmsAddrFamily. Depending upon the family, call methods to set further
1.271 -address variables, thus refining the rule further. To understand address
1.272 -better, see the descriptions of the address families in TCdmaSmsAddrFamily.
1.273 -
1.274 -Two sockets cannot be bound to the same address - the second attempt to bind a
1.275 -socket will fail.
1.276 -
1.277 -Sometimes, a message is received matches several addresses, and so could
1.278 -be sent to more than one socket. The messages are compared to address in a
1.279 -particular order; see CdmaSmsAddressPriority below for more information.
1.280 -*/
1.281 -class TCdmaSmsAddr : public TSockAddr
1.282 - {
1.283 -public:
1.284 - /** Maximum length of the text pattern used to match the incoming text. */
1.285 - enum { EMaxTextMatchLength = 24 };
1.286 -public:
1.287 - IMPORT_C TCdmaSmsAddr();
1.288 - IMPORT_C TCdmaSmsAddrFamily CdmaSmsAddrFamily() const;
1.289 - IMPORT_C void SetCdmaSmsAddrFamily(TCdmaSmsAddrFamily aFamily);
1.290 - IMPORT_C TPtrC8 TextMatch() const;
1.291 - IMPORT_C void SetTextMatch(const TDesC8& aText);
1.292 - IMPORT_C TInt NumTextMatchChar() const;
1.293 - IMPORT_C TBool operator==(const TCdmaSmsAddr& aAddr) const;
1.294 - IMPORT_C TInt CdmaSmsAddressPriority()const;
1.295 - IMPORT_C tia637::TTeleserviceId TeleserviceId() const;
1.296 - IMPORT_C void SetTeleserviceId(tia637::TTeleserviceId aTeleserviceId);
1.297 - };
1.298 -
1.299 -#endif //__CDMASMSADDR_H__