williamr@2: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // Declares the cdmau address classes and constants. williamr@2: // williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @interim williamr@2: */ williamr@2: williamr@2: #if !(defined __CDMASMSADDR_H__) williamr@2: #define __CDMASMSADDR_H__ williamr@2: williamr@2: #include williamr@2: #include "tia637.h" williamr@2: williamr@2: // CDMA SMS PROT public constants start williamr@2: _LIT(KCdmaSmsDatagram,"CDMA SMS Datagram"); williamr@2: /** Cdma SMS sockets family identifier. */ williamr@2: const TUint KCdmaSMSAddrFamily = 0x012; williamr@2: /** Cdmd SMS sockets protocol ID. */ williamr@2: const TUint KCdmaSMSDatagramProtocol = KSMSDatagramProtocol; williamr@2: williamr@2: // Followings are the Ioctl commands used in cdmssmsprot williamr@2: // Ioctl commands that are supported in both cdma and gsm include the following from smsuaddr.h: williamr@2: // KIoctlDeleteSmsMessage = 0x0300; williamr@2: // KIoctlEnumerateSmsMessages = 0x0301; williamr@2: // KIoctlReadMessageSucceeded = 0x0304; williamr@2: // KIoctlReadMessageFailed = 0x0305; williamr@2: // KIoctlSendSmsMessage = 0x0306; williamr@2: // KIoctlWriteSmsMessage = 0x0307; williamr@2: williamr@2: // Gsm Ioctl commands 0x0308-0x0310 are not supported for cdma williamr@2: williamr@2: /** Ioctl command for retrieving message identifier token object williamr@2: williamr@2: @capability NetworkServices williamr@2: @see RSocket::Ioctl(TUint aLevel,TUint aName,TDes8* aOption) williamr@2: */ williamr@2: const TUint KIoctlGetMsgId=0x0311; williamr@2: williamr@2: /** Ioctl command for retrieving the last transport layer acknowledgement cause code williamr@2: This command is valid only after a KIoctlSendSmsMessage ioctl command and williamr@2: aReqestStatus return one of the KErrCdmaSms extended errors and williamr@2: bearer reply option parameter was present in the previous sent message. williamr@2: Otherwise the cause error received will be meaningless williamr@2: williamr@2: @capability NetworkServices williamr@2: @see RSocket::Ioctl(TUint aLevel,TUint aName,TDes8* aOption) williamr@2: */ williamr@2: const TUint KIoctlGetLastSendError=0x0312; williamr@2: /** Value that aOptions could take when client demand traffic channel to stay open. williamr@2: Used only for KIoctlSendSmsMessage Ioctl command */ williamr@2: const TUint KKeepChannelOpen=0x01; williamr@2: williamr@2: /** Maximum size of storage location */ williamr@2: const TInt KCdmaMaxLocationStorageSize=256; williamr@2: williamr@2: typedef TBuf8 TCdmaSmsStorageLocation; williamr@2: williamr@2: williamr@2: // CDMA SMS PROT public constants end williamr@2: williamr@2: /** williamr@2: Sockets for CDMA SMS messages must be bound to an address. The 'address' williamr@2: provides a rule that tells the CDMA SMS stack which received messages should williamr@2: be given to the socket; see TCdmaSmsAddr for a more detailed explanation. williamr@2: williamr@2: Each address must belong to a family. The family must be one of the values williamr@2: listed below. williamr@2: */ williamr@2: enum TCdmaSmsAddrFamily williamr@2: { williamr@2: // as in GSMU williamr@2: /** This indicates that the address's family has not been set williamr@2: */ williamr@2: ECdmaSmsAddrUnbound=ESmsAddrUnbound, williamr@2: /** Sockets bound to a ECdmaSmsAddrSendOnly address can only be for williamr@2: sending CDMA SMS messages; they will not receive any messages until they williamr@2: are bound to a different address. williamr@2: williamr@2: Note that a socket bound to any address family except for williamr@2: ECdmaSmsAddrLocalOperation can be used to send messages; not just williamr@2: ECdmaSmsAddrSendOnly williamr@2: */ williamr@2: ECdmaSmsAddrSendOnly=ESmsAddrSendOnly, williamr@2: /** Sockets bound to a ECdmaSmsAddrLocalOperation address can only be used williamr@2: for local protocol operations such as enumerating, writing and deleting williamr@2: messages. These sockets cannot be used for sending or receiving messages williamr@2: until they are bound to a different address. williamr@2: williamr@2: Any socket kind of binded address and be used for writing and deleting messages. williamr@2: Only LocalOperation can be used for enumerating messages. williamr@2: */ williamr@2: ECdmaSmsAddrLocalOperation=ESmsAddrLocalOperation, williamr@2: /** williamr@2: Sockets bound to a ECdmaSmsWemtAddrMatchIEI address will receive messages williamr@2: on the WEMT teleservice that have a particular Information Element williamr@2: Identifier (IEI). williamr@2: williamr@2: As well as setting the address's family to ECdmaSmsWemtAddrMatchIEI, set williamr@2: the address's 'port'to one of the IEIs in TSmsInformationElementIdentifier; williamr@2: see CSmsInformationElement.. williamr@2: williamr@2: The following example binds a socket so that it will receive messages on williamr@2: the WEMT teleservice that have the IEI "Special SMS Message Indication": williamr@2: williamr@2: @code williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsWemtAddrMatchIEI); williamr@2: smsaddr.SetPort(CSmsInformationElement::ESmsIEISpecialSMSMessageIndication); williamr@2: ret=socket.Bind(smsaddr); williamr@2: @endcode williamr@2: */ williamr@2: ECdmaSmsWemtAddrMatchIEI=ESmsAddrMatchIEI, williamr@2: /** williamr@2: Sockets bound to a ECdmaSmsAddrMatchText address will receive messages williamr@2: whose user data matches contains particular text. The messages williamr@2: teleservice does not matter. williamr@2: williamr@2: As well as setting the address's family to ECdmaSmsAddrMatchText, use williamr@2: TCdmaSmsAddr::SetTextMatch to specify an ASCII string. This string is williamr@2: compared to the user data in the message. If the two match then the williamr@2: message is delivered to the socket. The string can contain the wildcards williamr@2: '?' to match one instance of any character and '*' to match any number of williamr@2: characters. williamr@2: williamr@2: @code williamr@2: // match messages that start with 12345 williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrMatchText); williamr@2: smsaddr.SetTextMatch(_L8("12345")); williamr@2: ret=socketMatchText.Bind(smsaddr); williamr@2: williamr@2: // match messages that end with 12345 williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrMatchText); williamr@2: smsaddr.SetTextMatch(_L8("*12345")); williamr@2: ret=socketMatchText.Bind(smsaddr); williamr@2: williamr@2: // match message that contain 12345 williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrMatchText); williamr@2: smsaddr.SetTextMatch(_L8("*12345*")); williamr@2: ret=socketMatchText.Bind(smsaddr); williamr@2: @endcode williamr@2: */ williamr@2: ECdmaSmsAddrMatchText=ESmsAddrMatchText, williamr@2: /** williamr@2: Sockets bound to a ECdmaSmsWemtAddrApplication8BitPort address will williamr@2: receive messages on the WEMT teleservice that are from a particular 8 bit williamr@2: application port. williamr@2: williamr@2: As well as setting the address's family to ECdmaSmsWemtAddrMatchIEI, set williamr@2: the address's 'port' to an 8-bit number. williamr@2: williamr@2: The following example binds a socket so that it will receive messages on williamr@2: the WEMT teleservice that are on the port 83: williamr@2: williamr@2: @code williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsWemtAddrApplication8BitPort); williamr@2: smsaddr.SetPort(83); williamr@2: ret=socket.Bind(smsaddr); williamr@2: @endcode williamr@2: */ williamr@2: ECdmaSmsWemtAddrApplication8BitPort=ESmsAddrApplication8BitPort, williamr@2: /** williamr@2: This is similar to ECdmaSmsWemtAddrApplication8BitPort, except that the williamr@2: WEMT message must be from a particular 16 bit application port. The williamr@2: address's port must be set to a 16-bit number. For example: williamr@2: williamr@2: @code williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsWemtAddrApplication16BitPort); williamr@2: smsaddr.SetPort(1000); williamr@2: ret=socket.Bind(smsaddr); williamr@2: @endcode williamr@2: */ williamr@2: ECdmaSmsWemtAddrApplication16BitPort=ESmsAddrApplication16BitPort, williamr@2: williamr@2: // new values williamr@2: williamr@2: /** williamr@2: Sockets bound to a ECdmaSmsAddrTeleservice address will receive messages williamr@2: on a particular teleservice. williamr@2: williamr@2: As well as setting the address's family to ECdmaSmsAddrTeleservice, use williamr@2: TCdmaSmsAddr::SetTeleserviceId to set the required teleservice. For williamr@2: example, to receive messages on the WEMT teleservice: williamr@2: williamr@2: @code williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrTeleservice); williamr@2: smsaddr.SetTeleserviceId(KTeleserviceWEMT); williamr@2: ret=socket.Bind(smsaddr); williamr@2: @endcode williamr@2: */ williamr@2: ECdmaSmsAddrTeleservice =10, williamr@2: /** williamr@2: Sockets bound to a ECdmaSmsWemtAddrWdp address will receive messages on williamr@2: the WAP teleservice that are for a particular WDP port. williamr@2: williamr@2: As well as setting the address's family to ECdmaSmsWemtAddrWdp, set the williamr@2: address's 'port' to a WDP port. For example: williamr@2: williamr@2: @code williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrWdp); williamr@2: smsaddr.SetPort(wdpPort); williamr@2: ret=socket.Bind(smsaddr); williamr@2: @endcode williamr@2: */ williamr@2: ECdmaSmsAddrWdp =11, williamr@2: /** williamr@2: Sockets bound to a ECdmaSmsAddrBroadcast address will receive broadcast williamr@2: messages. Note that broadcast messages cannot be received using other williamr@2: address family. williamr@2: williamr@2: Broadcast messages belong to a service category. A socket can williamr@2: be bound so that it receives broadcast messages from a specified service williamr@2: category. Alternatively it can receive all broadcast messages, whatever williamr@2: the service category. williamr@2: williamr@2: As well as setting the address's family to ECdmaSmsAddrBroadcast, use williamr@2: TCdmaSmsAddr::SetPort to set the required service category from those in williamr@2: tia637::TServiceCategory. williamr@2: williamr@2: @code williamr@2: // Receive messages from the Emergency Broadcast service catagory williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrBroadcast); williamr@2: smsaddr.SetPort(KEmergencyBroadcasts); williamr@2: ret=broadcastSocket.Bind(smsaddr); williamr@2: williamr@2: // Receive messages from any service category by setting the port to zero williamr@2: smsaddr.SetCdmaSmsAddrFamily(ECdmaSmsAddrBroadcast); williamr@2: smsaddr.SetPort(0); williamr@2: ret=broadcastSocket2.Bind(smsaddr); williamr@2: @endcode williamr@2: */ williamr@2: ECdmaSmsAddrBroadcast=12 williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: Sockets for CDMA SMS messages must be bound to an address. A williamr@2: socket's address can be thought of as a rule that tells the sockets server williamr@2: which messages should be delivered to the socket. When the CDMA SMS stack williamr@2: receives a message, it compares the message to the address (or rule) of each williamr@2: of the CDMA SMS sockets. If the message's contents match one of the rules, williamr@2: the SMS stack uses Symbian OS's sockets server to pass the message to an williamr@2: appropriate socket. williamr@2: williamr@2: The address is an instance of TCdmaSmsAddr. Create an instance then use its williamr@2: setter methods to configure up the address. Before receiving SMS messages, williamr@2: RSocket::Bind must be called to bind a socket to a appropriate address. williamr@2: williamr@2: Each address must belong to a family. This broadly defines the type of rule williamr@2: used to match messages to socket. Set an address's family with williamr@2: SetCdmaSmsAddrFamily. Depending upon the family, call methods to set further williamr@2: address variables, thus refining the rule further. To understand address williamr@2: better, see the descriptions of the address families in TCdmaSmsAddrFamily. williamr@2: williamr@2: Two sockets cannot be bound to the same address - the second attempt to bind a williamr@2: socket will fail. williamr@2: williamr@2: Sometimes, a message is received matches several addresses, and so could williamr@2: be sent to more than one socket. The messages are compared to address in a williamr@2: particular order; see CdmaSmsAddressPriority below for more information. williamr@2: */ williamr@2: class TCdmaSmsAddr : public TSockAddr williamr@2: { williamr@2: public: williamr@2: /** Maximum length of the text pattern used to match the incoming text. */ williamr@2: enum { EMaxTextMatchLength = 24 }; williamr@2: public: williamr@2: IMPORT_C TCdmaSmsAddr(); williamr@2: IMPORT_C TCdmaSmsAddrFamily CdmaSmsAddrFamily() const; williamr@2: IMPORT_C void SetCdmaSmsAddrFamily(TCdmaSmsAddrFamily aFamily); williamr@2: IMPORT_C TPtrC8 TextMatch() const; williamr@2: IMPORT_C void SetTextMatch(const TDesC8& aText); williamr@2: IMPORT_C TInt NumTextMatchChar() const; williamr@2: IMPORT_C TBool operator==(const TCdmaSmsAddr& aAddr) const; williamr@2: IMPORT_C TInt CdmaSmsAddressPriority()const; williamr@2: IMPORT_C tia637::TTeleserviceId TeleserviceId() const; williamr@2: IMPORT_C void SetTeleserviceId(tia637::TTeleserviceId aTeleserviceId); williamr@2: }; williamr@2: williamr@2: #endif //__CDMASMSADDR_H__