Class for handling Map27 Prefix/Ident/Address. More...
#include <Map27/Address.h>
Public Member Functions | |
Map27Address () | |
void | setPrefix (uint8_t prefix=MAP27_ADDRESS_DUMMYP) |
uint8_t | prefix () const |
void | setIdent (uint16_t ident=MAP27_ADDRESS_DUMMYI) |
uint16_t | ident () const |
void | setAddress (uint8_t adesc=MAP27_ADDRESS_ADESC_NO_ADDRESS, uint8_t *address=0, uint8_t alen=0) |
uint8_t | adesc () const |
uint8_t | alen () const |
const uint8_t * | address () const |
uint8_t | decodeBasic (uint8_t *buf, uint16_t bufLen) |
uint8_t | decode (uint8_t *buf, uint16_t bufLen) |
uint8_t | encodeBasic (uint8_t *buf, uint16_t bufLen) const |
uint8_t | encode (uint8_t *buf, uint16_t bufLen) const |
uint16_t | mpt1343_prefix () const |
uint16_t | mpt1343_fin (uint16_t ibi) const |
uint16_t | mpt1343_un3d (uint16_t ibi) const |
uint16_t | mpt1343_un2d (uint16_t ibi) const |
const char * | asString () |
Class for handling Map27 Prefix/Ident/Address.
This class provides methods to hold and encapsulate Map27 Prefix, Ident and optional extra Address representations, as well as functions for encoding and decoding them into on-the-wire message formats.
A Map27Address always has a MPT1327 Prefix and Ident. It can also have an optional Address which can be used for specifying PABX number etc.
Some Map27 messages only contain the Prefix and Ident and no Address. We call these 'Basic' and there are separate methods for encoding and decoding them, which ignore the Address component.
Map27Address::Map27Address | ( | ) |
Constructor. Prefix defaults to MAP27_ADDRESS_DUMMYP. Ident defaults to MAP27_ADDRESS_DUMMYI. Address defaults to MAP27_ADDRESS_NO_ADDRESS.
const uint8_t * Map27Address::address | ( | ) | const |
uint8_t Map27Address::adesc | ( | ) | const |
Get the current Address type
uint8_t Map27Address::alen | ( | ) | const |
const char * Map27Address::asString | ( | ) |
Formats the address as a string and returns a pointer to temporary storage containing the string
uint8_t Map27Address::decode | ( | uint8_t * | buf, |
uint16_t | bufLen | ||
) |
Decode Prefix, Ident amnd Address from on-the-wire format.
[in] | buf | Pointer to the buffer containing the on-the-wire encoded Prefix, Ident and Address |
[in] | bufLen | Length of buf in bytes |
uint8_t Map27Address::decodeBasic | ( | uint8_t * | buf, |
uint16_t | bufLen | ||
) |
Decode Prefix and Ident (but not Address) from on-the-wire format. Sets the internal Prefix and Ident. Sets the address type to MAP27_ADDRESS_DESC_NO_ADDRESS and the Address length to 0
[in] | buf | Pointer to the buffer containing the on-the-wire encoded Prefix and Ident |
[in] | bufLen | Length of buf in bytes |
uint8_t Map27Address::encode | ( | uint8_t * | buf, |
uint16_t | bufLen | ||
) | const |
Encode Prefix, Ident and Address in on-the-wire format to a buffer
[in] | buf | The buffer where the encoded data is to be written |
[in] | bufLen | Length of available spacec in buf in bytes |
uint8_t Map27Address::encodeBasic | ( | uint8_t * | buf, |
uint16_t | bufLen | ||
) | const |
Encode Prefix and Ident (but not Address) in on-the-wire format to a buffer
[in] | buf | The buffer where the encoded data is to be written |
[in] | bufLen | Length of available spacec in buf in bytes |
uint16_t Map27Address::ident | ( | ) | const |
Get the current MPT1327 Unit Ident (UI) return The current MPT1327 Unit Ident (UI)
uint16_t Map27Address::mpt1343_fin | ( | uint16_t | ibi | ) | const |
Convert the given Individual Base Ident to Fleet Individual Number
[in] | ibi | MPT1327 Individual Base Ident |
uint16_t Map27Address::mpt1343_prefix | ( | ) | const |
Get the current prefix in MPT1343 form
uint16_t Map27Address::mpt1343_un2d | ( | uint16_t | ibi | ) | const |
Convert the current MPT1327 Ident and IBI to MPT1343 Unit Number 2 Digit (UN2D)
[in] | ibi | MPT1327 Individual Base Ident |
uint16_t Map27Address::mpt1343_un3d | ( | uint16_t | ibi | ) | const |
Convert the current MPT1327 Ident and IBI to MPT1343 Unit Number 3 Digit (UN3D)
[in] | ibi | MPT1327 Individual Base Ident |
uint8_t Map27Address::prefix | ( | ) | const |
void Map27Address::setAddress | ( | uint8_t | adesc = MAP27_ADDRESS_ADESC_NO_ADDRESS , |
uint8_t * | address = 0 , |
||
uint8_t | alen = 0 |
||
) |
Set the current optional Address An address includes the addres type (adesc), an a number of bytes of address information Map27Address takes care of the encoding of the Address in message rypes that require it
[in] | adesc | Address type. One of MAP27_ADDRESS_ADESC_* |
[in] | address | Array of encoded address bytes. |
[in] | alen | Number of bytes in address |
void Map27Address::setIdent | ( | uint16_t | ident = MAP27_ADDRESS_DUMMYI | ) |
void Map27Address::setPrefix | ( | uint8_t | prefix = MAP27_ADDRESS_DUMMYP | ) |