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

RecordWifiConf Class Reference

Specialize the RecordMimeType to store Wifi configuration information. More...

#include <RecordWifiConf.h>

Inherits NDefLib::RecordMimeType.

Public Types

enum  authType_t { AUTH_OPEN = 0x0000 }
 

Authentication required by the wifi network.

More...
enum  encryptionType_t {
  ENC_TYPE_NONE = 0x0001, ENC_TYPE_WEP = 0x0002, ENC_TYPE_TKIP = 0x0004, ENC_TYPE_AES = 0x0008,
  ENC_TYPE_AES_TKIP = 0x000c
}
 

Encryption used by the network.

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

 RecordWifiConf (const std::string &ssid, const std::string &pass="", authType_t authType=AUTH_OPEN, encryptionType_t encType=ENC_TYPE_NONE)
 Create a record with the wifi configuration, the default parameters create an open network.
virtual RecordType_t get_type () const
 Get the record type.
virtual uint16_t get_byte_length ()
virtual uint16_t write (uint8_t *buffer)
 Update the content and write it on the buffer.
bool operator== (const RecordWifiConf &other)
 Compare two objects.
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.
const std::string & get_mime_type () const
 Return the mime type of the content.
void set_mime_data_pointer (uint8_t *data, uint32_t dataLength)
 Change the data pointer used by this record.
void copy_mime_data (const uint8_t *data, uint32_t dataLength)
 Change the data linked with this record, with this function the data are copied inside the object.
uint32_t get_mime_data_lenght () const
uint8_t const * get_mime_data () const
bool operator== (const RecordMimeType &other) const
 Compare two objects.

Static Public Member Functions

static RecordWifiConfparse (const RecordHeader &header, const uint8_t *buffer)
 Create a RecordWifiConf reading the data from the buffer.

Detailed Description

Specialize the RecordMimeType to store Wifi configuration information.

Definition at line 47 of file RecordWifiConf.h.


Member Enumeration Documentation

enum authType_t

Authentication required by the wifi network.

Enumerator:
AUTH_OPEN 

no authentication

Definition at line 53 of file RecordWifiConf.h.

Encryption used by the network.

Enumerator:
ENC_TYPE_NONE 

no authentication

ENC_TYPE_WEP 

wep is deprecated

ENC_TYPE_TKIP 

deprecated -> only with mixed mode (0x000c)

ENC_TYPE_AES 

includes CCMP and GCMP

ENC_TYPE_AES_TKIP 

mixed mode

Definition at line 64 of file RecordWifiConf.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

RecordWifiConf ( const std::string &  ssid,
const std::string &  pass = "",
authType_t  authType = AUTH_OPEN,
encryptionType_t  encType = ENC_TYPE_NONE 
)

Create a record with the wifi configuration, the default parameters create an open network.

Parameters:
ssidnetwork name
passnetwork password
authTypeauthentication used in the network
encTypeencryption used in the network

Definition at line 51 of file RecordWifiConf.cpp.


Member Function Documentation

void copy_mime_data ( const uint8_t *  data,
uint32_t  dataLength 
) [inherited]

Change the data linked with this record, with this function the data are copied inside the object.

Parameters:
dataPointer to the data buffer.
dataLengthNumber of bytes to write.

Definition at line 105 of file RecordMimeType.cpp.

virtual uint16_t get_byte_length (  ) [virtual]
Returns:
update the record content and return the number of bytes needed to store this record

Reimplemented from Record.

Definition at line 105 of file RecordWifiConf.h.

const RecordHeader& get_header (  ) const [inherited]

Get the record header.

Returns:
record header

Definition at line 132 of file Record.h.

uint8_t const* get_mime_data (  ) const [inherited]
Returns:
pointer to the content data
DO NOT free this pointer, it is managed by the class.

Definition at line 124 of file RecordMimeType.h.

uint32_t get_mime_data_lenght (  ) const [inherited]
Returns:
number of bytes used to store the content data

Definition at line 116 of file RecordMimeType.h.

const std::string& get_mime_type (  ) const [inherited]

Return the mime type of the content.

Returns:
the mime type of the content.

Definition at line 87 of file RecordMimeType.h.

virtual RecordType_t get_type (  ) const [virtual]

Get the record type.

Returns:
TYPE_WIFI_CONF

Reimplemented from RecordMimeType.

Definition at line 97 of file RecordWifiConf.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 RecordWifiConf other )

Compare two objects.

Returns:
true if the records have the same Vcard information

Definition at line 125 of file RecordWifiConf.h.

bool operator== ( const RecordMimeType other ) const [inherited]

Compare two objects.

Returns:
true if the 2 records have the same mime type, length and data.

Definition at line 150 of file RecordMimeType.h.

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

Create a RecordWifiConf reading the data from the buffer.

Parameters:
headerRecord header.
bufferBuffer to read the data from.
Returns:
an object of type RecordVCard or NULL
User is in charge of freeing the pointer returned by this function.

Reimplemented from RecordMimeType.

Definition at line 154 of file RecordWifiConf.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_mime_data_pointer ( uint8_t *  data,
uint32_t  dataLength 
) [inherited]

Change the data pointer used by this record.

Parameters:
dataPointer used by this record.
dataLengthNumber of byte to write in this record.
The buffer is not copied or freed by this class.
With this function only the data pointer is copied, so it must not be freed before the object is deallocated.

Definition at line 98 of file RecordMimeType.h.

virtual uint16_t write ( uint8_t *  buffer ) [virtual]

Update the content and write it on the buffer.

Parameters:
[out]bufferbuffer to write the record content into.
Returns:
number of bytes written
See also:
Record::write

Reimplemented from RecordMimeType.

Definition at line 116 of file RecordWifiConf.h.