mirror of
https://github.com/thelsing/knx.git
synced 2026-02-23 13:50:35 +01:00
some progress with python wrapper
This commit is contained in:
@@ -13,6 +13,17 @@ GroupObject::GroupObject(uint8_t size)
|
||||
updateHandler = 0;
|
||||
}
|
||||
|
||||
GroupObject::GroupObject(const GroupObject& other)
|
||||
{
|
||||
_data = new uint8_t[other._dataLength];
|
||||
_commFlag = other._commFlag;
|
||||
_table = other._table;
|
||||
_dataLength = other._dataLength;
|
||||
_asap = other._asap;
|
||||
updateHandler = other.updateHandler;
|
||||
memcpy(_data, other._data, _dataLength);
|
||||
}
|
||||
|
||||
GroupObject::~GroupObject()
|
||||
{
|
||||
delete[] _data;
|
||||
|
||||
@@ -24,6 +24,7 @@ class GroupObject
|
||||
friend class GroupObjectTableObject;
|
||||
public:
|
||||
GroupObject(uint8_t size);
|
||||
GroupObject(const GroupObject& other);
|
||||
virtual ~GroupObject();
|
||||
// config flags from ETS
|
||||
bool responseUpdateEnable();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "knx/group_object_table_object.h"
|
||||
#include "knx/application_program_object.h"
|
||||
#include "knx/ip_parameter_object.h"
|
||||
#include "knx/bits.h"
|
||||
|
||||
#define MAX_MEM 4096
|
||||
|
||||
@@ -129,8 +130,8 @@ void LinuxPlatform::setupMultiCast(uint32_t addr, uint16_t port)
|
||||
fatalError();
|
||||
}
|
||||
|
||||
/* Broadcast auf dieser Maschine zulassen */
|
||||
loop = 1;
|
||||
/* loopback */
|
||||
loop = 0;
|
||||
if (setsockopt(_socketFd, IPPROTO_IP, IP_MULTICAST_LOOP, &loop, sizeof(loop)) < 0)
|
||||
{
|
||||
perror("setsockopt:IP_MULTICAST_LOOP");
|
||||
@@ -184,6 +185,7 @@ bool LinuxPlatform::sendBytes(uint8_t* buffer, uint16_t len)
|
||||
return false;
|
||||
}
|
||||
} while (retVal == -1);
|
||||
// printHex("<-", buffer, len);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -194,6 +196,9 @@ int LinuxPlatform::readBytes(uint8_t * buffer, uint16_t maxLen)
|
||||
|
||||
sin_len = sizeof(sin);
|
||||
ssize_t len = recvfrom(_socketFd, buffer, maxLen, 0, (struct sockaddr *) &sin, &sin_len);
|
||||
// if (len > 0)
|
||||
// printHex("->", buffer, len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,37 +11,37 @@ public:
|
||||
LinuxPlatform();
|
||||
|
||||
// ip stuff
|
||||
uint32_t currentIpAddress();
|
||||
uint32_t currentSubnetMask();
|
||||
uint32_t currentDefaultGateway();
|
||||
void macAddress(uint8_t* addr);
|
||||
uint32_t currentIpAddress() override;
|
||||
uint32_t currentSubnetMask() override;
|
||||
uint32_t currentDefaultGateway() override;
|
||||
void macAddress(uint8_t* addr) override;
|
||||
|
||||
// basic stuff
|
||||
uint32_t millis();
|
||||
void mdelay(uint32_t millis);
|
||||
void restart();
|
||||
void fatalError();
|
||||
uint32_t millis() override;
|
||||
void mdelay(uint32_t millis) override;
|
||||
void restart() override;
|
||||
void fatalError() override;
|
||||
|
||||
//multicast
|
||||
void setupMultiCast(uint32_t addr, uint16_t port);
|
||||
void closeMultiCast();
|
||||
bool sendBytes(uint8_t* buffer, uint16_t len);
|
||||
int readBytes(uint8_t* buffer, uint16_t maxLen);
|
||||
void setupMultiCast(uint32_t addr, uint16_t port) override;
|
||||
void closeMultiCast() override;
|
||||
bool sendBytes(uint8_t* buffer, uint16_t len) override;
|
||||
int readBytes(uint8_t* buffer, uint16_t maxLen) override;
|
||||
|
||||
//uart
|
||||
void setupUart();
|
||||
void closeUart();
|
||||
int uartAvailable();
|
||||
size_t writeUart(const uint8_t data);
|
||||
size_t writeUart(const uint8_t *buffer, size_t size);
|
||||
int readUart();
|
||||
size_t readBytesUart(uint8_t *buffer, size_t length);
|
||||
void setupUart() override;
|
||||
void closeUart() override;
|
||||
int uartAvailable() override;
|
||||
size_t writeUart(const uint8_t data) override;
|
||||
size_t writeUart(const uint8_t *buffer, size_t size) override;
|
||||
int readUart() override;
|
||||
size_t readBytesUart(uint8_t *buffer, size_t length) override;
|
||||
|
||||
//memory
|
||||
uint8_t* getEepromBuffer(uint16_t size);
|
||||
void commitToEeprom();
|
||||
uint8_t* allocMemory(size_t size);
|
||||
void freeMemory(uint8_t* ptr);
|
||||
uint8_t* getEepromBuffer(uint16_t size) override;
|
||||
void commitToEeprom() override;
|
||||
uint8_t* allocMemory(size_t size) override;
|
||||
void freeMemory(uint8_t* ptr) override;
|
||||
private:
|
||||
uint32_t _multicastAddr;
|
||||
uint16_t _port;
|
||||
|
||||
Reference in New Issue
Block a user