knx/src/knx/address_table_object.h

58 lines
1.7 KiB
C++

#pragma once
#include "table_object.h"
/**
* This class represents the group address table. It provides a mapping between tranport layer
* service access points (TSAP) and group addresses. The TSAP can be imagined as an index to the array
* of group adresses.
*
* See section 4.10 of @cite knx:3/5/1 for further details.
* It implements realisation type 7 (see section 4.10.7 of @cite knx:3/5/1).
*/
class AddressTableObject : public TableObject
{
public:
/**
* The contructor.
*
* @param memory This parameter is only passed to the custructor of TableObject an not used by this class.
*/
AddressTableObject(Memory& memory);
const uint8_t* restore(const uint8_t* buffer) override;
/**
* returns the number of group addresses of the object.
*/
uint16_t entryCount();
/**
* Get the group address mapped to a TSAP.
*
* @param tsap The TSAP of which to get the group address for.
*
* @return the groupAddress if found or zero if no group address was found.
*/
uint16_t getGroupAddress(uint16_t tsap);
/**
* Get the TSAP mapped to a group address.
*
* @param groupAddress the group address of whicht to get the TSAP for.
*
* @return the TSAP if found or zero if no tsap was found.
*/
uint16_t getTsap(uint16_t groupAddress);
/**
* Check if the address table contains a group address.
*
* @param groupAddress the group address to check
*
* @return true if the address table contains the group address, false otherwise
*/
bool contains(uint16_t groupAddress);
protected:
virtual void beforeStateChange(LoadState& newState) override;
private:
uint16_t* _groupAddresses = 0;
};