mirror of
https://github.com/thelsing/knx.git
synced 2025-01-07 00:05:47 +01:00
add dptconvert code from knxd
This commit is contained in:
parent
5b31b24337
commit
d58483530d
@ -4,7 +4,7 @@
|
|||||||
cmake_minimum_required(VERSION 2.7)
|
cmake_minimum_required(VERSION 2.7)
|
||||||
project(knx-linux)
|
project(knx-linux)
|
||||||
set(LIBRARIES_FROM_REFERENCES "")
|
set(LIBRARIES_FROM_REFERENCES "")
|
||||||
add_executable(knx-linux ../src/knx/address_table_object.cpp ../src/knx/apdu.cpp ../src/knx/application_layer.cpp ../src/knx/application_program_object.cpp ../src/knx/association_table_object.cpp ../src/knx/bau.cpp ../src/knx/bau07B0.cpp ../src/knx/bau57B0.cpp ../src/knx/bau_systemB.cpp ../src/knx/bits.cpp ../src/knx/cemi_frame.cpp ../src/knx/data_link_layer.cpp ../src/knx/datapoint_types.cpp ../src/knx/device_object.cpp ../src/knx/group_object.cpp ../src/knx/group_object_table_object.cpp ../src/knx/interface_object.cpp ../src/knx/ip_data_link_layer.cpp ../src/knx/ip_parameter_object.cpp ../src/knx/memory.cpp ../src/knx/network_layer.cpp ../src/knx/npdu.cpp ../src/knx/table_object.cpp ../src/knx/tpdu.cpp ../src/knx/tpuart_data_link_layer.cpp ../src/knx/transport_layer.cpp ../src/knx/platform.cpp main.cpp ../src/linux_platform.cpp ../src/knx_facade.cpp)
|
add_executable(knx-linux ../src/knx/address_table_object.cpp ../src/knx/apdu.cpp ../src/knx/application_layer.cpp ../src/knx/application_program_object.cpp ../src/knx/association_table_object.cpp ../src/knx/bau.cpp ../src/knx/bau07B0.cpp ../src/knx/bau57B0.cpp ../src/knx/bau_systemB.cpp ../src/knx/bits.cpp ../src/knx/cemi_frame.cpp ../src/knx/data_link_layer.cpp ../src/knx/datapoint_types.cpp ../src/knx/device_object.cpp ../src/knx/group_object.cpp ../src/knx/group_object_table_object.cpp ../src/knx/interface_object.cpp ../src/knx/ip_data_link_layer.cpp ../src/knx/ip_parameter_object.cpp ../src/knx/memory.cpp ../src/knx/network_layer.cpp ../src/knx/npdu.cpp ../src/knx/table_object.cpp ../src/knx/tpdu.cpp ../src/knx/tpuart_data_link_layer.cpp ../src/knx/transport_layer.cpp ../src/knx/platform.cpp main.cpp ../src/linux_platform.cpp ../src/knx_facade.cpp ../src/knx/dptconvert.cpp)
|
||||||
target_link_libraries(knx-linux "${LIBRARIES_FROM_REFERENCES}")
|
target_link_libraries(knx-linux "${LIBRARIES_FROM_REFERENCES}")
|
||||||
include_directories(../src)
|
include_directories(../src)
|
||||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -Wno-switch -g -O0")
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wno-unknown-pragmas -Wno-switch -g -O0")
|
||||||
|
@ -85,6 +85,7 @@
|
|||||||
<ClInclude Include="..\src\knx\datapoint_types.h" />
|
<ClInclude Include="..\src\knx\datapoint_types.h" />
|
||||||
<ClInclude Include="..\src\knx\data_link_layer.h" />
|
<ClInclude Include="..\src\knx\data_link_layer.h" />
|
||||||
<ClInclude Include="..\src\knx\device_object.h" />
|
<ClInclude Include="..\src\knx\device_object.h" />
|
||||||
|
<ClInclude Include="..\src\knx\dptconvert.h" />
|
||||||
<ClInclude Include="..\src\knx\group_object.h" />
|
<ClInclude Include="..\src\knx\group_object.h" />
|
||||||
<ClInclude Include="..\src\knx\group_object_table_object.h" />
|
<ClInclude Include="..\src\knx\group_object_table_object.h" />
|
||||||
<ClInclude Include="..\src\knx\interface_object.h" />
|
<ClInclude Include="..\src\knx\interface_object.h" />
|
||||||
@ -128,6 +129,7 @@
|
|||||||
<ClCompile Include="..\src\knx\datapoint_types.cpp" />
|
<ClCompile Include="..\src\knx\datapoint_types.cpp" />
|
||||||
<ClCompile Include="..\src\knx\data_link_layer.cpp" />
|
<ClCompile Include="..\src\knx\data_link_layer.cpp" />
|
||||||
<ClCompile Include="..\src\knx\device_object.cpp" />
|
<ClCompile Include="..\src\knx\device_object.cpp" />
|
||||||
|
<ClCompile Include="..\src\knx\dptconvert.cpp" />
|
||||||
<ClCompile Include="..\src\knx\group_object.cpp" />
|
<ClCompile Include="..\src\knx\group_object.cpp" />
|
||||||
<ClCompile Include="..\src\knx\group_object_table_object.cpp" />
|
<ClCompile Include="..\src\knx\group_object_table_object.cpp" />
|
||||||
<ClCompile Include="..\src\knx\interface_object.cpp" />
|
<ClCompile Include="..\src\knx\interface_object.cpp" />
|
||||||
|
@ -135,6 +135,9 @@
|
|||||||
<ClInclude Include="..\src\knx.h">
|
<ClInclude Include="..\src\knx.h">
|
||||||
<Filter>Header files</Filter>
|
<Filter>Header files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\src\knx\dptconvert.h">
|
||||||
|
<Filter>Header files\knx</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\src\knx\address_table_object.cpp">
|
<ClCompile Include="..\src\knx\address_table_object.cpp">
|
||||||
@ -227,5 +230,8 @@
|
|||||||
<ClCompile Include="..\src\knx_facade.cpp">
|
<ClCompile Include="..\src\knx_facade.cpp">
|
||||||
<Filter>Source files</Filter>
|
<Filter>Source files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\knx\dptconvert.cpp">
|
||||||
|
<Filter>Source files\knx</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -30,7 +30,6 @@ void measureTemp()
|
|||||||
currentValue = (r * 1.0) / (RAND_MAX * 1.0);
|
currentValue = (r * 1.0) / (RAND_MAX * 1.0);
|
||||||
currentValue *= 100 * 100;
|
currentValue *= 100 * 100;
|
||||||
|
|
||||||
|
|
||||||
CURR.objectWrite(currentValue);
|
CURR.objectWrite(currentValue);
|
||||||
|
|
||||||
if (currentValue > maxValue)
|
if (currentValue > maxValue)
|
||||||
|
1801
src/knx/dptconvert.cpp
Normal file
1801
src/knx/dptconvert.cpp
Normal file
File diff suppressed because it is too large
Load Diff
180
src/knx/dptconvert.h
Normal file
180
src/knx/dptconvert.h
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
/*
|
||||||
|
KNX client library - internals
|
||||||
|
Copyright (C) 2005-2011 Martin Koegler <mkoegler@auto.tuwien.ac.at>
|
||||||
|
Copyright (C) 2014 Patrik Pfaffenbauer <patrik.pfaffenbauer@p3.co.at>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
In addition to the permissions in the GNU General Public License,
|
||||||
|
you may link the compiled version of this file into combinations
|
||||||
|
with other programs, and distribute those combinations without any
|
||||||
|
restriction coming from the use of this file. (The General Public
|
||||||
|
License restrictions do apply in other respects; for example, they
|
||||||
|
cover modification of the file, and distribution when not linked into
|
||||||
|
a combine executable.)
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
|
class KNXDatatype
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
KNXDatatype(short mainGroup, short subGroup, short index)
|
||||||
|
{
|
||||||
|
this->mainGroup = mainGroup;
|
||||||
|
this->subGroup = subGroup;
|
||||||
|
this->index = index;
|
||||||
|
}
|
||||||
|
unsigned short mainGroup;
|
||||||
|
unsigned short subGroup;
|
||||||
|
unsigned short index;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t bValue;
|
||||||
|
uint8_t cValue;
|
||||||
|
uint16_t sValue;
|
||||||
|
uint32_t iValue;
|
||||||
|
uint64_t uiValue;
|
||||||
|
double dValue;
|
||||||
|
char *strValue;
|
||||||
|
struct tm tValue;
|
||||||
|
} KNXValue;
|
||||||
|
|
||||||
|
#define KNX_ASSUME_KNX_VALUE(x, y) \
|
||||||
|
x.bValue = (unsigned char)y; \
|
||||||
|
x.iValue = (uint32_t)y; \
|
||||||
|
x.cValue = (unsigned char)y; \
|
||||||
|
x.sValue = (unsigned short)y; \
|
||||||
|
x.uiValue = (uint64_t)y; \
|
||||||
|
x.dValue = (double)y;
|
||||||
|
#define KNX_ASSUME_STR_VALUE(value, y) \
|
||||||
|
value.strValue = (char *)malloc(strlen(y)); \
|
||||||
|
strncpy(value.strValue, y, strlen(y));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the KNX Payload given by the specific DPT and puts the value in the KNXValue struc
|
||||||
|
*/
|
||||||
|
int KNX_Decode_Value(uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts the KNXValue struct to the KNX Payload as the specific DPT
|
||||||
|
*/
|
||||||
|
int KNX_Encode_Value(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
|
||||||
|
//KNX to internal
|
||||||
|
int busValueToBinary(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToBinaryControl(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToStepControl(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToCharacter(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToUnsigned8(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToSigned8(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToStatusAndMode(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToUnsigned16(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToTimePeriod(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToSigned16(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToTimeDelta(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToFloat16(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToTime(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToDate(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToUnsigned32(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToSigned32(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToLongTimePeriod(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToFloat32(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToAccess(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToString(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToScene(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToSceneControl(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToSceneInfo(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToSceneConfig(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToDateTime(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToUnicode(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToSigned64(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToAlarmInfo(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToSerialNumber(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToVersion(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToScaling(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToTariff(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToLocale(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToRGB(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToFlaggedScaling(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
int busValueToActiveEnergy(const uint8_t *payload, int payload_length, const KNXDatatype& datatype, KNXValue& value);
|
||||||
|
|
||||||
|
//Internal to KNX
|
||||||
|
int valueToBusValueBinary(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueBinaryControl(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueStepControl(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueCharacter(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueUnsigned8(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueSigned8(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueStatusAndMode(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueUnsigned16(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueTimePeriod(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueSigned16(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueTimeDelta(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueFloat16(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueTime(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueDate(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueUnsigned32(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueSigned32(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueLongTimePeriod(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueFloat32(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueAccess(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueString(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueScene(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueSceneControl(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueSceneInfo(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueSceneConfig(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueDateTime(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueUnicode(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueSigned64(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueAlarmInfo(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueSerialNumber(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueVersion(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueScaling(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueTariff(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueLocale(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueRGB(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueFlaggedScaling(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
int valueToBusValueActiveEnergy(KNXValue& value, uint8_t *payload, int payload_length, const KNXDatatype& datatype);
|
||||||
|
|
||||||
|
//Payload manipulation
|
||||||
|
int bitFromPayload(const uint8_t *payload, int index);
|
||||||
|
uint8_t unsigned8FromPayload(const uint8_t *payload, int index);
|
||||||
|
int8_t signed8FromPayload(const uint8_t *payload, int index);
|
||||||
|
uint16_t unsigned16FromPayload(const uint8_t *payload, int index);
|
||||||
|
int16_t signed16FromPayload(const uint8_t *payload, int index);
|
||||||
|
uint32_t unsigned32FromPayload(const uint8_t *payload, int index);
|
||||||
|
int32_t signed32FromPayload(const uint8_t *payload, int index);
|
||||||
|
double float16FromPayload(const uint8_t *payload, int index);
|
||||||
|
float float32FromPayload(const uint8_t *payload, int index);
|
||||||
|
int64_t signed64FromPayload(const uint8_t *payload, int index);
|
||||||
|
uint8_t bcdFromPayload(const uint8_t *payload, int index);
|
||||||
|
|
||||||
|
void bitToPayload(uint8_t *payload, int payload_length, int index, int value);
|
||||||
|
void unsigned8ToPayload(uint8_t *payload, int payload_length, int index, uint8_t value, uint8_t mask); //mask 0xFF
|
||||||
|
void signed8ToPayload(uint8_t *payload, int payload_length, int index, int8_t value, uint8_t mask); //mask 0xFF
|
||||||
|
void unsigned16ToPayload(uint8_t *payload, int payload_length, int index, uint16_t value, uint16_t mask); //mask 0xFFFF
|
||||||
|
void signed16ToPayload(uint8_t *payload, int payload_length, int index, int16_t value, uint16_t mask); //mask 0xFFFF
|
||||||
|
void unsigned32ToPayload(uint8_t *payload, int payload_length, int index, uint32_t value, uint32_t mask); //mask = 0xFFFFFFFF
|
||||||
|
void signed32ToPayload(uint8_t *payload, int payload_length, int index, int32_t value, uint32_t mask); //mask = 0xFFFFFFFF
|
||||||
|
void float16ToPayload(uint8_t *payload, int payload_length, int index, double value, uint16_t mask); //mask = 0xFFFF
|
||||||
|
void float32ToPayload(uint8_t *payload, int payload_length, int index, double value, uint32_t mask); //mask = 0xFFFFFFFF
|
||||||
|
void signed64ToPayload(uint8_t *payload, int payload_length, int index, int64_t value, uint64_t mask); //mask = UINT64_C(0xFFFFFFFFFFFFFFFF)
|
||||||
|
void bcdToPayload(uint8_t *payload, int payload_length, int index, uint8_t value);
|
@ -271,3 +271,23 @@ GroupObjectUpdatedHandler GroupObject::callback()
|
|||||||
{
|
{
|
||||||
return _updateHandler;
|
return _updateHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GroupObject::value(const KNXDatatype& type, KNXValue& value)
|
||||||
|
{
|
||||||
|
KNX_Encode_Value(value, _data, _dataLength, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KNXValue GroupObject::value(const KNXDatatype& type)
|
||||||
|
{
|
||||||
|
KNXValue value;
|
||||||
|
KNX_Decode_Value(_data, _dataLength, type, value);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GroupObject::tryValue(const KNXDatatype& type, KNXValue& value)
|
||||||
|
{
|
||||||
|
return KNX_Decode_Value(_data, _dataLength, type, value);
|
||||||
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "knx_types.h"
|
#include "knx_types.h"
|
||||||
|
#include "dptconvert.h"
|
||||||
|
|
||||||
class GroupObjectTableObject;
|
class GroupObjectTableObject;
|
||||||
|
|
||||||
@ -117,9 +117,14 @@ public:
|
|||||||
size_t sizeInTelegram();
|
size_t sizeInTelegram();
|
||||||
uint8_t* valueRef();
|
uint8_t* valueRef();
|
||||||
uint16_t asap();
|
uint16_t asap();
|
||||||
void callback(GroupObjectUpdatedHandler hanlder);
|
void callback(GroupObjectUpdatedHandler handler);
|
||||||
GroupObjectUpdatedHandler callback();
|
GroupObjectUpdatedHandler callback();
|
||||||
private:
|
|
||||||
|
KNXValue value(const KNXDatatype& type);
|
||||||
|
void value(const KNXDatatype& type, KNXValue& value);
|
||||||
|
bool tryValue(const KNXDatatype& type, KNXValue& value);
|
||||||
|
|
||||||
|
private:
|
||||||
GroupObjectUpdatedHandler _updateHandler;
|
GroupObjectUpdatedHandler _updateHandler;
|
||||||
size_t goSize();
|
size_t goSize();
|
||||||
uint16_t _asap;
|
uint16_t _asap;
|
||||||
|
Loading…
Reference in New Issue
Block a user