SmsTransport

Since: BlackBerry 10.0.0

#include <bb/pim/message/SmsTransport>

To link against this class, add the following line to your .pro file: LIBS += -lbbpim

The SmsTransport class lets you perform operations on SMS messages from your apps.

You can use this class to register the port that's used to send SMS messages, send a message, and receive the result of the send operation.


Overview

Public Functions Index

SmsTransport (QObject *parent=0)
virtual ~SmsTransport ()
MessageBuilder *createMessageBuilder ()
voidregisterPort (unsigned int port)
voidregisterPort (unsigned int port, const QString &targetId)
SmsTransportSendResult::Typesend (unsigned int port, const Message &message)
SmsTransportSendResult::Typesend (unsigned int originatorPort, unsigned int destinationPort, const bb::pim::message::Message &message)
voidunregisterPort (unsigned int port, const QString &targetId)

Signals Index

voidmessageReceived (unsigned int originatorPort, unsigned int destinationPort, const bb::pim::message::Message &message)
voidmessageSendResultReceived (bb::pim::message::MessageKey msgId)
voidregisterResultReceived (unsigned int port, bb::pim::message::SmsTransportRegistrationResult::Type status)

Public Functions

SmsTransport (

Constructs a new SmsTransport.

Parameters
parent

The parent object. This parameter is optional.

Since:

BlackBerry 10.0.0

virtual~SmsTransport ()

Destructor.

Since:

BlackBerry 10.0.0

MessageBuilder * createMessageBuilder ()

Obtain a MessageBuilder that you can use to create a message.

Ownership of the returned object is transferred to the caller, which is responsible for deleting the object.

Return:

A MessageBuilder object.

Since:

BlackBerry 10.0.0

void registerPort (
  • unsigned intport)

Registers the specified port with the SmsTransport service.

You can make multiple calls to this function, one for each of the incoming port numbers that you want to listen to. The success or failure of this registration request will be reported to you via the registerResultReceived() signal.

Parameters
port

The port number to register.

Since:

BlackBerry 10.0.0

void registerPort (
  • unsigned intport,
  • const QString &targetId )

Registers the specified port and target ID with the SmsTransport service.

Registers the target to be invoked when an incoming SMS arrives for the specified port. The success or failure of this registration request will be reported to you via the registerResultReceived() signal.

Parameters
port

The port number to register.

targetId

The target identifier.

Since:

BlackBerry 10.2.0

SmsTransportSendResult::Type send (
  • unsigned intport,
  • const Message &message )

Sends the message to the specified destination port at the recipient address provided in the message.

This port does not have to be one registered for incoming messages. The ID field of the message will be updated, and can be used to associate a subsequent messageSendResultReceived() signal with this message. Message identifiers are unique within a single instance of SmsTransport.

Parameters
port

The destination port number associated with this message.

message

The message to send.

Return:

The send response.

Since:

BlackBerry 10.0.0

SmsTransportSendResult::Type send (

Sends the message to the specified destination port at the recipient address provided in the message, and the receiver will be passed the originator port number.

Neither the originator port or the destination port have to be one registered for incoming messages. The ID field of the message will be updated, and can be used to associate a subsequent messageSendResultReceived() signal with this message. Message identifiers are unique within a single instance of SmsTransport.

Parameters
originatorPort

The originator port number associated with this message.

destinationPort

The destination port number associated with this message.

message

The message to send.

Return:

The send response.

Since:

BlackBerry 10.1.0

void unregisterPort (
  • unsigned intport,
  • const QString &targetId )

Unregisters the specified port with the SmsTransport service.

Parameters
port

The port number to unregister.

targetId

The target identifier.

Since:

BlackBerry 10.2.0

Signals

void messageReceived (

Emitted when an SMS message arrives on the registered port.

The incoming message contains a single Attachment containing the incoming data.

Parameters
originatorPort

The originator port number associated with this message.

destinationPort

The destination port number associated with this message.

message

The received message.

Since:

BlackBerry 10.1.0

void messageSendResultReceived (
  • bb::pim::message::MessageKeymsgId)

Emitted when a send request for an SMS message has completed either successfully or with an error.

The transmission status can be retrieved from the message by calling Message::transmissionStatus().

Parameters
msgId

The identifier of the outgoing message.

Since:

BlackBerry 10.0.0

void registerResultReceived (

Emitted when the requested port registration has completed.

Parameters
port

The port number specified in the corresponding registerPort() call.

status

The status of the registration request.

Since:

BlackBerry 10.0.0

Last modified: 2014-03-13

comments powered by Disqus