03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

This puts it into an initial state, by calling Reset(), ready to accept requests to send<br />

packets. It also stores a pointer to the GDP packet handler. This will be used to inform the<br />

handler of a completed send operation.<br />

The state machine gets kicked into life every time the CGdpSmsComms::SendL() is called;<br />

this is the only point of contact with the GDP client in the whole process of sending.<br />

void CGdpSmsComms::SendL(const TDesC8& aAddress, const TDesC8&<br />

aData)<br />

{<br />

RDebug::Print(_L("CGdpSmsComms::SendL() Called."));<br />

__ASSERT_ALWAYS(iSender != NULL, GdpUtil::Fault<br />

(GdpUtil::EProtocolNotOpen));<br />

iSender->SendL(aAddress, aData);<br />

}<br />

This invokes the SendL() function within the sender class, which looks like this:<br />

void CGdpSmsSender::SendL(const TDesC8& aAddress, const TDesC8&<br />

aData)<br />

{<br />

if (IsActive())<br />

return; // Don't leave -- just quietly drop the<br />

overflow packet<br />

// Create the SMS message<br />

CSmsBuffer* smsBuffer = CSmsBuffer::NewL();<br />

iSmsMsg = CSmsMessage::NewL(iResMan.iFs, CSmsPDU::ESmsSubmit,<br />

smsBuffer);<br />

TSmsUserDataSettings smsSettings;<br />

smsSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabet7Bit);<br />

smsSettings.SetTextCompressed(EFalse);<br />

// Convert address to unicode string required by CSmsMessage<br />

__ASSERT_ALWAYS(aAddress.Length() SetUserDataSettingsL(smsSettings);<br />

iSmsMsg->SetToFromAddressL(bufAddress);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!