ST / NDefLib

Dependents:   NFC M2M_2016_STM32 MyongjiElec_capstone1 IDW01M1_Cloud_IBM ... more

Fork of NDefLib by ST Expansion SW Team

Embed: (wiki syntax)

« Back to documentation index

RecordSMS Class Reference

Extend the RecordUri to handle the SMS content. More...

#include <RecordSMS.h>

Inherits NDefLib::RecordURI.

Public Types

enum  knowUriId_t {
  UNKNOWN = 0X00, HTTP_WWW = 0X01, HTTPS_WWW = 0X02, HTTP = 0X03,
  HTTPS = 0X04, TEL = 0x05, MAIL = 0X06, FTP_ANONIMUS = 0X07,
  FTP_FTP = 0X08, FTPS = 0X09, SFTP = 0X0A, SMB = 0X0B,
  NFS = 0X0C, FTP = 0X0d, DAV = 0X0E, NEWS = 0X0F,
  TELNET = 0X10, IMAP = 0X11, RTSP = 0X12, URN = 0X13,
  POP = 0X14, SIP = 0X15, SIPS = 0X016, TFTP = 0X017,
  BTSPP = 0x018, BTL2CAP = 0x019, BTGOEP = 0X01A, TCPOBEX = 0X1B,
  IRDAOBEX = 0X1C, FILE = 0X1D, URN_EPC_ID = 0X1E, URN_EPC_TAG = 0X1F,
  URN_EPC_PAT = 0X20, URN_EPC_RAW = 0X21, URN_EPC = 0X22, URN_NFC = 0X23
}
 

If you want encode an know URI you can use this define to avoid to encode the URI type as string.

More...
enum  RecordType_t {
  TYPE_UNKNOWN, TYPE_TEXT, TYPE_AAR, TYPE_MIME,
  TYPE_URI, TYPE_URI_MAIL, TYPE_URI_SMS, TYPE_URI_GEOLOCATION,
  TYPE_MIME_VCARD, TYPE_WIFI_CONF
}
 

Enum used to identify the record type.

More...

Public Member Functions

 RecordSMS (const std::string &number, const std::string &message)
 Build a sms record.
virtual RecordType_t get_type () const
 Get the record type.
const std::string & get_number () const
 Get recipient number.
const std::string & get_messagge () const
 Get SMS text message.
void set_number (const std::string &number)
 Change the recipent number.
void set_message (const std::string &message)
 Change the message content.
bool operator== (const RecordSMS &other) const
 Compare 2 objects.
knowUriId_t get_uri_id () const
 Returns the URI type.
virtual uint16_t get_byte_length ()
 Number of bytes needed to store this record.
std::string & get_content ()
 Returns the URI content.
void set_content (const std::string &URI)
 Change the URI content.
void set_as_first_record ()
 Set the record as the first record in the message.
void set_as_last_record ()
 Set the record as the last record in the message.
bool is_last_record () const
 Check if it is the last record in the message.
bool is_first_record () const
 Check if it is the first record in the message.
void set_as_middle_record ()
 Set the record as generic (not the first one and not the last one)
bool is_middle_record () const
 Check if the record is in the middle of a chain.
const RecordHeaderget_header () const
 Get the record header.
virtual uint16_t write (uint8_t *buffer)=0
 Write the record content into a buffer.

Static Public Member Functions

static RecordSMSparse (const RecordHeader &header, const uint8_t *buffer)
 Read a recordSMS.

Protected Member Functions

virtual void update_content ()
 Generate the URI content that encodes the sms.

Detailed Description

Extend the RecordUri to handle the SMS content.

Definition at line 50 of file RecordSMS.h.


Member Enumeration Documentation

enum knowUriId_t [inherited]

If you want encode an know URI you can use this define to avoid to encode the URI type as string.

Enumerator:
UNKNOWN 

UNKNOWN.

HTTP_WWW 

HTTP_WWW.

HTTPS_WWW 

HTTPS_WWW.

HTTP 

HTTP.

HTTPS 

HTTPS.

TEL 

TEL.

MAIL 

MAIL.

FTP_ANONIMUS 

FTP_ANONIMUS.

FTP_FTP 

FTP_FTP.

FTPS 

FTPS.

SFTP 

SFTP.

SMB 

SMB.

NFS 

NFS.

FTP 

FTP.

DAV 

DAV.

NEWS 

NEWS.

TELNET 

TELNET.

IMAP 

IMAP.

RTSP 

RTSP.

URN 

URN.

POP 

POP.

SIP 

SIP.

SIPS 

SIPS.

TFTP 

TFTP.

BTSPP 

BTSPP.

BTL2CAP 

BTL2CAP.

BTGOEP 

BTGOEP.

TCPOBEX 

TCPOBEX.

IRDAOBEX 

IRDAOBEX.

FILE 

FILE.

URN_EPC_ID 

URN_EPC_ID.

URN_EPC_TAG 

URN_EPC_TAG.

URN_EPC_PAT 

URN_EPC_PAT.

URN_EPC_RAW 

URN_EPC_RAW.

URN_EPC 

URN_EPC.

URN_NFC 

URN_NFC.

Definition at line 67 of file RecordURI.h.

enum RecordType_t [inherited]

Enum used to identify the record type.

Enumerator:
TYPE_UNKNOWN 

UNKNOWN record.

TYPE_TEXT 

TEXT.

TYPE_AAR 

Android Archive record.

TYPE_MIME 

generic MIME type

TYPE_URI 

generic URI

TYPE_URI_MAIL 

Email URI record.

TYPE_URI_SMS 

SMS URI record.

TYPE_URI_GEOLOCATION 

position URI record

TYPE_MIME_VCARD 

VCard record.

TYPE_WIFI_CONF 

Wifi configuration.

Definition at line 56 of file Record.h.


Constructor & Destructor Documentation

RecordSMS ( const std::string &  number,
const std::string &  message 
)

Build a sms record.

Parameters:
numberSms recipient phone number.
messageMessage to send.
Strings are copied inside the class.

Definition at line 47 of file RecordSMS.cpp.


Member Function Documentation

virtual uint16_t get_byte_length (  ) [virtual, inherited]

Number of bytes needed to store this record.

Returns:
size of the header + size of the record content

Reimplemented from Record.

Definition at line 138 of file RecordURI.h.

std::string& get_content (  ) [inherited]

Returns the URI content.

Returns:
URI content

Definition at line 147 of file RecordURI.h.

const RecordHeader& get_header (  ) const [inherited]

Get the record header.

Returns:
record header

Definition at line 132 of file Record.h.

const std::string& get_messagge (  ) const

Get SMS text message.

Returns:
SMS text message

Definition at line 91 of file RecordSMS.h.

const std::string& get_number (  ) const

Get recipient number.

Returns:
recipient number

Definition at line 83 of file RecordSMS.h.

virtual RecordType_t get_type (  ) const [virtual]

Get the record type.

Returns:
TYPE_URI_SMS

Reimplemented from RecordURI.

Definition at line 75 of file RecordSMS.h.

knowUriId_t get_uri_id (  ) const [inherited]

Returns the URI type.

Returns:
URI type inside this record, UNKNOWN if unknown

Definition at line 134 of file RecordURI.h.

bool is_first_record (  ) const [inherited]

Check if it is the first record in the message.

Returns:
true if it is the fist record in the message

Definition at line 98 of file Record.h.

bool is_last_record (  ) const [inherited]

Check if it is the last record in the message.

Returns:
true if it is the last record in the message

Definition at line 90 of file Record.h.

bool is_middle_record (  ) const [inherited]

Check if the record is in the middle of a chain.

Returns:
true if is not the fist or the last one

Definition at line 114 of file Record.h.

bool operator== ( const RecordSMS other ) const

Compare 2 objects.

Returns:
true if the records have the same message and number.

Definition at line 117 of file RecordSMS.h.

RecordSMS * parse ( const RecordHeader header,
const uint8_t *  buffer 
) [static]

Read a recordSMS.

Parameters:
headerRecord header.
bufferBuffer to read the data from.
Returns:
a RecordSMS type or NULL if it was not possible to build this record
User is in charge of freeing the pointer returned by this function.

Reimplemented from RecordURI.

Definition at line 65 of file RecordSMS.cpp.

void set_as_first_record (  ) [inherited]

Set the record as the first record in the message.

Definition at line 75 of file Record.h.

void set_as_last_record (  ) [inherited]

Set the record as the last record in the message.

Definition at line 82 of file Record.h.

void set_as_middle_record (  ) [inherited]

Set the record as generic (not the first one and not the last one)

Definition at line 105 of file Record.h.

void set_content ( const std::string &  URI ) [inherited]

Change the URI content.

Parameters:
URInew URI content.

Definition at line 156 of file RecordURI.h.

void set_message ( const std::string &  message )

Change the message content.

Parameters:
messageNew message.

Definition at line 108 of file RecordSMS.h.

void set_number ( const std::string &  number )

Change the recipent number.

Parameters:
numberNew recipent number.

Definition at line 99 of file RecordSMS.h.

void update_content (  ) [protected, virtual]

Generate the URI content that encodes the sms.

See also:
RecordUri::updateContent

Definition at line 51 of file RecordSMS.cpp.

virtual uint16_t write ( uint8_t *  buffer ) [pure virtual, inherited]

Write the record content into a buffer.

Parameters:
[out]bufferbuffer to write the record content into, the buffer size must be almost Record#getByteLength bytes.
Returns:
number of written bytes

Implemented in EmptyRecord, RecordAAR, RecordMimeType, RecordText, RecordVCard, and RecordWifiConf.