#include <stdio.h>
#include <stdlib.h>
#define SERIAL_NUMBER_LENGTH (6)
#define ERROR_MESSAGE_LEN (128)
#define MAX_IND_ADDR (5)
#define MAX_ITEMS (5)
static void set_rf_domain_address(
int32_t ap);
static void prop_value_read(
int32_t sp);
static void prop_value_write(
int32_t sp);
static void read_prog_mode(
int32_t sp);
static void memory_read(
int32_t sp);
static void memory_write(
int32_t sp);
static void ind_addr_prog_mode_read(
int32_t sp);
static void ind_addr_prog_mode_write(
int32_t sp);
static void ind_addr_sn_read(
int32_t sp);
static void ind_addr_sn_write(
int32_t sp);
static void domain_addr_prog_mode_read(
int32_t sp);
static void domain_addr_prog_mode_write(
int32_t sp);
static void domain_addr_sn_read(
int32_t sp);
static void domain_addr_sn_write(
int32_t sp);
static void error_callback(
error_t e,
void* user_data);
static bool_t connection_oriented = 1;
int main(int argc, char* argv[])
{
ap = open_access_port();
{
while (1)
{
;
}
}
if (is_rf)
{
set_rf_domain_address(ap);
}
{
while (1)
{
;
}
}
prop_value_read(sp);
prop_value_write(sp);
if (is_rf)
{
domain_addr_sn_read(sp);
domain_addr_sn_write(sp);
}
ind_addr_sn_read(sp);
ind_addr_sn_write(sp);
switch_prog_mode(sp, 1);
read_prog_mode(sp);
if (is_rf)
{
domain_addr_prog_mode_read(sp);
domain_addr_prog_mode_write(sp);
}
ind_addr_prog_mode_read(sp);
ind_addr_prog_mode_write(sp);
switch_prog_mode(sp, 0);
read_prog_mode(sp);
memory_read(sp);
memory_write(sp);
return 0;
}
{
{
{
}
}
return ap;
}
void set_rf_domain_address(
int32_t ap)
{
}
{
uint8_t data[SERIAL_NUMBER_LENGTH];
uint32_t data_length = SERIAL_NUMBER_LENGTH;
{
}
}
{
}
{
}
{
{
}
}
{
{
}
}
{
}
void ind_addr_prog_mode_read(
int32_t sp)
{
{
for (index = 0; index < data_length; ++index)
{
}
}
}
void ind_addr_prog_mode_write(
int32_t sp)
{
ind_addr_prog_mode_read(sp);
ind_addr_prog_mode_read(sp);
}
{
{
}
}
{
ind_addr_sn_read(sp);
ind_addr_sn_read(sp);
}
void domain_addr_prog_mode_read(
int32_t sp)
{
{
for (index = 0; index < items_length; ++index)
{
}
}
}
void domain_addr_prog_mode_write(
int32_t sp)
{
domain_addr_prog_mode_read(sp);
domain_addr_prog_mode_read(sp);
}
void domain_addr_sn_read(
int32_t sp)
{
{
}
}
void domain_addr_sn_write(
int32_t sp)
{
domain_addr_sn_read(sp);
domain_addr_sn_read(sp);
}
void error_callback(
error_t e,
void* user_data)
{
{
static char error_message[ERROR_MESSAGE_LEN];
}
}
kdriveExpress_API error_t kdrive_ap_set_rf_domain_addr(int32_t ap, const uint8_t da[KDRIVE_DA_LEN])
Sets the Domain Address of the Local Device (KNX Interface Device)
kdriveExpress_API uint32_t kdrive_ap_enum_usb(int32_t ap)
Scan for all KNX USB Interface devices.
kdriveExpress_API bool_t kdrive_ap_release(int32_t ap)
Releases the AccessPort interface.
kdriveExpress_API int32_t kdrive_ap_create(void)
Creates an internal AccessPort interface This should be the first function called when working with t...
kdriveExpress_API error_t kdrive_ap_close(int32_t ap)
Closes the access port If the access port is not open nothing happens.
kdriveExpress_API error_t kdrive_ap_open_usb(int32_t ap, uint32_t iface_index)
Opens a connection to a KNX USB Interface device iface_index should be in the range 0....
kdriveExpress_API void kdrive_logger(uint8_t level, const char *message)
Writes to the kdrive express logger.
kdriveExpress_API void kdrive_logger_dump(uint8_t level, const char *message, const void *buffer, uint32_t buffer_len)
Logs the given message, followed by the data in buffer.
kdriveExpress_API void kdrive_logger_console(void)
Sets the logger to write to the console.
kdriveExpress_API void kdrive_logger_ex(uint8_t level, const char *fmt,...)
Writes to the kdrive express logger.
kdriveExpress_API void kdrive_logger_set_level(uint8_t level)
Sets the root logger level This is once of:
kdriveExpress_API error_t kdrive_sp_switch_prog_mode(int32_t sp, uint16_t ind_addr, bool_t enable)
Enable / Disable the programming mode (switches the learn LED).
kdriveExpress_API error_t kdrive_sp_domain_addr_prog_mode_read(int32_t sp, uint32_t wait_time, domain_addr_prog_mode_read_t items[], uint32_t *items_length)
Reads the Domain Addresses of devices in Programming Mode (i.e.
kdriveExpress_API error_t kdrive_sp_ind_addr_sn_read(int32_t sp, const uint8_t sn[KDRIVE_SN_LEN], uint16_t *ind_addr)
Reads the individual address of a device that matches the specified Serial Number.
kdriveExpress_API error_t kdrive_sp_ind_addr_sn_write(int32_t sp, const uint8_t sn[KDRIVE_SN_LEN], uint16_t new_ind_addr)
Writes the individual address of a device that matches the specified Serial Number.
kdriveExpress_API error_t kdrive_sp_ind_addr_prog_mode_write(int32_t sp, uint16_t new_ind_addr)
Writes the specified individual address to a device in Programming Mode (i.e.
kdriveExpress_API error_t kdrive_sp_domain_addr_sn_write(int32_t sp, const uint8_t sn[KDRIVE_SN_LEN], const uint8_t da[KDRIVE_DA_LEN])
Writes the Domain Address of a device This function validates that the domain address was successfull...
kdriveExpress_API error_t kdrive_sp_read_prog_mode(int32_t sp, uint16_t ind_addr, bool_t *enabled)
Reads the current programming mode.
kdriveExpress_API error_t kdrive_sp_prop_value_write(int32_t sp, uint16_t ind_addr, uint8_t object_index, uint8_t prop_id, uint8_t nr_of_elems, uint16_t start_index, const uint8_t data[], uint32_t data_length)
Writes the value of a property to a device.
kdriveExpress_API error_t kdrive_sp_prop_value_read(int32_t sp, uint16_t ind_addr, uint8_t object_index, uint8_t prop_id, uint8_t nr_of_elems, uint16_t start_index, uint8_t data[], uint32_t *data_length)
Reads a property value from a device The data buffer must exist (should be pre-allocated by the user)...
kdriveExpress_API error_t kdrive_sp_ind_addr_prog_mode_read(int32_t sp, uint32_t wait_time, uint16_t data[], uint32_t *data_length)
Reads the individual addresses of devices in Programming Mode (i.e.
kdriveExpress_API error_t kdrive_sp_domain_addr_sn_read(int32_t sp, const uint8_t sn[KDRIVE_SN_LEN], uint16_t *ind_addr, uint8_t da[KDRIVE_DA_LEN])
Reads the Domain Address of a device that matches the specified Serial Number.
kdriveExpress_API error_t kdrive_sp_memory_read(int32_t sp, uint16_t ind_addr, uint16_t memory_addr, uint8_t number, uint8_t data[], uint32_t *data_length)
Reads data via DMA.
kdriveExpress_API error_t kdrive_sp_domain_addr_prog_mode_write(int32_t sp, const uint8_t da[KDRIVE_DA_LEN])
Writes the Domain Address to a device in Programming Mode (i.e.
kdriveExpress_API bool_t kdrive_sp_release(int32_t sp)
Releases the ServicePort interface.
kdriveExpress_API error_t kdrive_sp_set_co(int32_t sp, bool_t connection_oriented)
Sets whether the device services are run as connection-oriented or connection-less.
kdriveExpress_API error_t kdrive_sp_memory_write(int32_t sp, uint16_t ind_addr, uint16_t memory_addr, const uint8_t data[], uint32_t data_length)
Writes data via DMA.
kdriveExpress_API int32_t kdrive_sp_create(int32_t ap)
Creates an internal ServicePort interface This should be the first function called when working with ...
unsigned short uint16_t
16 bit unsigned char
Definition: kdrive_express_config.h:30
int int32_t
32 bit signed int
Definition: kdrive_express_config.h:34
unsigned int uint32_t
32 bit unsigned char
Definition: kdrive_express_config.h:31
int32_t error_t
Definition: kdrive_express_config.h:46
int32_t bool_t
Definition: kdrive_express_config.h:57
unsigned char uint8_t
8 bit unsigned char
Definition: kdrive_express_config.h:29
#define KDRIVE_DA_LEN
The Length of a KNX Domain Address.
Definition: kdrive_express_defs.h:35
#define KDRIVE_SN_LEN
The Length of a KNX Serial Number.
Definition: kdrive_express_defs.h:34
#define KDRIVE_INVALID_DESCRIPTOR
Indicates an invalid descriptor.
Definition: kdrive_express_defs.h:39
kdriveExpress_API void kdrive_register_error_callback(kdrive_error_callback c, void *user_data)
Registers the error callback function.
#define KDRIVE_TIMEOUT_ERROR
Timeout.
Definition: kdrive_express_error.h:26
#define KDRIVE_ERROR_NONE
No Error, Everything OK.
Definition: kdrive_express_error.h:22
kdriveExpress_API void kdrive_get_error_message(error_t e, char *str, uint32_t str_len)
Gets the error message.
#define KDRIVE_LOGGER_FATAL
A fatal error.
Definition: kdrive_express_logger.h:26
#define KDRIVE_LOGGER_ERROR
An error.
Definition: kdrive_express_logger.h:28
#define KDRIVE_LOGGER_INFORMATION
An informational message, usually denoting the successful completion of an operation.
Definition: kdrive_express_logger.h:31
Structure holding individual address, serial number, domain address for the DomainAddressProgModeRead...
Definition: kdrive_express_services.h:1366