From 29448cbc0b2b423453ff0e6fc12076f962e8ae10 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 18 Dec 2024 18:12:28 +0100 Subject: [PATCH 01/14] Build environment updated for using MSYS2 MinGW UCRT 64-bit. Using VSCP-framework branch feature/new_boot_loader_events Using VSCP-bootloader branch feature/boot_loader_check --- CHANGELOG.md | 6 + README.md | 51 +- common/vscp-bootloader | 2 +- common/vscp-framework | 2 +- .../vscphelper/{vscp_class.h => vscp-class.h} | 5 +- .../vscphelper/{vscp_type.h => vscp-type.h} | 24 +- common/vscphelper/vscp.h | 796 ++++++++++-------- nodeSim/makefile | 6 +- 8 files changed, 491 insertions(+), 401 deletions(-) rename common/vscphelper/{vscp_class.h => vscp-class.h} (98%) rename common/vscphelper/{vscp_type.h => vscp-type.h} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1cea7b..ac0a796 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 3.0.0 + + * Build environment updated for using MSYS2 MinGW UCRT 64-bit. + * Using VSCP-framework v ... + * Using VSCP-bootloader v ... + ## 2.0.0 * [VSCP-framework repository](https://github.com/BlueAndi/vscp-framework) was restructured and the CLI tools moved to this dedicated repository. diff --git a/README.md b/README.md index 47c612a..7dd96a5 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,19 @@ Command line interface tools used to maintain or simulate VSCP nodes. -- [VSCP CLI Tools](#vscp-cli-tools) -- [VSCP](#vscp) -- [Tools](#tools) -- [How To Build](#how-to-build) - - [Prerequisite](#prerequisite) - - [Linux](#linux) - - [Windows](#windows) - - [1 Clone The Repository](#1-clone-the-repository) - - [2 Choose Project](#2-choose-project) - - [3 Build](#3-build) -- [Issues, Ideas And Bugs](#issues-ideas-and-bugs) -- [License](#license) -- [Contribution](#contribution) +* [VSCP CLI Tools](#vscp-cli-tools) +* [VSCP](#vscp) +* [Tools](#tools) +* [How To Build](#how-to-build) + * [Prerequisite](#prerequisite) + * [Linux](#linux) + * [Windows](#windows) + * [1 Clone The Repository](#1-clone-the-repository) + * [2 Choose Project](#2-choose-project) + * [3 Build](#3-build) +* [Issues, Ideas And Bugs](#issues-ideas-and-bugs) +* [License](#license) +* [Contribution](#contribution) # VSCP @@ -42,16 +42,29 @@ More information can be found on the main site http://www.vscp.org ### Linux -Get the standard gcc build environment: -``` -$ sudo apt update -$ sudo apt install build-essential -``` +1. Get the standard gcc build environment: + ```bash + sudo apt update + sudo apt install build-essential + ``` +2. Install expat packages: + ```bash + sudo apt install libexpat + sudo apt install libexpat-devel + ``` ### Windows 1. Install MSYS2 (https://www.msys2.org/) and follow the complete installation instructions there. Only installing the MSYS2 binary is not enough! There are several steps in the MSYS2 shell necessary. -2. The gcc build environment will be available in the "MSYS MinGW 64-bit" shell. +2. The gcc build environment will be available in the "MSYS2 MinGW UCRT 64-bit" shell. +3. Install expat packages: + ```bash + pacman -S libexpat + pacman -S libexpat-devel + ``` +4. Install required visual studio runtime packages: + * https://aka.ms/vs/17/release/vc_redist.x86.exe + * https://aka.ms/vs/17/release/vc_redist.x64.exe ## 1 Clone The Repository diff --git a/common/vscp-bootloader b/common/vscp-bootloader index f48e701..ad738fc 160000 --- a/common/vscp-bootloader +++ b/common/vscp-bootloader @@ -1 +1 @@ -Subproject commit f48e701f63a843cc4cf21a7452a0d62e6fdab6c6 +Subproject commit ad738fc469aa72a114d5ba9cc34e60f023d5b9a9 diff --git a/common/vscp-framework b/common/vscp-framework index 37d7141..40e0c04 160000 --- a/common/vscp-framework +++ b/common/vscp-framework @@ -1 +1 @@ -Subproject commit 37d71414ac5a4e96112574816d2bb316bf61c2b8 +Subproject commit 40e0c04ca43f48f4fc509216841d6ba53dfa7bfa diff --git a/common/vscphelper/vscp_class.h b/common/vscphelper/vscp-class.h similarity index 98% rename from common/vscphelper/vscp_class.h rename to common/vscphelper/vscp-class.h index a3a139e..1e485ab 100644 --- a/common/vscphelper/vscp_class.h +++ b/common/vscphelper/vscp-class.h @@ -15,7 +15,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2000-2021 Ake Hedman, + * Copyright (C) 2000-2022 Ake Hedman, * The VSCP Project * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -47,7 +47,7 @@ !!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!! This file is auto-generated see https://github.com/grodansparadis/vscp-classes - Generated: 2021-10-06 18:25:21.030489 + Generated: 2024-12-12 17:07:55.637062 */ #ifndef VSCP_CLASS_H @@ -151,6 +151,7 @@ #define VSCP_CLASS2_HLO 1028 /* Level II High Level Object */ #define VSCP_CLASS2_CUSTOM 1029 /* Level II Custom */ #define VSCP_CLASS2_DISPLAY 1030 /* Level II Display */ +#define VSCP_CLASS2_SECURITY 1034 /* Level II Security */ #define VSCP_CLASS2_MEASUREMENT_STR 1040 /* Level II Measurement string */ #define VSCP_CLASS2_MEASUREMENT_FLOAT 1060 /* Level II Measurement float */ #define VSCP_CLASS2_VSCPD 65535 /* Level II VSCP Daemon internal events */ diff --git a/common/vscphelper/vscp_type.h b/common/vscphelper/vscp-type.h similarity index 97% rename from common/vscphelper/vscp_type.h rename to common/vscphelper/vscp-type.h index 7f2f89d..719194a 100644 --- a/common/vscphelper/vscp_type.h +++ b/common/vscphelper/vscp-type.h @@ -16,7 +16,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2000-2021 Ake Hedman, The VSCP Project + * Copyright (C) 2000-2022 Ake Hedman, The VSCP Project * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -48,7 +48,7 @@ !!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!! This file is auto-generated see https://github.com/grodansparadis/vscp-classes - Generated: 2021-10-06 18:25:21.608236 + Generated: 2024-12-12 17:07:56.200428 */ #ifndef VSCP_TYPE_H @@ -101,8 +101,11 @@ #define VSCP_TYPE_PROTOCOL_GET_EVENT_INTEREST_RESPONSE 41 /* Get event interest response. */ #define VSCP_TYPE_PROTOCOL_ACTIVATE_NEW_IMAGE_ACK 48 /* Activate new image ACK. */ #define VSCP_TYPE_PROTOCOL_ACTIVATE_NEW_IMAGE_NACK 49 /* Activate new image NACK. */ -#define VSCP_TYPE_PROTOCOL_START_BLOCK_ACK 50 /* Block data transfer ACK. */ -#define VSCP_TYPE_PROTOCOL_START_BLOCK_NACK 51 /* Block data transfer NACK. */ +#define VSCP_TYPE_PROTOCOL_START_BLOCK_ACK 50 /* Start Block ACK. */ +#define VSCP_TYPE_PROTOCOL_START_BLOCK_NACK 51 /* Start Block NACK. */ +#define VSCP_TYPE_PROTOCOL_BLOCK_CHUNK_ACK 52 /* Block Data Chunk ACK. */ +#define VSCP_TYPE_PROTOCOL_BLOCK_CHUNK_NACK 53 /* Block Data Chunk NACK. */ +#define VSCP_TYPE_PROTOCOL_BOOT_LOADER_CHECK 54 /* Bootloader CHECK. */ /* CLASS1.ALARM = 1 - Alarm functionality */ #define VSCP_TYPE_ALARM_GENERAL 0 /* General event */ @@ -595,8 +598,8 @@ #define VSCP_TYPE_DISPLAY_SHOW_DISPLAY_BUFFER 5 /* Show Display Buffer */ #define VSCP_TYPE_DISPLAY_SET_DISPLAY_BUFFER_PARAM 6 /* Set Display Buffer Parameter */ #define VSCP_TYPE_DISPLAY_SHOW_TEXT 32 /* Show Text */ -#define VSCP_TYPE_DISPLAY_SHOW_LED 48 /* Set LED */ -#define VSCP_TYPE_DISPLAY_SHOW_LED_COLOR 49 /* Set RGB Color */ +#define VSCP_TYPE_DISPLAY_SET_LED 48 /* Set LED */ +#define VSCP_TYPE_DISPLAY_SET_COLOR 49 /* Set RGB Color */ /* CLASS1.IR = 110 - IR Remote I/f */ #define VSCP_TYPE_REMOTE_GENERAL 0 /* General event */ @@ -916,6 +919,11 @@ #define VSCP2_TYPE_PROTOCOL_READ_WRITE_RESPONSE 3 /* Read Write Response */ #define VSCP2_TYPE_PROTOCOL_HIGH_END_SERVER_CAPS 20 /* High end server/service capabilities */ #define VSCP2_TYPE_PROTOCOL_WHO_IS_THERE_RESPONSE 32 /* Level II who is there response */ +#define VSCP2_TYPE_PROTOCOL_GET_MATRIX_INFO_RESPONSE 34 /* Level II get DM info response */ +#define VSCP2_TYPE_PROTOCOL_GET_EMBEDDED_MDF_RESPONSE 36 /* Level II get embedded MDF response */ +#define VSCP2_TYPE_PROTOCOL_GET_EVENT_INTEREST_RESPONSE 41 /* Level II events of interest response */ +#define VSCP2_TYPE_PROTOCOL_READ_REGISTER_DIRECT 43 /* Read a Level II register from the 32-bit register space direct */ +#define VSCP2_TYPE_PROTOCOL_WRITE_REGISTER_DIRECT 44 /* Write a Level II register to the 32-bit register space direct */ /* CLASS2.CONTROL = 1025 - Level II Control */ #define VSCP2_TYPE_CONTROL_GENERAL 0 /* General event */ @@ -942,6 +950,10 @@ /* CLASS2.DISPLAY = 1030 - Level II Display */ #define VSCP2_TYPE_DISPLAY_GENERAL 0 /* General event */ +/* CLASS2.SECURITY = 1034 - Level II Security */ +#define VSCP2_TYPE_SECURITY_GENERAL 0 /* General event */ +#define VSCP2_TYPE_SECURITY_SETKEY 1 /* Set key */ + /* CLASS2.MEASUREMENT_STR = 1040 - Level II Measurement string */ /* Event types is the same as CLASS1.MEASUREMENT = 10 - Measurement */ diff --git a/common/vscphelper/vscp.h b/common/vscphelper/vscp.h index dc6333d..2d426e2 100644 --- a/common/vscphelper/vscp.h +++ b/common/vscphelper/vscp.h @@ -5,8 +5,7 @@ The MIT License (MIT) - Copyright © 2000-2021 Ake Hedman, the VSCP project - + Copyright (C) 2000-2024 Ake Hedman, the VSCP project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -26,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - !!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!! + !!!!!!!!!!!!!!!!!!!! W A R N I N G !!!!!!!!!!!!!!!!!!!! This file may be a copy of the original file. This is because the file is copied to other projects as a convenience. Thus editing the copy will not make it to the original and will be overwritten. @@ -39,13 +38,13 @@ #include #include -#include -#include +#include +#include -#define VSCP_DEFAULT_UDP_PORT 33333 -#define VSCP_DEFAULT_TCP_PORT 9598 -#define VSCP_ANNOUNCE_MULTICAST_PORT 9598 -#define VSCP_DEFAULT_MULTICAST_PORT 44444 +#define VSCP_DEFAULT_UDP_PORT 33333 +#define VSCP_DEFAULT_TCP_PORT 9598 +#define VSCP_ANNOUNCE_MULTICAST_PORT 9598 +#define VSCP_DEFAULT_MULTICAST_PORT 44444 #define VSCP_ADDRESS_SEGMENT_CONTROLLER 0x00 #define VSCP_ADDRESS_NEW_NODE 0xff @@ -57,117 +56,112 @@ #define VSCP_LEVEL2 1 #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /* * * * General structure for VSCP * * * */ - - /* This structure is for VSCP Level II */ - - typedef struct - { - uint16_t crc; /* crc checksum (calculated from here to end) */ - /* Used for UDP/Ethernet etc */ - - uint32_t obid; /* Used by driver for channel info etc. */ - - /* Time block - Always UTC time */ - uint16_t year; - uint8_t month; /* 1-12 */ - uint8_t day; /* 1-31 */ - uint8_t hour; /* 0-23 */ - uint8_t minute; /* 0-59 */ - uint8_t second; /* 0-59 */ - - uint32_t - timestamp; /* Relative time stamp for package in microseconds */ - /* ~71 minutes before roll over */ - - /* ----- CRC should be calculated from here to end + data block ---- */ - - /* - Bit 15 - This is a dumb node. No MDF, register, nothing. - Bit 14 - GUID type - Bit 13 - GUID type - Bit 12 - GUID type (GUID is IP v.6 address.) - Bit 8-11 = Reserved - Bit 765 = priority, Priority 0-7 where 0 is highest. - Bit 4 = hard coded, true for a hard coded device. - Bit 3 = Don't calculate CRC, false for CRC usage. - Just checked when CRC is used. - If set the CRC should be set to 0xAA55 for - the event to be accepted without a CRC check. - Bit 2 = Rolling index. - Bit 1 = Rolling index. - Bit 0 = Rolling index. - */ - uint16_t head; - - uint16_t vscp_class; /* VSCP class */ - uint16_t vscp_type; /* VSCP type */ - uint8_t GUID[16]; /* Node globally unique id MSB(0) -> LSB(15) */ - uint16_t sizeData; /* Number of valid data bytes */ - - uint8_t* pdata; /* Pointer to data. Max 512 bytes */ - - } vscpEvent; - - typedef vscpEvent* PVSCPEVENT; - - /* - WARNING!!! - This structure is for VSCP Level II with data embedded == big!!! - */ - - typedef struct - { - - uint16_t crc; /* CRC checksum (calculated from here to end) */ - /* Used for UDP/Ethernet etc */ - - uint32_t obid; /* Used by driver for channel info etc. */ - - /* Time block - Always UTC time */ - uint16_t year; - uint8_t month; /* 1-12 */ - uint8_t day; /* 1-31 */ - uint8_t hour; /* 0-23 */ - uint8_t minute; /* 0-59 */ - uint8_t second; /* 0-59 */ - - uint32_t - timestamp; /* Relative time stamp for package in microseconds. */ - /* ~71 minutes before roll over */ - - /* CRC should be calculated from here to end + data block */ - uint16_t head; /* Bit 15 GUID is IP v.6 address. */ - /* - Bit 15 - This is a dumb node. No MDF, register, nothing. - Bit 14 - GUID type - Bit 13 - GUID type - Bit 12 - GUID type (GUID is IP v.6 address.) - Bit 8-11 = Reserved - Bit 765 = priority, Priority 0-7 where 0 is highest. - Bit 4 = hard coded, true for a hard coded device. - Bit 3 = Don't calculate CRC, false for CRC usage. - Just checked when CRC is used. - If set the CRC should be set to 0xAA55 for - the event to be accepted without a CRC check. - Bit 2 = Rolling index. - Bit 1 = Rolling index. - Bit 0 = Rolling index. - */ - uint16_t vscp_class; /* VSCP class */ - uint16_t vscp_type; /* VSCP type */ - uint8_t GUID[16]; /* Node globally unique id MSB(0) -> LSB(15) */ - uint16_t sizeData; /* Number of valid data bytes */ - - uint8_t data[VSCP_MAX_DATA]; /* Pointer to data. Max. 512 bytes */ - - } vscpEventEx; - - typedef vscpEventEx* PVSCPEVENTEX; +/* * * * General structure for VSCP * * * */ + +/* This structure is for VSCP Level II */ + +typedef struct _vscpEvent { + uint16_t crc; /* crc checksum (calculated from here to end) */ + /* Used for UDP/Ethernet etc */ + + uint32_t obid; /* Used by driver for channel info etc. */ + + /* Time block - Always UTC time */ + uint16_t year; + uint8_t month; /* 1-12 */ + uint8_t day; /* 1-31 */ + uint8_t hour; /* 0-23 */ + uint8_t minute; /* 0-59 */ + uint8_t second; /* 0-59 */ + + uint32_t timestamp; /* Relative time stamp for package in microseconds */ + /* ~71 minutes before roll over */ + + /* ----- CRC should be calculated from here to end + data block ---- */ + + /* + Bit 15 - This is a dumb node. No MDF, register, nothing. + Bit 14 - GUID type + Bit 13 - GUID type + Bit 12 - GUID type (GUID is IP v.6 address.) + Bit 8-11 = Reserved + Bit 765 = priority, Priority 0-7 where 0 is highest. + Bit 4 = hard coded, true for a hard coded device. + Bit 3 = Don't calculate CRC, false for CRC usage. + Just checked when CRC is used. + If set the CRC should be set to 0xAA55 for + the event to be accepted without a CRC check. + Bit 2 = Rolling index. + Bit 1 = Rolling index. + Bit 0 = Rolling index. + */ + uint16_t head; + + uint16_t vscp_class; /* VSCP class */ + uint16_t vscp_type; /* VSCP type */ + uint8_t GUID[16]; /* Node globally unique id MSB(0) -> LSB(15) */ + uint16_t sizeData; /* Number of valid data bytes */ + + uint8_t *pdata; /* Pointer to data. Max 512 bytes */ + +} vscpEvent; + +typedef vscpEvent *PVSCPEVENT; + +/* + WARNING!!! + This structure is for VSCP Level II with data embedded == big!!! + */ + +typedef struct _vscpEventEx { + + uint16_t crc; /* CRC checksum (calculated from here to end) */ + /* Used for UDP/Ethernet etc */ + + uint32_t obid; /* Used by driver for channel info etc. */ + + /* Time block - Always UTC time */ + uint16_t year; + uint8_t month; /* 1-12 */ + uint8_t day; /* 1-31 */ + uint8_t hour; /* 0-23 */ + uint8_t minute; /* 0-59 */ + uint8_t second; /* 0-59 */ + + uint32_t timestamp; /* Relative time stamp for package in microseconds. */ + /* ~71 minutes before roll over */ + + /* CRC should be calculated from here to end + data block */ + uint16_t head; /* Bit 15 GUID is IP v.6 address. */ + /* + Bit 15 - This is a dumb node. No MDF, register, nothing. + Bit 14 - GUID type + Bit 13 - GUID type + Bit 12 - GUID type (GUID is IP v.6 address.) + Bit 8-11 = Reserved + Bit 765 = priority, Priority 0-7 where 0 is highest. + Bit 4 = hard coded, true for a hard coded device. + Bit 3 = Don't calculate CRC, false for CRC usage. + Just checked when CRC is used. + If set the CRC should be set to 0xAA55 for + the event to be accepted without a CRC check. + Bit 2 = Rolling index. + Bit 1 = Rolling index. + Bit 0 = Rolling index. + */ + uint16_t vscp_class; /* VSCP class */ + uint16_t vscp_type; /* VSCP type */ + uint8_t GUID[16]; /* Node globally unique id MSB(0) -> LSB(15) */ + uint16_t sizeData; /* Number of valid data bytes */ + + uint8_t data[VSCP_MAX_DATA]; /* Pointer to data. Max. 512 bytes */ + +} vscpEventEx; + +typedef vscpEventEx *PVSCPEVENTEX; /* Priorities in the header byte as or'in values */ /* Priorities goes from 0-7 where 0 is highest */ @@ -199,23 +193,20 @@ extern "C" #define VSCP_HEADER16_GUID_TYPE_STANDARD 0x0000 /* VSCP standard GUID */ #define VSCP_HEADER16_GUID_TYPE_IPV6 0x1000 /* GUID is IPv6 address */ /* https://www.sohamkamani.com/blog/2016/10/05/uuid1-vs-uuid4/ */ -#define VSCP_HEADER16_GUID_TYPE_RFC4122V1 \ - 0x2000 /* GUID is RFC 4122 Version 1 */ -#define VSCP_HEADER16_GUID_TYPE_RFC4122V4 \ - 0x3000 /* GUID is RFC 4122 Version 4 */ +#define VSCP_HEADER16_GUID_TYPE_RFC4122V1 0x2000 /* GUID is RFC 4122 Version 1 */ +#define VSCP_HEADER16_GUID_TYPE_RFC4122V4 0x3000 /* GUID is RFC 4122 Version 4 */ #define VSCP_MASK_PRIORITY 0xE0 -#define VSCP_MASK_GUID_TYPE 0x8000 +#define VSCP_MASK_GUID_TYPE 0x8000 #define VSCP_MASK_HARDCODED 0x10 #define VSCP_MASK_NOCRCCALC 0x08 #define VSCP_LEVEL1_MAXDATA 8 #define VSCP_LEVEL2_MAXDATA (512) -#define VSCP_NOCRC_CALC_DUMMY_CRC \ - 0xAA55 /* If no CRC cal bit is set the CRC value */ - /* should be set to this value for the CRC */ - /* calculation to be skipped. */ +#define VSCP_NOCRC_CALC_DUMMY_CRC 0xAA55 /* If no CRC cal bit is set the CRC value */ + /* should be set to this value for the CRC */ + /* calculation to be skipped. */ #define VSCP_CAN_ID_HARD_CODED 0x02000000 /* Hard coded bit in CAN frame id */ @@ -223,86 +214,92 @@ extern "C" #define VSCP_GUID_MSB 0 #define VSCP_GUID_LSB 15 - /* - * Filter structure for VSCP Level 2 - */ +/* + * Filter structure for VSCP Level 2 + */ - typedef struct - { - uint8_t filter_priority; /* Priority */ - uint8_t mask_priority; +typedef struct _vscpEventFilter { + uint8_t filter_priority; /* Priority */ + uint8_t mask_priority; - uint16_t filter_class; /* VSCP class */ - uint16_t mask_class; + uint16_t filter_class; /* VSCP class */ + uint16_t mask_class; - uint16_t filter_type; /* VSCP type */ - uint16_t mask_type; + uint16_t filter_type; /* VSCP type */ + uint16_t mask_type; - uint8_t filter_GUID[16]; /* Node address MSB -> LSB, LSB is node - nickname id */ - uint8_t mask_GUID[16]; /* when interfacing the VSCP daemon. */ + uint8_t filter_GUID[16]; /* Node address MSB -> LSB, LSB is node + nickname id */ + uint8_t mask_GUID[16]; /* when interfacing the VSCP daemon. */ - } vscpEventFilter; +} vscpEventFilter; - typedef vscpEventFilter* PVSCPEVENTFILTER; +typedef vscpEventFilter *PVSCPEVENTFILTER; - /* - Statistics +/* + Statistics - This is the general statistics structure - */ + This is the general statistics structure +*/ - typedef struct structVSCPStatistics - { - unsigned long cntReceiveFrames; /* # of receive frames */ - unsigned long cntTransmitFrames; /* # of transmitted frames */ - unsigned long cntReceiveData; /* # of received data bytes */ - unsigned long cntTransmitData; /* # of transmitted data bytes */ - unsigned long cntOverruns; /* # of overruns */ - unsigned long x; /* Currently undefined value */ - unsigned long y; /* Currently undefined value */ - unsigned long z; /* Currently undefined value */ - } VSCPStatistics; +typedef struct structVSCPStatistics { + unsigned long cntReceiveFrames; /* # of receive frames */ + unsigned long cntTransmitFrames; /* # of transmitted frames */ + unsigned long cntReceiveData; /* # of received data bytes */ + unsigned long cntTransmitData; /* # of transmitted data bytes */ + unsigned long cntOverruns; /* # of overruns */ + unsigned long x; /* Currently undefined value */ + unsigned long y; /* Currently undefined value */ + unsigned long z; /* Currently undefined value */ +} VSCPStatistics; - typedef VSCPStatistics* PVSCPSTATISTICS; +typedef VSCPStatistics *PVSCPSTATISTICS; - /* - VSCPStatus +/* + VSCPStatus - This is the general channel state structure - */ + This is the general channel state structure +*/ #define VSCP_STATUS_ERROR_STRING_SIZE 80 - typedef struct structVSCPStatus - { - unsigned long channel_status; /* Current state for channel */ - unsigned long lasterrorcode; /* Last error code */ - unsigned long lasterrorsubcode; /* Last error sub code */ - char - lasterrorstr[VSCP_STATUS_ERROR_STRING_SIZE]; /* Last error string */ - } VSCPStatus; +typedef struct structVSCPStatus { + unsigned long channel_status; /* Current state for channel */ + unsigned long lasterrorcode; /* Last error code */ + unsigned long lasterrorsubcode; /* Last error sub code */ + char lasterrorstr[VSCP_STATUS_ERROR_STRING_SIZE]; /* Last error string */ +} VSCPStatus; - typedef VSCPStatus* PVSCPSTATUS; +typedef VSCPStatus *PVSCPSTATUS; - /* VSCP LEVEL II UDP datagram offsets */ - /* Same format as multicast i used below */ +/* VSCP LEVEL II UDP datagram offsets */ +/* Same format as multicast i used below */ + +/* + VSCP Channel Info - /* - VSCP Channel Info + This is the channel VSCP Info structure +*/ - This is the channel VSCP Info structure - */ +typedef struct structVSCPChannelInfo { + unsigned char channelType; /* Level I, Level II etc. from canal.h */ + unsigned short channel; /* daemon channel number */ + char GUID[16]; /* Channel GUID id */ - typedef struct structVSCPChannelInfo - { - unsigned char channelType; /* Level I, Level II etc. from canal.h */ - unsigned short channel; /* daemon channel number */ - char GUID[16]; /* Channel GUID id */ +} VSCPChannelInfo; - } VSCPChannelInfo; +typedef VSCPChannelInfo *PVSCPCHANNELINFO; - typedef VSCPChannelInfo* PVSCPCHANNELINFO; +/* Interface types */ +#define VSCP_INTERFACE_TYPE_UNKNOWN 0 +#define VSCP_INTERFACE_TYPE_INTERNAL 1 // Internal to daemon/server +#define VSCP_INTERFACE_TYPE_LEVEL1DRV 2 // Level I driver +#define VSCP_INTERFACE_TYPE_LEVEL2DRV 3 // Level II driver +#define VSCP_INTERFACE_TYPE_CLIENT_TCPIP 4 // TCP/IP client +#define VSCP_INTERFACE_TYPE_CLIENT_UDP 5 // UDP client +#define VSCP_INTERFACE_TYPE_CLIENT_WEB 6 // Web server +#define VSCP_INTERFACE_TYPE_CLIENT_WEBSOCK 7 // Websocket client +#define VSCP_INTERFACE_TYPE_CLIENT_REST 8 // REST client /* VSCP Encryption types */ #define VSCP_ENCRYPTION_NONE 0 @@ -317,14 +314,14 @@ extern "C" #define VSCP_ENCRYPTION_TOKEN_2 "AES192" #define VSCP_ENCRYPTION_TOKEN_3 "AES256" - /* * * * Multicast on VSCP reserved IP 224.0.23.158 */ +/* * * * Multicast on VSCP reserved IP 224.0.23.158 */ #define VSCP_MULTICAST_IPV4_ADDRESS_STR "224.0.23.158" /* Packet frame format type = 0 */ /* without byte0 and CRC */ /* total frame size is 1 + 34 + 2 + data-length */ -#define VSCP_MULTICAST_PACKET0_HEADER_LENGTH 35 +#define VSCP_MULTICAST_PACKET0_HEADER_LENGTH 35 /* Multicast packet ordinals */ #define VSCP_MULTICAST_PACKET0_POS_PKTTYPE 0 @@ -356,59 +353,73 @@ extern "C" /* the initialization vector follows. */ // Maximum packet size (for buffer allocation) -#define VSCP_MULTICAST_PACKET0_MAX (1 + VSCP_MULTICAST_PACKET0_HEADER_LENGTH + 2 + VSCP_LEVEL2_MAXDATA + 16) +#define VSCP_MULTICAST_PACKET0_MAX (1 + VSCP_MULTICAST_PACKET0_HEADER_LENGTH + 2 + VSCP_LEVEL2_MAXDATA + 16) /* VSCP multicast packet types */ #define VSCP_MULTICAST_TYPE_EVENT 0 #define SET_VSCP_MULTICAST_TYPE(type, encryption) ((type << 4) | encryption) #define GET_VSCP_MULTICAST_PACKET_TYPE(type) ((type >> 4) & 0x0f) -#define GET_VSCP_MULTICAST_PACKET_ENCRYPTION(type) ((type)&0x0f) +#define GET_VSCP_MULTICAST_PACKET_ENCRYPTION(type) ((type) &0x0f) /* Multicast proxy CLASS=1026, TYPE=3 */ /* https://www.vscp.org/docs/vscpspec/doku.php?id=class2.information#type_3_0x0003_level_ii_proxy_node_heartbeat */ -#define VSCP_MULTICAST_PROXY_HEARTBEAT_DATA_SIZE 192 -#define VSCP_MULTICAST_PROXY_HEARTBEAT_POS_REALGUID \ - 0 /* The real GUID for the node */ -#define VSCP_MULTICAST_PROXY_HEARTBEAT_POS_IFGUID \ - 32 /* GUID for interface node is on */ -#define VSCP_MULTICAST_PROXY_HEARTBEAT_POS_IFLEVEL \ - 48 /* 0=Level I node, 1=Level II node */ +#define VSCP_MULTICAST_PROXY_HEARTBEAT_DATA_SIZE 192 +#define VSCP_MULTICAST_PROXY_HEARTBEAT_POS_REALGUID 0 /* The real GUID for the node */ +#define VSCP_MULTICAST_PROXY_HEARTBEAT_POS_IFGUID 32 /* GUID for interface node is on */ +#define VSCP_MULTICAST_PROXY_HEARTBEAT_POS_IFLEVEL 48 /* 0=Level I node, 1=Level II node */ #define VSCP_MULTICAST_PROXY_HEARTBEAT_POS_NODENAME 64 /* Name of node */ #define VSCP_MULTICAST_PROXY_HEARTBEAT_POS_IFNAME 128 /* Name of interface */ -/* Default key for VSCP Server - !!!! should only be used on test systems !!!! +/* + Default key for VSCP Server - !!!! should only be used on test systems !!!! */ -#define VSCP_DEFAULT_KEY16 = 'A4A86F7D7E119BA3F0CD06881E371B98' -#define VSCP_DEFAULT_KEY24 = 'A4A86F7D7E119BA3F0CD06881E371B989B33B6D606A863B6' -#define VSCP_DEFAULT_KEY32 \ - = 'A4A86F7D7E119BA3F0CD06881E371B989B33B6D606A863B633EF529D64544F8E' +#define VSCP_DEFAULT_KEY16 "A4A86F7D7E119BA3F0CD06881E371B98" +#define VSCP_DEFAULT_KEY24 "A4A86F7D7E119BA3F0CD06881E371B989B33B6D606A863B6" +#define VSCP_DEFAULT_KEY32 "A4A86F7D7E119BA3F0CD06881E371B989B33B6D606A863B633EF529D64544F8E" /* Bootloaders */ #define VSCP_BOOTLOADER_VSCP 0x00 /* VSCP boot loader algorithm */ #define VSCP_BOOTLOADER_PIC1 0x01 /* PIC algorithm 0 */ #define VSCP_BOOTLOADER_AVR1 0x10 /* AVR algorithm 0 */ #define VSCP_BOOTLOADER_LPC1 0x20 /* NXP/Philips/Freescale algorithm 0 */ -#define VSPP_BOOTLOADER_NXP1 0x20 /* NXP/Philips/Freescale algorithm 0 */ +#define VSCP_BOOTLOADER_NXP1 0x20 /* NXP/Philips/Freescale algorithm 0 */ #define VSCP_BOOTLOADER_ST 0x30 /* ST STR algorithm 0 */ #define VSCP_BOOTLOADER_FREESCALE 0x40 /* Freescale Kinetics algorithm 0 */ -#define VSCP_BOOTLOADER_USER0 0xf0 /* Used defined bootloader 0 */ +#define VSCP_BOOTLOADER_ESP 0x50 /* Espressif algorithm 0 */ +#define VSCP_BOOTLOADER_NONE0 0xf0 /* Used defined bootloader 0 */ +#define VSCP_BOOTLOADER_USER0 0xf0 #define VSCP_BOOTLOADER_NONE1 0xf1 /* Used defined bootloader 1 */ +#define VSCP_BOOTLOADER_USER1 0xf1 #define VSCP_BOOTLOADER_NONE2 0xf2 /* Used defined bootloader 2 */ +#define VSCP_BOOTLOADER_USER2 0xf2 #define VSCP_BOOTLOADER_NONE3 0xf3 /* Used defined bootloader 3 */ +#define VSCP_BOOTLOADER_USER3 0xf3 #define VSCP_BOOTLOADER_NONE4 0xf4 /* Used defined bootloader 4 */ +#define VSCP_BOOTLOADER_USER4 0xf4 #define VSCP_BOOTLOADER_NONE5 0xf5 /* Used defined bootloader 5 */ +#define VSCP_BOOTLOADER_USER5 0xf5 #define VSCP_BOOTLOADER_NONE6 0xf6 /* Used defined bootloader 6 */ +#define VSCP_BOOTLOADER_USER6 0xf6 #define VSCP_BOOTLOADER_NONE7 0xf7 /* Used defined bootloader 7 */ +#define VSCP_BOOTLOADER_USER7 0xf7 #define VSCP_BOOTLOADER_NONE8 0xf8 /* Used defined bootloader 8 */ +#define VSCP_BOOTLOADER_USER8 0xf8 #define VSCP_BOOTLOADER_NONE9 0xf9 /* Used defined bootloader 9 */ +#define VSCP_BOOTLOADER_USER9 0xf9 #define VSCP_BOOTLOADER_NONE10 0xfa /* Used defined bootloader 10 */ +#define VSCP_BOOTLOADER_USER10 0xfa #define VSCP_BOOTLOADER_NONE11 0xfb /* Used defined bootloader 11 */ +#define VSCP_BOOTLOADER_USER11 0xfb #define VSCP_BOOTLOADER_NONE12 0xfc /* Used defined bootloader 12 */ +#define VSCP_BOOTLOADER_USER12 0xfc #define VSCP_BOOTLOADER_NONE13 0xfd /* Used defined bootloader 13 */ +#define VSCP_BOOTLOADER_USER13 0xfd #define VSCP_BOOTLOADER_NONE14 0xfe /* Used defined bootloader 14 */ +#define VSCP_BOOTLOADER_USER14 0xfe #define VSCP_BOOTLOADER_NONE15 0xff /* No bootloader available */ +#define VSCP_BOOTLOADER_USER15 0xff /* * * * Data Coding for VSCP packets * * * */ @@ -458,22 +469,26 @@ extern "C" #define VSCP_CRC32_POLYNOMIAL 0x04C11DB7 #define VSCP_CRC32_REMINDER 0xFFFFFFFF - /* Node data - the required registers are fetched from this */ - /* structure */ - struct vscpMyNode - { - unsigned char GUID[16]; - unsigned char nicknameID; - }; +/* Node data - the required registers are fetched from this */ +/* structure */ +struct vscpMyNode { + unsigned char GUID[16]; + unsigned char nicknameID; +}; /* * * * Standard VSCP registers * * * */ /* Register defines above 0x7f (Level I) / 0xffffff7f (Level II) */ +#define VSCP_STD_REGISTER_START 0x80 + +// Alarm status (Read only) #define VSCP_STD_REGISTER_ALARM_STATUS 0x80 #define VSCP_STD_REGISTER_MAJOR_VERSION 0x81 #define VSCP_STD_REGISTER_MINOR_VERSION 0x82 -#define VSCP_STD_REGISTER_SUB_VERSION 0x83 + +// Counts errors +#define VSCP_STD_REGISTER_ERROR_COUNTER 0x83 /* 0x84 - 0x88 - User id space */ #define VSCP_STD_REGISTER_USER_ID 0x84 @@ -485,7 +500,8 @@ extern "C" #define VSCP_STD_REGISTER_USER_MANSUBDEV_ID 0x8D /* Nickname id */ -#define VSCP_STD_REGISTER_NICKNAME_ID 0x91 +#define VSCP_STD_REGISTER_NICKNAME_ID 0x91 +#define VSCP_STD_REGISTER_NICKNAME_ID_LSB 0x91 /* Selected page */ #define VSCP_STD_REGISTER_PAGE_SELECT_MSB 0x92 @@ -495,10 +511,27 @@ extern "C" #define VSCP_STD_REGISTER_FIRMWARE_MAJOR 0x94 #define VSCP_STD_REGISTER_FIRMWARE_MINOR 0x95 #define VSCP_STD_REGISTER_FIRMWARE_SUBMINOR 0x96 +#define VSCP_STD_REGISTER_FIRMWARE_RELEASE 0x96 #define VSCP_STD_REGISTER_BOOT_LOADER 0x97 -#define VSCP_STD_REGISTER_BUFFER_SIZE 0x98 -#define VSCP_STD_REGISTER_PAGES_COUNT 0x99 +#define VSCP_STD_REGISTER_BUFFER_SIZE 0x98 // Deprecated +#define VSCP_STD_REGISTER_PAGES_COUNT 0x99 // Deprecated + +/* Unsigned 32-bit integer for family code */ +#define VSCP_STD_REGISTER_FAMILY_CODE 0x9A + +/* Unsigned 32-bit integer for device type */ +#define VSCP_STD_REGISTER_DEVICE_TYPE 0x9E + +/* Reset node if 0x55 and 0xaa written here withing one second. */ +#define VSCP_STD_REGISTER_NODE_RESET 0xA2 + +/* Firmware code for device. */ +#define VSCP_STD_REGISTER_FIRMWARE_CODE_MSB 0xA3 +#define VSCP_STD_REGISTER_FIRMWARE_CODE_LSB 0xA4 + +/* MSB of 16-bit nickname */ +#define VSCP_STD_REGISTER_NICKNAME_ID_MSB 0xA5 /* 0xd0 - 0xdf - GUID */ #define VSCP_STD_REGISTER_GUID 0xD0 @@ -518,33 +551,42 @@ extern "C" #define VSCP_LEVEL1_DM_OFFSET_ACTION 6 #define VSCP_LEVEL1_DM_OFFSET_ACTION_PARAM 7 - /* - Bits for VSCP server 64/16-bit capability code - (WCYD - What Can You Do) used by CLASS1.PROTOCOL, - HIGH END SERVER RESPONSE and low end 16-bits for - CLASS2.PROTOCOL, HIGH END SERVER HEART BEAT - */ - -#define VSCP_SERVER_CAPABILITY_REMOTE_VARIABLE (1 << 63) // -#define VSCP_SERVER_CAPABILITY_DECISION_MATRIX (1 << 62) // -#define VSCP_SERVER_CAPABILITY_INTERFACE (1 << 61) // -#define VSCP_SERVER_CAPABILITY_TCPIP (1 << 15) // 32768 -#define VSCP_SERVER_CAPABILITY_UDP (1 << 14) // 16384 -#define VSCP_SERVER_CAPABILITY_MULTICAST_ANNOUNCE (1 << 13) // 8192 -#define VSCP_SERVER_CAPABILITY_RAWETH (1 << 12) // 4196 -#define VSCP_SERVER_CAPABILITY_WEB (1 << 11) // 2048 -#define VSCP_SERVER_CAPABILITY_WEBSOCKET (1 << 10) // 1024 -#define VSCP_SERVER_CAPABILITY_REST (1 << 9) // 512 -#define VSCP_SERVER_CAPABILITY_MULTICAST_CHANNEL (1 << 8) // 256 -#define VSCP_SERVER_CAPABILITY_RESERVED (1 << 7) // 128 -#define VSCP_SERVER_CAPABILITY_IP6 (1 << 6) // 64 -#define VSCP_SERVER_CAPABILITY_IP4 (1 << 5) // 32 -#define VSCP_SERVER_CAPABILITY_SSL (1 << 4) // 16 -#define VSCP_SERVER_CAPABILITY_TWO_CONNECTIONS (1 << 3) // 8 -#define VSCP_SERVER_CAPABILITY_AES256 (1 << 2) // 4 -#define VSCP_SERVER_CAPABILITY_AES192 (1 << 1) // 2 -#define VSCP_SERVER_CAPABILITY_AES128 1 // 1 -#define VSCP_SERVER_CAPABILITY_NONE 0 // No capabilities +/* Flag bits for level 1 DM flags */ +#define VSCP_LEVEL1_DM_FLAG_ENABLED 0x80 +#define VSCP_LEVEL1_DM_FLAG_ORIGIN_MATCH 0x40 +#define VSCP_LEVEL1_DM_FLAG_ORIGIN_HARDCODED 0x20 +#define VSCP_LEVEL1_DM_FLAG_MATCH_ZONE 0x10 +#define VSCP_LEVEL1_DM_FLAG_MATCH_SUBZONE 0x08 +#define VSCP_LEVEL1_DM_FLAG_CLASS_MASK_BIT8 0x02 +#define VSCP_LEVEL1_DM_FLAG_CLASS_FILTER_BIT8 0x01 + +/* + Bits for VSCP server 64/16-bit capability code + (WCYD - What Can You Do) used by CLASS1.PROTOCOL, + HIGH END SERVER RESPONSE and low end 16-bits for + CLASS2.PROTOCOL, HIGH END SERVER HEART BEAT +*/ + +#define VSCP_SERVER_CAPABILITY_REMOTE_VARIABLE (1ll << 63) // +#define VSCP_SERVER_CAPABILITY_DECISION_MATRIX (1ll << 62) // +#define VSCP_SERVER_CAPABILITY_INTERFACE (1ll << 61) // +#define VSCP_SERVER_CAPABILITY_TCPIP (1ll << 15) // 32768 +#define VSCP_SERVER_CAPABILITY_UDP (1ll << 14) // 16384 +#define VSCP_SERVER_CAPABILITY_MULTICAST_ANNOUNCE (1ll << 13) // 8192 +#define VSCP_SERVER_CAPABILITY_RAWETH (1ll << 12) // 4196 +#define VSCP_SERVER_CAPABILITY_WEB (1ll << 11) // 2048 +#define VSCP_SERVER_CAPABILITY_WEBSOCKET (1ll << 10) // 1024 +#define VSCP_SERVER_CAPABILITY_REST (1ll << 9) // 512 +#define VSCP_SERVER_CAPABILITY_MULTICAST_CHANNEL (1ll << 8) // 256 +#define VSCP_SERVER_CAPABILITY_RESERVED (1ll << 7) // 128 +#define VSCP_SERVER_CAPABILITY_IP6 (1ll << 6) // 64 +#define VSCP_SERVER_CAPABILITY_IP4 (1ll << 5) // 32 +#define VSCP_SERVER_CAPABILITY_SSL (1ll << 4) // 16 +#define VSCP_SERVER_CAPABILITY_TWO_CONNECTIONS (1ll << 3) // 8 +#define VSCP_SERVER_CAPABILITY_AES256 (1ll << 2) // 4 +#define VSCP_SERVER_CAPABILITY_AES192 (1ll << 1) // 2 +#define VSCP_SERVER_CAPABILITY_AES128 1ll // 1 +#define VSCP_SERVER_CAPABILITY_NONE 0 // No capabilities /* Offsets into the data of the capabilities event @@ -557,77 +599,86 @@ extern "C" #define VSCP_CAPABILITY_OFFSET_NON_STD_PORTS 104 /* Error Codes */ -#define VSCP_ERROR_SUCCESS 0 /* All is OK */ -#define VSCP_ERROR_ERROR -1 /* Error */ -#define VSCP_ERROR_CHANNEL 7 /* Invalid channel */ -#define VSCP_ERROR_FIFO_EMPTY 8 /* FIFO is empty */ -#define VSCP_ERROR_FIFO_FULL 9 /* FIFO is full */ -#define VSCP_ERROR_FIFO_SIZE 10 /* FIFO size error */ -#define VSCP_ERROR_FIFO_WAIT 11 /* FIFO wait failed */ -#define VSCP_ERROR_GENERIC 12 /* Generic error */ -#define VSCP_ERROR_HARDWARE 13 /* Hardware error */ -#define VSCP_ERROR_INIT_FAIL 14 /* Initialization failed */ -#define VSCP_ERROR_INIT_MISSING 15 /* No init */ -#define VSCP_ERROR_INIT_READY 16 /* Failed init */ -#define VSCP_ERROR_NOT_SUPPORTED 17 /* Not supported */ -#define VSCP_ERROR_OVERRUN 18 /* Overrun */ -#define VSCP_ERROR_RCV_EMPTY 19 /* Receive buffer empty */ -#define VSCP_ERROR_REGISTER 20 /* Register value error */ -#define VSCP_ERROR_TRM_FULL 21 /* Transmit buffer full */ -#define VSCP_ERROR_LIBRARY 28 /* Unable to load library */ -#define VSCP_ERROR_PROCADDRESS 29 /* Unable get library proc. address */ -#define VSCP_ERROR_ONLY_ONE_INSTANCE 30 /* Only one instance allowed */ -#define VSCP_ERROR_SUB_DRIVER 31 /* Problem with sub driver call */ -#define VSCP_ERROR_TIMEOUT 32 /* Time-out */ -#define VSCP_ERROR_NOT_OPEN 33 /* The device is not open. */ -#define VSCP_ERROR_PARAMETER 34 /* A parameter is invalid. */ -#define VSCP_ERROR_MEMORY 35 /* Memory exhausted. */ -#define VSCP_ERROR_INTERNAL 36 /* Some kind of internal program error */ -#define VSCP_ERROR_COMMUNICATION 37 /* Some kind of communication error */ -#define VSCP_ERROR_USER 38 /* Login error user name */ -#define VSCP_ERROR_PASSWORD 39 /* Login error password */ -#define VSCP_ERROR_CONNECTION 40 /* Could not connect */ -#define VSCP_ERROR_INVALID_HANDLE 41 /* The handle is not valid */ -#define VSCP_ERROR_OPERATION_FAILED 42 /* Operation failed for some reason */ -#define VSCP_ERROR_BUFFER_TO_SMALL \ - 43 /* Supplied buffer is to small to fit content */ -#define VSCP_ERROR_UNKNOWN_ITEM \ - 44 /* Requested item (remote variable) is unknown */ -#define VSCP_ERROR_ALREADY_DEFINED 45 /* The name is already in use. */ -#define VSCP_ERROR_WRITE_ERROR 46 /* Error when writing data */ -#define VSCP_ERROR_WRITE 46 /* Error when writing data */ -#define VSCP_ERROR_STOPPED 47 /* Operation stopped or aborted */ -#define VSCP_ERROR_INVALID_POINTER 48 /* Pointer with invalid value */ -#define VSCP_ERROR_INVALID_PERMISSION 49 /* Not allowed to do that */ -#define VSCP_ERROR_INVALID_PATH 50 /* Invalid path (permissions) */ -#define VSCP_ERROR_ERRNO 51 /* General error, errno variable holds error */ -#define VSCP_ERROR_INTERRUPTED 52 /* Interrupted by signal or other cause */ -#define VSCP_ERROR_MISSING 53 /* Value, paramter or something else is missing */ -#define VSCP_ERROR_NOT_CONNECTED 54 /* There is no connection */ -#define VSCP_ERROR_READ_ONLY 55 /* Item (variable) is read only */ -#define VSCP_ERROR_INVALID_TYPE 56 /* Item (variable) is of wrong type */ -#define VSCP_ERROR_PERMISSION 57 /* Does hot have permission to do that */ -#define VSCP_ERROR_INVALID_SYNTAX 58 /* Syntax is invalid */ -#define VSCP_ERROR_INDEX_OOB 59 /* Index is out of bounds */ +#define VSCP_ERROR_SUCCESS 0 /* All is OK */ +#define VSCP_ERROR_ERROR -1 /* Error */ +#define VSCP_ERROR_CHANNEL 7 /* Invalid channel */ +#define VSCP_ERROR_FIFO_EMPTY 8 /* FIFO is empty */ +#define VSCP_ERROR_FIFO_FULL 9 /* FIFO is full */ +#define VSCP_ERROR_FIFO_SIZE 10 /* FIFO size error */ +#define VSCP_ERROR_FIFO_WAIT 11 /* FIFO wait failed */ +#define VSCP_ERROR_GENERIC 12 /* Generic error */ +#define VSCP_ERROR_HARDWARE 13 /* Hardware error */ +#define VSCP_ERROR_INIT_FAIL 14 /* Initialization failed */ +#define VSCP_ERROR_INIT_MISSING 15 /* No init */ +#define VSCP_ERROR_INIT_READY 16 /* Failed init */ +#define VSCP_ERROR_NOT_SUPPORTED 17 /* Not supported */ +#define VSCP_ERROR_OVERRUN 18 /* Overrun */ +#define VSCP_ERROR_RCV_EMPTY 19 /* Receive buffer empty */ +#define VSCP_ERROR_REGISTER 20 /* Register value error */ +#define VSCP_ERROR_TRM_FULL 21 /* Transmit buffer full */ +#define VSCP_ERROR_LIBRARY 28 /* Unable to load library */ +#define VSCP_ERROR_PROCADDRESS 29 /* Unable get library proc. address */ +#define VSCP_ERROR_ONLY_ONE_INSTANCE 30 /* Only one instance allowed */ +#define VSCP_ERROR_SUB_DRIVER 31 /* Problem with sub driver call */ +#define VSCP_ERROR_TIMEOUT 32 /* Time-out */ +#define VSCP_ERROR_NOT_OPEN 33 /* The device is not open. */ +#define VSCP_ERROR_PARAMETER 34 /* A parameter is invalid. */ +#define VSCP_ERROR_MEMORY 35 /* Memory exhausted. */ +#define VSCP_ERROR_INTERNAL 36 /* Some kind of internal program error */ +#define VSCP_ERROR_COMMUNICATION 37 /* Some kind of communication error */ +#define VSCP_ERROR_USER 38 /* Login error user name */ +#define VSCP_ERROR_PASSWORD 39 /* Login error password */ +#define VSCP_ERROR_CONNECTION 40 /* Could not connect */ +#define VSCP_ERROR_INVALID_HANDLE 41 /* The handle is not valid */ +#define VSCP_ERROR_OPERATION_FAILED 42 /* Operation failed for some reason */ +#define VSCP_ERROR_BUFFER_TO_SMALL 43 /* Supplied buffer is to small to fit content */ +#define VSCP_ERROR_UNKNOWN_ITEM 44 /* Requested item (remote variable) is unknown */ +#define VSCP_ERROR_ALREADY_DEFINED 45 /* The name is already in use. */ +#define VSCP_ERROR_WRITE_ERROR 46 /* Error when writing data */ +#define VSCP_ERROR_WRITE 46 /* Error when writing data */ +#define VSCP_ERROR_STOPPED 47 /* Operation stopped or aborted */ +#define VSCP_ERROR_INVALID_POINTER 48 /* Pointer with invalid value */ +#define VSCP_ERROR_INVALID_PERMISSION 49 /* Not allowed to do that */ +#define VSCP_ERROR_INVALID_PATH 50 /* Invalid path (permissions) */ +#define VSCP_ERROR_ERRNO 51 /* General error, errno variable holds error */ +#define VSCP_ERROR_INTERRUPTED 52 /* Interrupted by signal or other cause */ +#define VSCP_ERROR_MISSING 53 /* Value, parameter or something else is missing */ +#define VSCP_ERROR_NOT_CONNECTED 54 /* There is no connection */ +#define VSCP_ERROR_READ_ONLY 55 /* Item (variable) is read only */ +#define VSCP_ERROR_INVALID_TYPE 56 /* Item (variable) is of wrong type */ +#define VSCP_ERROR_PERMISSION 57 /* Does hot have permission to do that */ +#define VSCP_ERROR_INVALID_SYNTAX 58 /* Syntax is invalid */ +#define VSCP_ERROR_INDEX_OOB 59 /* Index is out of bounds */ +#define VSCP_ERROR_MTU 60 /* Frame does not fit */ +#define VSCP_ERROR_SOCKET 61 /* Unable to create socket or other socket error*/ +#define VSCP_ERROR_PARSING 62 /* Failed to parse input */ +#define VSCP_ERROR_INVALID_FRAME 63 /* A protocol has wrong format */ +#define VSCP_ERROR_SIZE 64 /* The size is wring */ +#define VSCP_ERROR_NACK 65 /* NACK received */ +#define VSCP_ERROR_READ_ERROR 66 /* Error when reading data */ +#define VSCP_ERROR_READ 66 /* DUPLICATE FOR CONVENIENCE! Error when reading data */ +#define VSCP_ERROR_INVALID_CHECKSUM 67 /* Checksum is not correct */ +#define VSCP_ERROR_INTERFACE 68 /* Interface error (not defined etc) */ /*! HLO (High Level Object) type (bits 7,6,5,4) */ -#define VSCP_HLO_TYPE_UTF8 0 -#define VSCP_HLO_TYPE_XML 1 -#define VSCP_HLO_TYPE_JSON 2 -#define VSCP_HLO_TYPE_BASE64 3 -#define VSCP_HLO_TYPE_USER_DEFINED 15 +#define VSCP_HLO_TYPE_UTF8 0 +#define VSCP_HLO_TYPE_XML 1 +#define VSCP_HLO_TYPE_JSON 2 +#define VSCP_HLO_TYPE_BASE64 3 +#define VSCP_HLO_TYPE_USER_DEFINED 15 /*! HLO (High Level Object) encryption (bits 3,2,1,0) */ -#define VSCP_HLO_ENCRYPTION_NONE 0 -#define VSCP_HLO_ENCRYPTION_AES128 1 -#define VSCP_HLO_ENCRYPTION_AES192 2 -#define VSCP_HLO_ENCRYPTION_AES256 3 +#define VSCP_HLO_ENCRYPTION_NONE 0 +#define VSCP_HLO_ENCRYPTION_AES128 1 +#define VSCP_HLO_ENCRYPTION_AES192 2 +#define VSCP_HLO_ENCRYPTION_AES256 3 +#define VSCP_HLO_ENCRYPTION_USER 255 /* User defined encryption */ /* Template for VSCP XML event data @@ -646,17 +697,17 @@ datetime,vscpHead,vscpObId,vscpDateTime,vscpTimeStamp,vscpClass,vscpType,vscpGui vscpData="0x48,0x34,0x35,0x2E,0x34,0x36,0x34" /> */ -#define VSCP_XML_EVENT_TEMPLATE \ - "" +#define VSCP_XML_EVENT_TEMPLATE \ + "" /* @@ -675,18 +726,18 @@ datetime,vscpHead,vscpObId,vscpDateTime,vscpTimeStamp,vscpClass,vscpType,vscpGui "vscpNote": "This is some text" } */ -#define VSCP_JSON_EVENT_TEMPLATE \ - "{\n" \ - "\"vscpHead\": %d,\n" \ - "\"vscpObId\": %lu,\n" \ - "\"vscpDateTime\": \"%s\",\n" \ - "\"vscpTimeStamp\": %lu,\n" \ - "\"vscpClass\": %d,\n" \ - "\"vscpType\": %d,\n" \ - "\"vscpGuid\": \"%s\",\n" \ - "\"vscpData\": [%s],\n" \ - "\"vscpNote\": \"%s\"\n" \ - "}" +#define VSCP_JSON_EVENT_TEMPLATE \ + "{\n" \ + "\"vscpHead\": %d,\n" \ + "\"vscpObId\": %lu,\n" \ + "\"vscpDateTime\": \"%s\",\n" \ + "\"vscpTimeStamp\": %lu,\n" \ + "\"vscpClass\": %d,\n" \ + "\"vscpType\": %d,\n" \ + "\"vscpGuid\": \"%s\",\n" \ + "\"vscpData\": [%s],\n" \ + "\"vscpNote\": \"%s\"\n" \ + "}" /*! @@ -718,53 +769,58 @@ note: This is a note

*/ -#define VSCP_HTML_EVENT_TEMPLATE \ - "

VSCP Event

" \ - "

" \ - "Class: %d
" \ - "Type: %d
" \ - "

" \ - "

" \ - "Data count: %d
" \ - "Data: %s
" \ - "

" \ - "

" \ - "From GUID: %s
" \ - "

" \ - "

" \ - "vscpHead: %d
" \ - "

" \ - "DateTime: %s
" \ - "

" \ - "Timestamp: %lu
" \ - "ObId: %lu
" \ - "note: %s
" \ - "

" - -#define VSCP_XML_FILTER_TEMPLATE \ - "" - -#define VSCP_JSON_FILTER_TEMPLATE \ - "{\n" \ - "\"mask_priority\": %d,\n" \ - "\"mask_class\": %d,\n" \ - "\"mask_type\": %d,\n" \ - "\"mask_guid\": \"%s\",\n" \ - "\"filter_priority\": %d,\n" \ - "\"filter_class\": %d,\n" \ - "\"filter_type\": %d,\n" \ - "\"filter_guid\": \"%s\",\n" \ - "}" +#define VSCP_HTML_EVENT_TEMPLATE \ + "

VSCP Event

" \ + "

" \ + "Class: %d
" \ + "Type: %d
" \ + "

" \ + "

" \ + "Data count: %d
" \ + "Data: %s
" \ + "

" \ + "

" \ + "From GUID: %s
" \ + "

" \ + "

" \ + "vscpHead: %d
" \ + "

" \ + "DateTime: %s
" \ + "

" \ + "Timestamp: %lu
" \ + "ObId: %lu
" \ + "note: %s
" \ + "

" + +#define VSCP_XML_FILTER_TEMPLATE \ + "" + +#define VSCP_JSON_FILTER_TEMPLATE \ + "{\n" \ + "\"mask_priority\": %d,\n" \ + "\"mask_class\": %d,\n" \ + "\"mask_type\": %d,\n" \ + "\"mask_guid\": \"%s\",\n" \ + "\"filter_priority\": %d,\n" \ + "\"filter_class\": %d,\n" \ + "\"filter_type\": %d,\n" \ + "\"filter_guid\": \"%s\",\n" \ + "}" // MQTT message formats -enum enumMqttMsgFormat {jsonfmt,xmlfmt,strfmt,binfmt,autofmt}; +enum enumMqttMsgFormat { jsonfmt, xmlfmt, strfmt, binfmt, autofmt }; + +// Droplet protocol defines +#define VSCP_DROPLET_ALPHA 0 +#define VSCP_DROPLET_BETA 1 +#define VSCP_DROPLET_GAMMA 2 #ifdef __cplusplus } diff --git a/nodeSim/makefile b/nodeSim/makefile index 67be5dc..866341c 100644 --- a/nodeSim/makefile +++ b/nodeSim/makefile @@ -45,7 +45,8 @@ INCLUDES= -I. \ -I../common/vscp-bootloader/src \ -I../common/vscphelper \ -I../common/vscp-framework/src \ - -I../common/vscp-framework/src/events + -I../common/vscp-framework/src/events \ + -I/usr/include # Sources SOURCES= main.c \ @@ -121,7 +122,8 @@ BUILDOS= linux endif # Library search path (-L...) -LIBPATH= -L../common/vscphelper/lib/$(BUILDOS)/$(BUILDTYPE) +LIBPATH= -L../common/vscphelper/lib/$(BUILDOS)/$(BUILDTYPE) \ + -L/usr/lib # Libraries (-l...) LIBRARIES= -lm -lvscphelper -lexpat From a55567476a73fbb158c6e4979951f67b3f58f941 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 18 Dec 2024 18:16:18 +0100 Subject: [PATCH 02/14] Next tool versions prepared. --- logger/makefile | 2 +- nodeSim/makefile | 2 +- programmer/makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/logger/makefile b/logger/makefile index 2ee976e..88228d2 100644 --- a/logger/makefile +++ b/logger/makefile @@ -33,7 +33,7 @@ ################################################################################ # Software version -VERSION= 0.1.0 +VERSION= 0.2.0 # Binary file name BIN= vscpLoggerPc diff --git a/nodeSim/makefile b/nodeSim/makefile index 866341c..f4faf3e 100644 --- a/nodeSim/makefile +++ b/nodeSim/makefile @@ -33,7 +33,7 @@ ################################################################################ # Software version -VERSION= 0.4.1 +VERSION= 0.5.0 # Binary file name BIN= vscpExamplePc diff --git a/programmer/makefile b/programmer/makefile index 16bdc96..7fda04d 100644 --- a/programmer/makefile +++ b/programmer/makefile @@ -33,7 +33,7 @@ ################################################################################ # Software version -VERSION= 0.1.0 +VERSION= 0.2.0 # Binary file name BIN= vscpProgrammerPc From 669a985548e2dce40ba74c21b8891d371cf6eb03 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 18 Dec 2024 18:55:34 +0100 Subject: [PATCH 03/14] Trigger CI on every feature branch push. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 19dde80..8dcfdb3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ name: CI on: # Triggers the workflow on push or pull request events but only for the master branch push: - branches: [ master ] + branches: [ feature/** ] pull_request: branches: [ master ] From 9794eee836e272aac58229b60a963dcad7065eaf Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Mon, 6 Jan 2025 20:23:04 +0100 Subject: [PATCH 04/14] vscp-framework branch updated to get VSCP v1.15.4 compliance. --- common/vscp-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/vscp-framework b/common/vscp-framework index 40e0c04..58871cb 160000 --- a/common/vscp-framework +++ b/common/vscp-framework @@ -1 +1 @@ -Subproject commit 40e0c04ca43f48f4fc509216841d6ba53dfa7bfa +Subproject commit 58871cb05fffd35357069c40131e6efee356f432 From 6c2dccb1f50fdfa2b176a275099b9877b4f0acb0 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Mon, 6 Jan 2025 20:57:02 +0100 Subject: [PATCH 05/14] Copyright year updated. --- LICENSE | 2 +- common/cmdLineParser.c | 2 +- common/cmdLineParser.h | 2 +- common/log.c | 2 +- common/log.h | 2 +- common/platform.c | 2 +- common/platform.h | 2 +- common/vscp-bootloader | 2 +- common/vscp-framework | 2 +- logger/main.c | 4 ++-- logger/makefile | 2 +- nodeSim/dmExt.xml | 2 +- nodeSim/dmNG.xml | 2 +- nodeSim/dmStd.xml | 2 +- nodeSim/eeprom.c | 2 +- nodeSim/eeprom.h | 2 +- nodeSim/lamp_sim.c | 2 +- nodeSim/lamp_sim.h | 2 +- nodeSim/main.c | 4 ++-- nodeSim/makefile | 2 +- nodeSim/mdf/exp02.xml | 2 +- nodeSim/temperature_sim.c | 2 +- nodeSim/temperature_sim.h | 2 +- nodeSim/vscp_thread.c | 2 +- nodeSim/vscp_thread.h | 2 +- nodeSim/vscp_user/dm_ext_xml.c | 2 +- nodeSim/vscp_user/dm_ext_xml.h | 2 +- nodeSim/vscp_user/dm_std_xml.c | 2 +- nodeSim/vscp_user/dm_std_xml.h | 2 +- nodeSim/vscp_user/vscp_action.c | 2 +- nodeSim/vscp_user/vscp_action.h | 2 +- nodeSim/vscp_user/vscp_app_reg.c | 2 +- nodeSim/vscp_user/vscp_app_reg.h | 2 +- nodeSim/vscp_user/vscp_bl_adapter.c | 2 +- nodeSim/vscp_user/vscp_bl_adapter.h | 2 +- nodeSim/vscp_user/vscp_config_overwrite.h | 2 +- nodeSim/vscp_user/vscp_dev_data_config_overwrite.h | 2 +- nodeSim/vscp_user/vscp_platform.h | 2 +- nodeSim/vscp_user/vscp_portable.c | 2 +- nodeSim/vscp_user/vscp_portable.h | 2 +- nodeSim/vscp_user/vscp_ps_access.c | 2 +- nodeSim/vscp_user/vscp_ps_access.h | 2 +- nodeSim/vscp_user/vscp_timer.c | 2 +- nodeSim/vscp_user/vscp_timer.h | 2 +- nodeSim/vscp_user/vscp_tp_adapter.c | 2 +- nodeSim/vscp_user/vscp_tp_adapter.h | 2 +- programmer/intelHexParser.c | 2 +- programmer/intelHexParser.h | 2 +- programmer/main.c | 4 ++-- programmer/makefile | 2 +- 50 files changed, 53 insertions(+), 53 deletions(-) diff --git a/LICENSE b/LICENSE index 80121f2..96af6d8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 - 2024 Andreas Merkle +Copyright (c) 2014 - 2025 Andreas Merkle http://www.blue-andi.de vscp@blue-andi.de diff --git a/common/cmdLineParser.c b/common/cmdLineParser.c index 024fd08..b969ffc 100644 --- a/common/cmdLineParser.c +++ b/common/cmdLineParser.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/common/cmdLineParser.h b/common/cmdLineParser.h index e224ca7..5cb3cc9 100644 --- a/common/cmdLineParser.h +++ b/common/cmdLineParser.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/common/log.c b/common/log.c index d175a1e..c2eed0c 100644 --- a/common/log.c +++ b/common/log.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/common/log.h b/common/log.h index 08cd159..b0ab228 100644 --- a/common/log.h +++ b/common/log.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/common/platform.c b/common/platform.c index 5e4ea4f..123b29d 100644 --- a/common/platform.c +++ b/common/platform.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/common/platform.h b/common/platform.h index 050d3ab..5f260d0 100644 --- a/common/platform.h +++ b/common/platform.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/common/vscp-bootloader b/common/vscp-bootloader index ad738fc..9adc3d2 160000 --- a/common/vscp-bootloader +++ b/common/vscp-bootloader @@ -1 +1 @@ -Subproject commit ad738fc469aa72a114d5ba9cc34e60f023d5b9a9 +Subproject commit 9adc3d26e9646ea7030964714ba454e03d72475c diff --git a/common/vscp-framework b/common/vscp-framework index 58871cb..53efc39 160000 --- a/common/vscp-framework +++ b/common/vscp-framework @@ -1 +1 @@ -Subproject commit 58871cb05fffd35357069c40131e6efee356f432 +Subproject commit 53efc39c18284e0b28071b538b53a202438ed620 diff --git a/logger/main.c b/logger/main.c index 10bb884..0df8ce0 100644 --- a/logger/main.c +++ b/logger/main.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * @@ -61,7 +61,7 @@ This module contains the main entry point. #define MAIN_PROG_NAME "VSCP logger" /** Copyright */ -#define MAIN_COPYRIGHT "(c) 2014 - 2024 Andreas Merkle" +#define MAIN_COPYRIGHT "(c) 2014 - 2025 Andreas Merkle" /** Default log level */ #define MAIN_LOG_LEVEL_DEFAULT (LOG_LEVEL_FATAL) diff --git a/logger/makefile b/logger/makefile index 88228d2..506ef93 100644 --- a/logger/makefile +++ b/logger/makefile @@ -1,6 +1,6 @@ # The MIT License (MIT) # -# Copyright (c) 2014 - 2024 Andreas Merkle +# Copyright (c) 2014 - 2025 Andreas Merkle # http://www.blue-andi.de # vscp@blue-andi.de # diff --git a/nodeSim/dmExt.xml b/nodeSim/dmExt.xml index a1e6e63..b778d67 100644 --- a/nodeSim/dmExt.xml +++ b/nodeSim/dmExt.xml @@ -4,7 +4,7 @@ The MIT License (MIT) -Copyright (c) 2014 - 2024 Andreas Merkle +Copyright (c) 2014 - 2025 Andreas Merkle http://www.blue-andi.de vscp@blue-andi.de diff --git a/nodeSim/dmNG.xml b/nodeSim/dmNG.xml index 6a0b0df..57674cd 100644 --- a/nodeSim/dmNG.xml +++ b/nodeSim/dmNG.xml @@ -4,7 +4,7 @@ The MIT License (MIT) -Copyright (c) 2014 - 2024 Andreas Merkle +Copyright (c) 2014 - 2025 Andreas Merkle http://www.blue-andi.de vscp@blue-andi.de diff --git a/nodeSim/dmStd.xml b/nodeSim/dmStd.xml index 7681b19..0f7f010 100644 --- a/nodeSim/dmStd.xml +++ b/nodeSim/dmStd.xml @@ -4,7 +4,7 @@ The MIT License (MIT) -Copyright (c) 2014 - 2024 Andreas Merkle +Copyright (c) 2014 - 2025 Andreas Merkle http://www.blue-andi.de vscp@blue-andi.de diff --git a/nodeSim/eeprom.c b/nodeSim/eeprom.c index a56650b..4e13365 100644 --- a/nodeSim/eeprom.c +++ b/nodeSim/eeprom.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/eeprom.h b/nodeSim/eeprom.h index ff981c1..82a5132 100644 --- a/nodeSim/eeprom.h +++ b/nodeSim/eeprom.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/lamp_sim.c b/nodeSim/lamp_sim.c index 84c842f..c4a1334 100644 --- a/nodeSim/lamp_sim.c +++ b/nodeSim/lamp_sim.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/lamp_sim.h b/nodeSim/lamp_sim.h index b6b0c8b..e2c3d47 100644 --- a/nodeSim/lamp_sim.h +++ b/nodeSim/lamp_sim.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/main.c b/nodeSim/main.c index d3ec9b6..d1b8c9e 100644 --- a/nodeSim/main.c +++ b/nodeSim/main.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * @@ -71,7 +71,7 @@ This module contains the main entry point. #define MAIN_PROG_NAME "VSCP level 1 node" /** Copyright */ -#define MAIN_COPYRIGHT "(c) 2014 - 2024 Andreas Merkle" +#define MAIN_COPYRIGHT "(c) 2014 - 2025 Andreas Merkle" /** Persistent memory filename */ #define MAIN_EEPROM_FILENAME "eeprom.asc" diff --git a/nodeSim/makefile b/nodeSim/makefile index f4faf3e..4f58b0b 100644 --- a/nodeSim/makefile +++ b/nodeSim/makefile @@ -1,6 +1,6 @@ # The MIT License (MIT) # -# Copyright (c) 2014 - 2024 Andreas Merkle +# Copyright (c) 2014 - 2025 Andreas Merkle # http://www.blue-andi.de # vscp@blue-andi.de # diff --git a/nodeSim/mdf/exp02.xml b/nodeSim/mdf/exp02.xml index 9f27a03..a34b78a 100644 --- a/nodeSim/mdf/exp02.xml +++ b/nodeSim/mdf/exp02.xml @@ -4,7 +4,7 @@ The MIT License (MIT) -Copyright (c) 2014 - 2024 Andreas Merkle +Copyright (c) 2014 - 2025 Andreas Merkle http://www.blue-andi.de vscp@blue-andi.de diff --git a/nodeSim/temperature_sim.c b/nodeSim/temperature_sim.c index 98424e6..4cea05c 100644 --- a/nodeSim/temperature_sim.c +++ b/nodeSim/temperature_sim.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/temperature_sim.h b/nodeSim/temperature_sim.h index ee15c03..9fd5f3a 100644 --- a/nodeSim/temperature_sim.h +++ b/nodeSim/temperature_sim.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_thread.c b/nodeSim/vscp_thread.c index d8ba5d7..f6d4904 100644 --- a/nodeSim/vscp_thread.c +++ b/nodeSim/vscp_thread.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_thread.h b/nodeSim/vscp_thread.h index 14f5095..b714990 100644 --- a/nodeSim/vscp_thread.h +++ b/nodeSim/vscp_thread.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/dm_ext_xml.c b/nodeSim/vscp_user/dm_ext_xml.c index 253b73e..9b5dbfe 100644 --- a/nodeSim/vscp_user/dm_ext_xml.c +++ b/nodeSim/vscp_user/dm_ext_xml.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/dm_ext_xml.h b/nodeSim/vscp_user/dm_ext_xml.h index eef17f9..cd4b4f1 100644 --- a/nodeSim/vscp_user/dm_ext_xml.h +++ b/nodeSim/vscp_user/dm_ext_xml.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/dm_std_xml.c b/nodeSim/vscp_user/dm_std_xml.c index 416dd5f..4750d1a 100644 --- a/nodeSim/vscp_user/dm_std_xml.c +++ b/nodeSim/vscp_user/dm_std_xml.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/dm_std_xml.h b/nodeSim/vscp_user/dm_std_xml.h index 053b047..03b5167 100644 --- a/nodeSim/vscp_user/dm_std_xml.h +++ b/nodeSim/vscp_user/dm_std_xml.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_action.c b/nodeSim/vscp_user/vscp_action.c index 00bb9c2..1469a3d 100644 --- a/nodeSim/vscp_user/vscp_action.c +++ b/nodeSim/vscp_user/vscp_action.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_action.h b/nodeSim/vscp_user/vscp_action.h index 28698fc..ea78ad5 100644 --- a/nodeSim/vscp_user/vscp_action.h +++ b/nodeSim/vscp_user/vscp_action.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_app_reg.c b/nodeSim/vscp_user/vscp_app_reg.c index ae215d2..fb1586c 100644 --- a/nodeSim/vscp_user/vscp_app_reg.c +++ b/nodeSim/vscp_user/vscp_app_reg.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_app_reg.h b/nodeSim/vscp_user/vscp_app_reg.h index 7243048..59eacb8 100644 --- a/nodeSim/vscp_user/vscp_app_reg.h +++ b/nodeSim/vscp_user/vscp_app_reg.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_bl_adapter.c b/nodeSim/vscp_user/vscp_bl_adapter.c index 9a5b8aa..abaadc1 100644 --- a/nodeSim/vscp_user/vscp_bl_adapter.c +++ b/nodeSim/vscp_user/vscp_bl_adapter.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_bl_adapter.h b/nodeSim/vscp_user/vscp_bl_adapter.h index 409facc..ddf29eb 100644 --- a/nodeSim/vscp_user/vscp_bl_adapter.h +++ b/nodeSim/vscp_user/vscp_bl_adapter.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_config_overwrite.h b/nodeSim/vscp_user/vscp_config_overwrite.h index 1d3bf0e..ad10a19 100644 --- a/nodeSim/vscp_user/vscp_config_overwrite.h +++ b/nodeSim/vscp_user/vscp_config_overwrite.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_dev_data_config_overwrite.h b/nodeSim/vscp_user/vscp_dev_data_config_overwrite.h index be4c03c..b99769d 100644 --- a/nodeSim/vscp_user/vscp_dev_data_config_overwrite.h +++ b/nodeSim/vscp_user/vscp_dev_data_config_overwrite.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_platform.h b/nodeSim/vscp_user/vscp_platform.h index c1ca94a..812dade 100644 --- a/nodeSim/vscp_user/vscp_platform.h +++ b/nodeSim/vscp_user/vscp_platform.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_portable.c b/nodeSim/vscp_user/vscp_portable.c index 7a05175..0786a5c 100644 --- a/nodeSim/vscp_user/vscp_portable.c +++ b/nodeSim/vscp_user/vscp_portable.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_portable.h b/nodeSim/vscp_user/vscp_portable.h index 7c51771..c69ff4b 100644 --- a/nodeSim/vscp_user/vscp_portable.h +++ b/nodeSim/vscp_user/vscp_portable.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_ps_access.c b/nodeSim/vscp_user/vscp_ps_access.c index fb7df8c..e9df158 100644 --- a/nodeSim/vscp_user/vscp_ps_access.c +++ b/nodeSim/vscp_user/vscp_ps_access.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_ps_access.h b/nodeSim/vscp_user/vscp_ps_access.h index e1fe408..cd14784 100644 --- a/nodeSim/vscp_user/vscp_ps_access.h +++ b/nodeSim/vscp_user/vscp_ps_access.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_timer.c b/nodeSim/vscp_user/vscp_timer.c index eea049f..5167a6f 100644 --- a/nodeSim/vscp_user/vscp_timer.c +++ b/nodeSim/vscp_user/vscp_timer.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_timer.h b/nodeSim/vscp_user/vscp_timer.h index 48b417f..f604e5f 100644 --- a/nodeSim/vscp_user/vscp_timer.h +++ b/nodeSim/vscp_user/vscp_timer.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_tp_adapter.c b/nodeSim/vscp_user/vscp_tp_adapter.c index f4d6189..e389f04 100644 --- a/nodeSim/vscp_user/vscp_tp_adapter.c +++ b/nodeSim/vscp_user/vscp_tp_adapter.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/nodeSim/vscp_user/vscp_tp_adapter.h b/nodeSim/vscp_user/vscp_tp_adapter.h index f5b9acd..991cca4 100644 --- a/nodeSim/vscp_user/vscp_tp_adapter.h +++ b/nodeSim/vscp_user/vscp_tp_adapter.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/programmer/intelHexParser.c b/programmer/intelHexParser.c index eeacf57..fca00b0 100644 --- a/programmer/intelHexParser.c +++ b/programmer/intelHexParser.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/programmer/intelHexParser.h b/programmer/intelHexParser.h index d5864c6..6d068f5 100644 --- a/programmer/intelHexParser.h +++ b/programmer/intelHexParser.h @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * diff --git a/programmer/main.c b/programmer/main.c index 24b8bb6..d7fe878 100644 --- a/programmer/main.c +++ b/programmer/main.c @@ -1,6 +1,6 @@ /* The MIT License (MIT) * - * Copyright (c) 2014 - 2024 Andreas Merkle + * Copyright (c) 2014 - 2025 Andreas Merkle * http://www.blue-andi.de * vscp@blue-andi.de * @@ -64,7 +64,7 @@ This module contains the main entry point. #define MAIN_PROG_NAME "VSCP L1 programmer" /** Copyright */ -#define MAIN_COPYRIGHT "(c) 2014 - 2024 Andreas Merkle" +#define MAIN_COPYRIGHT "(c) 2014 - 2025 Andreas Merkle" /** Default log level */ #define MAIN_LOG_LEVEL_DEFAULT (LOG_LEVEL_FATAL) diff --git a/programmer/makefile b/programmer/makefile index 7fda04d..41b9a62 100644 --- a/programmer/makefile +++ b/programmer/makefile @@ -1,6 +1,6 @@ # The MIT License (MIT) # -# Copyright (c) 2014 - 2024 Andreas Merkle +# Copyright (c) 2014 - 2025 Andreas Merkle # http://www.blue-andi.de # vscp@blue-andi.de # From 663789f3ed12e4d2993ae4ec585b7e138365542c Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Tue, 14 Jan 2025 23:34:24 +0100 Subject: [PATCH 06/14] Updated for linux, based on Ubuntu. --- README.md | 77 ++++++++++++++++++++++++++++++++++++--------- logger/makefile | 6 ++-- nodeSim/makefile | 4 +-- programmer/makefile | 6 ++-- 4 files changed, 70 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 7dd96a5..2ad09e8 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,20 @@ Command line interface tools used to maintain or simulate VSCP nodes. -* [VSCP CLI Tools](#vscp-cli-tools) -* [VSCP](#vscp) -* [Tools](#tools) -* [How To Build](#how-to-build) - * [Prerequisite](#prerequisite) - * [Linux](#linux) - * [Windows](#windows) - * [1 Clone The Repository](#1-clone-the-repository) - * [2 Choose Project](#2-choose-project) - * [3 Build](#3-build) -* [Issues, Ideas And Bugs](#issues-ideas-and-bugs) -* [License](#license) -* [Contribution](#contribution) +- [VSCP CLI Tools](#vscp-cli-tools) +- [VSCP](#vscp) +- [Tools](#tools) +- [How To Build](#how-to-build) + - [Prerequisite](#prerequisite) + - [Linux](#linux) + - [Windows](#windows) + - [1 Clone The Repository](#1-clone-the-repository) + - [2 Choose Project](#2-choose-project) + - [3 Build](#3-build) +- [Used Libraries](#used-libraries) +- [Issues, Ideas And Bugs](#issues-ideas-and-bugs) +- [License](#license) +- [Contribution](#contribution) # VSCP @@ -49,8 +50,46 @@ More information can be found on the main site http://www.vscp.org ``` 2. Install expat packages: ```bash - sudo apt install libexpat - sudo apt install libexpat-devel + sudo apt install libexpat1 + sudo apt install libexpat1-dev + ``` +3. Install OpenSSL v1.1: + 1. Install dependencies: + ```bash + sudo apt install checkinstall zlib1g-dev + ``` + 2. Download OpenSSL: + ```bash + cd /usr/local/src/ + sudo wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz + sudo tar -xf openssl-1.1.1k.tar.gz + cd openssl-1.1.1k.tar.gz + ``` + 3. Install and compile OpenSSL: + ```bash + sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib + sudo make + sudo make test + sudo make install + ``` + 4. Configure link libraries: + ```bash + cd /etc/ld.so.conf.d/ + sudo nano openssl-1.1.1k.conf + ``` + Now add /usr/local/ssl/lib to the openssl-1.1.1k.conf file and save. + 5. Reload dynamic link: + ```bash + sudo ldconfig -v + ``` +4. Install vscp-helper-lib: + 1. Download vscp-helper-lib: + ```bash + sudo wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v15.0.0/libvscphelper_15.0.0_amd64.deb + ``` + 2. Install vscp-helper-lib: + ```bash + sudo apt install libvscphelper_15.0.0_amd64.deb ``` ### Windows @@ -87,6 +126,14 @@ Choose the project by entering the corresponding folder, e.g. ```/nodeSim```. Build debug variant with ```make debug``` or use ```make release``` for the release variant. The result will be in the ```//bin``` folder. +# Used Libraries + +| Library | Description | License | +| - | - | - | +| [Expat](https://github.com/libexpat/libexpat) | Fast streaming XML parser. | MIT | +| [OpenSSL](https://github.com/openssl/openssl) | OpenSSL is a robust, commercial-grade, full-featured Open Source Toolkit for the TLS (formerly SSL), DTLS and QUIC (currently client side only) protocols. | Apache-2.0 | +| [vscp-helper-lib](https://github.com/grodansparadis/vscp-helper-lib) | VSCP helper functionality | MIT | + # Issues, Ideas And Bugs If you have further ideas or you found some bugs, great! Create a [issue](https://github.com/BlueAndi/vscp-cli-tools/issues) or if you are able and willing to fix it by yourself, clone the repository and create a pull request. diff --git a/logger/makefile b/logger/makefile index 506ef93..ab39ebb 100644 --- a/logger/makefile +++ b/logger/makefile @@ -72,13 +72,13 @@ endif LIBPATH= -L../common/vscphelper/lib/$(BUILDOS)/$(BUILDTYPE) # Libraries (-l...) -LIBRARIES= -lm -lvscphelper +LIBRARIES= -lm -lvscphelper -lexpat # Windows specific part ifeq ($(OS),Windows_NT) LIBRARIES+= -lws2_32 else -LIBRARIES+= -ldl -lexpat +LIBRARIES+= -ldl -lssl endif # Preprocessor defines @@ -98,7 +98,7 @@ CFLAGS= -Wall -ffunction-sections -fdata-sections -fshort-enums -std=gnu99 -funs # -Wl,--cref : Add cross reference to map file # -Wl,--gc-sections : Enable garbage collection of unused input sections # -Wl,-rpath='$$ORIGIN/../lib/linux' : Set shared object search path -LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections -Wl,-rpath='$$ORIGIN/../../../../common/pc/vscphelper/lib/linux/$(BUILDTYPE)' +LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections -Wl,-rpath='$$ORIGIN/usr/lib/x86_64-linux-gnu/' ifeq ($(MAKECMDGOALS),debug) diff --git a/nodeSim/makefile b/nodeSim/makefile index 4f58b0b..1747288 100644 --- a/nodeSim/makefile +++ b/nodeSim/makefile @@ -132,7 +132,7 @@ LIBRARIES= -lm -lvscphelper -lexpat ifeq ($(OS),Windows_NT) LIBRARIES+= -lws2_32 else -LIBRARIES+= -ldl -lexpat -lpthread +LIBRARIES+= -ldl -lpthread -lssl endif # Preprocessor defines @@ -152,7 +152,7 @@ CFLAGS= -Wall -ffunction-sections -fdata-sections -fshort-enums -std=gnu99 -funs # -Wl,--cref : Add cross reference to map file # -Wl,--gc-sections : Enable garbage collection of unused input sections # -Wl,-rpath='$$ORIGIN/../lib/linux' : Set shared object search path -LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections -Wl,-rpath='$$ORIGIN/../../../../common/pc/vscphelper/lib/linux/$(BUILDTYPE)' +LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections -Wl,-rpath='$$ORIGIN/usr/lib/x86_64-linux-gnu/' ifeq ($(MAKECMDGOALS),debug) diff --git a/programmer/makefile b/programmer/makefile index 41b9a62..30bca97 100644 --- a/programmer/makefile +++ b/programmer/makefile @@ -75,13 +75,13 @@ endif LIBPATH= -L../common/vscphelper/lib/$(BUILDOS)/$(BUILDTYPE) # Libraries (-l...) -LIBRARIES= -lm -lvscphelper +LIBRARIES= -lm -lvscphelper -lexpat # Windows specific part ifeq ($(OS),Windows_NT) LIBRARIES+= -lws2_32 else -LIBRARIES+= -ldl -lexpat +LIBRARIES+= -ldl -lssl endif # Preprocessor defines @@ -101,7 +101,7 @@ CFLAGS= -Wall -ffunction-sections -fdata-sections -fshort-enums -std=gnu99 -funs # -Wl,--cref : Add cross reference to map file # -Wl,--gc-sections : Enable garbage collection of unused input sections # -Wl,-rpath='$$ORIGIN/../lib/linux' : Set shared object search path -LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections -Wl,-rpath='$$ORIGIN/../../../../common/pc/vscphelper/lib/linux/$(BUILDTYPE)' +LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections -Wl,-rpath='$$ORIGIN/usr/lib/x86_64-linux-gnu/' ifeq ($(MAKECMDGOALS),debug) From 4850f78e3272cc3301cbedf16f97f832f2d4ebf3 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 15 Jan 2025 00:30:38 +0100 Subject: [PATCH 07/14] Receiving of events is now based on vscphlp_blockingReceiveEventEx(), because the vscphlp_isDataAvailable() returns not only received events, but sent events too. This caused sporadic errors. --- logger/main.c | 214 ++++++++++++++-------------- nodeSim/vscp_user/vscp_tp_adapter.c | 77 +++++----- programmer/main.c | 85 ++++++++--- 3 files changed, 211 insertions(+), 165 deletions(-) diff --git a/logger/main.c b/logger/main.c index 0df8ce0..abd78e4 100644 --- a/logger/main.c +++ b/logger/main.c @@ -72,6 +72,9 @@ This module contains the main entry point. /** Daemon wait time after a command was executed in ms */ #define MAIN_CMD_WAIT_TIME 250 +/** Time for waiting until a event is received in ms */ +#define MAIN_RECEIVE_TIMEOUT 500 + /******************************************************************************* MACROS *******************************************************************************/ @@ -378,148 +381,137 @@ static void main_loop(long hSession) } else { - uint32_t count = 0; vscpEventEx daemonEvent; int vscphlpRet = 0; - /* Check for available events. */ - if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_isDataAvailable(hSession, &count))) - { - LOG_ERROR_INT32("Couldn't check for available data: ", vscphlpRet); - - printf("Connection lost.\n"); - - /* Abort */ - quit = TRUE; - } /* Any event available? */ - else if (0 < count) + if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_blockingReceiveEventEx(hSession, &daemonEvent, MAIN_RECEIVE_TIMEOUT))) { - if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_receiveEventEx(hSession, &daemonEvent))) + if (VSCP_ERROR_TIMEOUT != vscphlpRet) { LOG_WARNING_INT32("Couldn't receive event: ", vscphlpRet); } - else if (((VSCP_CLASS1_LOG == daemonEvent.vscp_class) || ((VSCP_CLASS1_LOG + 512) == daemonEvent.vscp_class)) && - (VSCP_TYPE_LOG_MESSAGE == daemonEvent.vscp_type) && - (8 == daemonEvent.sizeData)) + } + else if (((VSCP_CLASS1_LOG == daemonEvent.vscp_class) || ((VSCP_CLASS1_LOG + 512) == daemonEvent.vscp_class)) && + (VSCP_TYPE_LOG_MESSAGE == daemonEvent.vscp_type) && + (8 == daemonEvent.sizeData)) + { + uint32_t index = 0; + + log_printf("Rx: %s class=0x%04X type=0x%02X prio=%2d oAddr=0x%02X %c num=%u id=0x%02X level=0x%02X idx=0x%02X data=", + (VSCP_CLASS1_LOG == daemonEvent.vscp_class) ? "L1 " : "L1_L2", + daemonEvent.vscp_class, + daemonEvent.vscp_type, + (daemonEvent.head >> 5) & 0x07, + daemonEvent.GUID[15], + (0 == ((daemonEvent.head >> 4) & 0x01)) ? '-' : 'h', + daemonEvent.sizeData, + daemonEvent.data[0], + daemonEvent.data[1], + daemonEvent.data[2]); + + for(index = 3; index < daemonEvent.sizeData; ++index) { - uint32_t index = 0; - - log_printf("Rx: %s class=0x%04X type=0x%02X prio=%2d oAddr=0x%02X %c num=%u id=0x%02X level=0x%02X idx=0x%02X data=", - (VSCP_CLASS1_LOG == daemonEvent.vscp_class) ? "L1 " : "L1_L2", - daemonEvent.vscp_class, - daemonEvent.vscp_type, - (daemonEvent.head >> 5) & 0x07, - daemonEvent.GUID[15], - (0 == ((daemonEvent.head >> 4) & 0x01)) ? '-' : 'h', - daemonEvent.sizeData, - daemonEvent.data[0], - daemonEvent.data[1], - daemonEvent.data[2]); - - for(index = 3; index < daemonEvent.sizeData; ++index) - { - printf("%02X", daemonEvent.data[index]); + printf("%02X", daemonEvent.data[index]); - if ((index + 1) < daemonEvent.sizeData) - { - printf(" "); - } + if ((index + 1) < daemonEvent.sizeData) + { + printf(" "); } - - printf("\n"); } - else if (512 > daemonEvent.vscp_class) - { - uint32_t index = 0; - log_printf("Rx: L1 class=0x%04X type=0x%02X prio=%2d oAddr=0x%02X %c num=%u data=", - daemonEvent.vscp_class, - daemonEvent.vscp_type, - (daemonEvent.head >> 5) & 0x07, - daemonEvent.GUID[15], /* Node GUID LSB */ - (0 == ((daemonEvent.head >> 4) & 0x01)) ? '-' : 'h', - daemonEvent.sizeData); + printf("\n"); + } + else if (512 > daemonEvent.vscp_class) + { + uint32_t index = 0; - for(index = 0; index < daemonEvent.sizeData; ++index) - { - printf("%02X", daemonEvent.data[index]); + log_printf("Rx: L1 class=0x%04X type=0x%02X prio=%2d oAddr=0x%02X %c num=%u data=", + daemonEvent.vscp_class, + daemonEvent.vscp_type, + (daemonEvent.head >> 5) & 0x07, + daemonEvent.GUID[15], /* Node GUID LSB */ + (0 == ((daemonEvent.head >> 4) & 0x01)) ? '-' : 'h', + daemonEvent.sizeData); - if ((index + 1) < daemonEvent.sizeData) - { - printf(" "); - } - } + for(index = 0; index < daemonEvent.sizeData; ++index) + { + printf("%02X", daemonEvent.data[index]); - printf("\n"); + if ((index + 1) < daemonEvent.sizeData) + { + printf(" "); + } } - else if (1024 > daemonEvent.vscp_class) - { - uint32_t index = 0; - log_printf("Rx: L2_L1 class=0x%04X type=0x%02X prio=%2d oAddr=0x%02X %c num=%u data=", - daemonEvent.vscp_class, - daemonEvent.vscp_type, - (daemonEvent.head >> 5) & 0x07, - daemonEvent.GUID[15], /* Node GUID LSB */ - (0 == ((daemonEvent.head >> 4) & 0x01)) ? '-' : 'h', - daemonEvent.sizeData); + printf("\n"); + } + else if (1024 > daemonEvent.vscp_class) + { + uint32_t index = 0; - for(index = 0; index < daemonEvent.sizeData; ++index) - { - printf("%02X", daemonEvent.data[index]); + log_printf("Rx: L2_L1 class=0x%04X type=0x%02X prio=%2d oAddr=0x%02X %c num=%u data=", + daemonEvent.vscp_class, + daemonEvent.vscp_type, + (daemonEvent.head >> 5) & 0x07, + daemonEvent.GUID[15], /* Node GUID LSB */ + (0 == ((daemonEvent.head >> 4) & 0x01)) ? '-' : 'h', + daemonEvent.sizeData); - if ((index + 1) < daemonEvent.sizeData) - { - printf(" "); - } + for(index = 0; index < daemonEvent.sizeData; ++index) + { + printf("%02X", daemonEvent.data[index]); + + if ((index + 1) < daemonEvent.sizeData) + { + printf(" "); } + } - printf("\n"); + printf("\n"); + } + else + { + uint32_t index = 0; + uint8_t max = 0; + + log_printf("Rx: L2 class=0x%04X type=0x%02X prio=%2d oAddr=0x%02X %c num=%u data=", + daemonEvent.vscp_class, + daemonEvent.vscp_type, + (daemonEvent.head >> 5) & 0x07, + daemonEvent.GUID[15], /* Node GUID LSB */ + (0 == ((daemonEvent.head >> 4) & 0x01)) ? '-' : 'h', + daemonEvent.sizeData); + + if (8 < daemonEvent.sizeData) + { + max = 8; } else { - uint32_t index = 0; - uint8_t max = 0; - - log_printf("Rx: L2 class=0x%04X type=0x%02X prio=%2d oAddr=0x%02X %c num=%u data=", - daemonEvent.vscp_class, - daemonEvent.vscp_type, - (daemonEvent.head >> 5) & 0x07, - daemonEvent.GUID[15], /* Node GUID LSB */ - (0 == ((daemonEvent.head >> 4) & 0x01)) ? '-' : 'h', - daemonEvent.sizeData); - - if (8 < daemonEvent.sizeData) - { - max = 8; - } - else - { - max = daemonEvent.sizeData; - } - - for(index = 0; index < max; ++index) - { - printf("%02X", daemonEvent.data[index]); + max = daemonEvent.sizeData; + } - if ((index + 1) < max) - { - printf(" "); - } - } + for(index = 0; index < max; ++index) + { + printf("%02X", daemonEvent.data[index]); - if (8 < daemonEvent.sizeData) + if ((index + 1) < max) { - printf("..."); + printf(" "); } + } - printf("\n"); + if (8 < daemonEvent.sizeData) + { + printf("..."); } - fflush(stdout); + printf("\n"); } + fflush(stdout); + /* Give other programs a chance. */ platform_delay(1); } @@ -672,6 +664,12 @@ static MAIN_RET main_connect(long * const hSession, char const * const ipAddr, c { printf("Vendor of driver: %s\n", vendorStr); } + + /* Enter receive loop, which is required for vscphlp_blockingReceiveEventEx(). */ + if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_enterReceiveLoop(*hSession))) + { + LOG_WARNING_INT32("vscphlp_enterReceiveLoop failed:", vscphlpRet); + } } /* Any error happened? */ diff --git a/nodeSim/vscp_user/vscp_tp_adapter.c b/nodeSim/vscp_user/vscp_tp_adapter.c index e389f04..9bdf6c3 100644 --- a/nodeSim/vscp_user/vscp_tp_adapter.c +++ b/nodeSim/vscp_user/vscp_tp_adapter.c @@ -69,6 +69,9 @@ /** Daemon wait time after a command was executed in ms */ #define VSCP_TP_ADAPTER_CMD_WAIT_TIME 250 +/** Time for waiting until a event is received in ms */ +#define VSCP_TP_ADAPTER_RECEIVE_TIMEOUT 500 + /******************************************************************************* MACROS *******************************************************************************/ @@ -270,7 +273,6 @@ extern BOOL vscp_tp_adapter_readMessage(vscp_RxMessage * const msg) /* Connected to a VSCP daemon? */ if (0 != client->hSession) { - uint32_t count = 0; vscpEventEx daemonEvent; int vscphlpRet = 0; @@ -280,51 +282,40 @@ extern BOOL vscp_tp_adapter_readMessage(vscp_RxMessage * const msg) /* Nothing to do */ ; } - /* Check for available events. */ - else if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_isDataAvailable(client->hSession, &count))) - { - LOG_ERROR_INT32("Couldn't check for available data: ", vscphlpRet); - LOG_ERROR_STR("vscphlp_isDataAvailable failed: ", vscp_tp_adapter_getErrorStr(vscphlpRet)); - - printf("Handle: %ld\n", client->hSession); - - log_printf("Connection lost.\n"); - vscp_tp_adapter_isConnected = FALSE; - } - /* Any event available? */ - else if (0 < count) + /* Receive a single VSCP event. */ + else if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_blockingReceiveEventEx(client->hSession, &daemonEvent, VSCP_TP_ADAPTER_RECEIVE_TIMEOUT))) { - if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_receiveEventEx(client->hSession, &daemonEvent))) + if (VSCP_ERROR_TIMEOUT != vscphlpRet) { LOG_WARNING_INT32("Couldn't receive event: ", vscphlpRet); LOG_WARNING_STR("vscphlp_receiveEventEx failed: ", vscp_tp_adapter_getErrorStr(vscphlpRet)); } - /* Handle all level 1 events? */ - else if (VSCP_TP_ADAPTER_LVL_1 == client->lvl) + } + /* Handle all level 1 events? */ + else if (VSCP_TP_ADAPTER_LVL_1 == client->lvl) + { + if (FALSE == vscp_tp_adapter_handleL1Event(msg, &daemonEvent)) + { + status = TRUE; + } + } + /* Handle all level 1 events and level 1 over level 2 events? */ + else if (VSCP_TP_ADAPTER_LVL_1_OVER_2 == client->lvl) + { + /* Level 1 event? */ + if (VSCP_CLASS_L1_L2_BASE > daemonEvent.vscp_class) { if (FALSE == vscp_tp_adapter_handleL1Event(msg, &daemonEvent)) { status = TRUE; } } - /* Handle all level 1 events and level 1 over level 2 events? */ - else if (VSCP_TP_ADAPTER_LVL_1_OVER_2 == client->lvl) + /* Level 1 over level 2 event? */ + else if (VSCP_TP_ADAPTER_CLASS_L2_BASE > daemonEvent.vscp_class) { - /* Level 1 event? */ - if (VSCP_CLASS_L1_L2_BASE > daemonEvent.vscp_class) + if (FALSE == vscp_tp_adapter_handleL1OverL2Event(msg, &daemonEvent)) { - if (FALSE == vscp_tp_adapter_handleL1Event(msg, &daemonEvent)) - { - status = TRUE; - } - } - /* Level 1 over level 2 event? */ - else if (VSCP_TP_ADAPTER_CLASS_L2_BASE > daemonEvent.vscp_class) - { - if (FALSE == vscp_tp_adapter_handleL1OverL2Event(msg, &daemonEvent)) - { - status = TRUE; - } + status = TRUE; } } } @@ -400,11 +391,23 @@ extern BOOL vscp_tp_adapter_writeMessage(vscp_TxMessage const * const msg) daemonEvent.data[index] = msg->data[index]; } - if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_sendEventEx(client->hSession, &daemonEvent))) + /* Quit receive loop first, to be able to send a event. */ + if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_quitReceiveLoop(client->hSession))) + { + LOG_WARNING_INT32("Couldn't send event to daemon:", vscphlpRet); + LOG_WARNING_STR("vscphlp_quitReceiveLoop failed: ", vscp_tp_adapter_getErrorStr(vscphlpRet)); + } + /* Send the event. */ + else if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_sendEventEx(client->hSession, &daemonEvent))) { LOG_WARNING_INT32("Couldn't send event to daemon:", vscphlpRet); LOG_WARNING_STR("vscphlp_sendEventEx failed: ", vscp_tp_adapter_getErrorStr(vscphlpRet)); } + /* Enter receive loop again, required for vscphlp_blockingReceiveEventEx(). */ + else if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_enterReceiveLoop(client->hSession))) + { + LOG_WARNING_INT32("vscphlp_enterReceiveLoop failed:", vscphlpRet); + } else { status = TRUE; @@ -633,6 +636,12 @@ extern VSCP_TP_ADAPTER_RET vscp_tp_adapter_connect(char const * const ipAddr, ch { log_printf("Vendor of driver: %s\n", vendorStr); } + + /* Enter receive loop, which is required for vscphlp_blockingReceiveEventEx(). */ + if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_enterReceiveLoop(client->hSession))) + { + LOG_WARNING_INT32("vscphlp_enterReceiveLoop failed:", vscphlpRet); + } } /* Any error happened? */ diff --git a/programmer/main.c b/programmer/main.c index d7fe878..9cbad9c 100644 --- a/programmer/main.c +++ b/programmer/main.c @@ -75,6 +75,9 @@ This module contains the main entry point. /** Daemon wait time after a command was executed in ms */ #define MAIN_CMD_WAIT_TIME 250 +/** Time for waiting until a event is received in ms */ +#define MAIN_RECEIVE_TIMEOUT 500 + /** Level 1 events threshold */ #define MAIN_VSCP_L1_THRESHOLD 512 @@ -199,6 +202,7 @@ static void main_showKeyTable(void); static MAIN_RET main_programming(long hSession, intelHexParser_Record* recSet, uint32_t recNum); static MAIN_RET main_connect(long * const hSession, char const * const ipAddr, char const * const user, char const * const password); static void main_disconnect(long * const hSession); +static int main_sendEvent(long hSession, const vscpEventEx* daemonEvent); static CMDLINEPARSER_RET main_clpUnknown(void* const userData, char const * const arg, char const * const par); static Crc16CCITT main_calculateCrc(intelHexParser_Record* recSet, uint32_t recNum, uint32_t blockSize, BOOL fillBlock); static uint32_t main_calculateDataSize(intelHexParser_Record* recSet, uint32_t recNum); @@ -591,35 +595,27 @@ static MAIN_RET main_programming(long hSession, intelHexParser_Record* recSet, u } else { - uint32_t count = 0; vscpEventEx daemonEvent; vscpEventEx* rxEvent = NULL; int vscphlpRet = 0; - /* Check for available events. */ - if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_isDataAvailable(hSession, &count))) - { - LOG_ERROR_INT32("Couldn't check for available data: ", vscphlpRet); - - printf("Connection lost.\n"); - - /* Abort */ - quit = TRUE; - } /* Any event available? */ - else if (0 < count) + if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_blockingReceiveEventEx(hSession, &daemonEvent, MAIN_RECEIVE_TIMEOUT))) { - if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_receiveEventEx(hSession, &daemonEvent))) + if (VSCP_ERROR_TIMEOUT != vscphlpRet) { LOG_WARNING_INT32("Couldn't receive event: ", vscphlpRet); } - else if (MAIN_VSCP_L1_THRESHOLD > daemonEvent.vscp_class) + } + else + { + if (MAIN_VSCP_L1_THRESHOLD > daemonEvent.vscp_class) { rxEvent = &daemonEvent; } - } - main_programNode(&progCon, hSession, recSet, recNum, rxEvent); + main_programNode(&progCon, hSession, recSet, recNum, rxEvent); + } fflush(stdout); @@ -775,6 +771,12 @@ static MAIN_RET main_connect(long * const hSession, char const * const ipAddr, c { printf("Vendor of driver: %s\n", vendorStr); } + + /* Enter receive loop, which is required for vscphlp_blockingReceiveEventEx(). */ + if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_enterReceiveLoop(*hSession))) + { + LOG_WARNING_INT32("vscphlp_enterReceiveLoop failed:", vscphlpRet); + } } /* Any error happened? */ @@ -817,6 +819,43 @@ static void main_disconnect(long * const hSession) return; } +/** + * This function sends a event to the VSCP daemon. + * + * @param[in] hSession Session handle + * @param[in] event Daemon event which to send + */ +static int main_sendEvent(long hSession, const vscpEventEx* daemonEvent) +{ + int vscphlpRet = VSCP_ERROR_ERROR; + + if (NULL == daemonEvent) + { + ; + } + /* Quit receive loop first, to be able to send a event. */ + else if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_quitReceiveLoop(hSession))) + { + LOG_WARNING_INT32("Couldn't send event to daemon:", vscphlpRet); + } + /* Send the event. */ + else if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_sendEventEx(hSession, daemonEvent))) + { + LOG_WARNING_INT32("Couldn't send event to daemon:", vscphlpRet); + } + /* Enter receive loop again, required for vscphlp_blockingReceiveEventEx(). */ + else if (VSCP_ERROR_SUCCESS != (vscphlpRet = vscphlp_enterReceiveLoop(hSession))) + { + LOG_WARNING_INT32("vscphlp_enterReceiveLoop failed:", vscphlpRet); + } + else + { + vscphlpRet = VSCP_ERROR_SUCCESS; + } + + return vscphlpRet; +} + /** * This function is called by the command line parser for every unknown argument. * @@ -963,7 +1002,7 @@ static void main_programNode(main_Programming * const progCon, long hSession, in txEvent.data[3] = 0x92; /* Page select register */ txEvent.data[4] = 2; /* Page select is a 16-bit value */ - if (VSCP_ERROR_SUCCESS != vscphlp_sendEventEx(hSession, &txEvent)) + if (VSCP_ERROR_SUCCESS != main_sendEvent(hSession, &txEvent)) { log_printf("Error!\n"); @@ -1014,7 +1053,7 @@ static void main_programNode(main_Programming * const progCon, long hSession, in txEvent.data[6] = (progCon->pageSelect >> 8) & 0xff; /* Register 0x92, page select msb */ txEvent.data[7] = (progCon->pageSelect >> 0) & 0xff; /* Register 0x93, page select lsb */ - if (VSCP_ERROR_SUCCESS != vscphlp_sendEventEx(hSession, &txEvent)) + if (VSCP_ERROR_SUCCESS != main_sendEvent(hSession, &txEvent)) { log_printf("Error!\n"); @@ -1107,7 +1146,7 @@ static void main_programNode(main_Programming * const progCon, long hSession, in txEvent.data[4] = 0; /* Type of memory to write: Program flash */ txEvent.data[5] = 0; /* Bank/Image to write: Internal flash */ - if (VSCP_ERROR_SUCCESS != vscphlp_sendEventEx(hSession, &txEvent)) + if (VSCP_ERROR_SUCCESS != main_sendEvent(hSession, &txEvent)) { log_printf("Error!\n"); @@ -1200,7 +1239,7 @@ static void main_programNode(main_Programming * const progCon, long hSession, in if (MAIN_PRG_STATE_ERROR != progCon->state) { - if (VSCP_ERROR_SUCCESS != vscphlp_sendEventEx(hSession, &txEvent)) + if (VSCP_ERROR_SUCCESS != main_sendEvent(hSession, &txEvent)) { log_printf("Error!\n"); @@ -1300,7 +1339,7 @@ static void main_programNode(main_Programming * const progCon, long hSession, in txEvent.data[2] = (progCon->blockIndex >> 8) & 0xff; txEvent.data[3] = (progCon->blockIndex >> 0) & 0xff; - if (VSCP_ERROR_SUCCESS != vscphlp_sendEventEx(hSession, &txEvent)) + if (VSCP_ERROR_SUCCESS != main_sendEvent(hSession, &txEvent)) { log_printf("Error!\n"); @@ -1366,7 +1405,7 @@ static void main_programNode(main_Programming * const progCon, long hSession, in txEvent.data[0] = (imageCrc >> 8) & 0xff; /* CRC MSB */ txEvent.data[1] = (imageCrc >> 0) & 0xff; /* CRC MSB */ - if (VSCP_ERROR_SUCCESS != vscphlp_sendEventEx(hSession, &txEvent)) + if (VSCP_ERROR_SUCCESS != main_sendEvent(hSession, &txEvent)) { log_printf("Error!\n"); @@ -1408,7 +1447,7 @@ static void main_programNode(main_Programming * const progCon, long hSession, in txEvent.sizeData = 1; txEvent.data[0] = progCon->nodeId; - (void)vscphlp_sendEventEx(hSession, &txEvent); + (void)main_sendEvent(hSession, &txEvent); progCon->state = MAIN_PRG_STATE_IDLE; break; From e354225ba98eaf50630d4e00dbc4138c0f5e66c1 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 15 Jan 2025 19:30:39 +0100 Subject: [PATCH 08/14] Download and install vscp-helper-lib on CI. --- .github/workflows/main.yml | 9 ++++++++- logger/makefile | 2 +- nodeSim/makefile | 2 +- programmer/makefile | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8dcfdb3..a79d691 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,11 +22,18 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 with: submodules: recursive + - name: Download and install vscp-helper-lib + run: | + sudo wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v15.0.0/libvscphelper_15.0.0_amd64.deb + sudo apt install libvscphelper_15.0.0_amd64.deb + sudo ldconfig + ls /usr/lib/x86_64-linux-gnu/libvscp* + - name: Build logger (release) run: | cd ./logger diff --git a/logger/makefile b/logger/makefile index ab39ebb..5613266 100644 --- a/logger/makefile +++ b/logger/makefile @@ -98,7 +98,7 @@ CFLAGS= -Wall -ffunction-sections -fdata-sections -fshort-enums -std=gnu99 -funs # -Wl,--cref : Add cross reference to map file # -Wl,--gc-sections : Enable garbage collection of unused input sections # -Wl,-rpath='$$ORIGIN/../lib/linux' : Set shared object search path -LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections -Wl,-rpath='$$ORIGIN/usr/lib/x86_64-linux-gnu/' +LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections ifeq ($(MAKECMDGOALS),debug) diff --git a/nodeSim/makefile b/nodeSim/makefile index 1747288..0293803 100644 --- a/nodeSim/makefile +++ b/nodeSim/makefile @@ -152,7 +152,7 @@ CFLAGS= -Wall -ffunction-sections -fdata-sections -fshort-enums -std=gnu99 -funs # -Wl,--cref : Add cross reference to map file # -Wl,--gc-sections : Enable garbage collection of unused input sections # -Wl,-rpath='$$ORIGIN/../lib/linux' : Set shared object search path -LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections -Wl,-rpath='$$ORIGIN/usr/lib/x86_64-linux-gnu/' +LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections ifeq ($(MAKECMDGOALS),debug) diff --git a/programmer/makefile b/programmer/makefile index 30bca97..664e1d3 100644 --- a/programmer/makefile +++ b/programmer/makefile @@ -101,7 +101,7 @@ CFLAGS= -Wall -ffunction-sections -fdata-sections -fshort-enums -std=gnu99 -funs # -Wl,--cref : Add cross reference to map file # -Wl,--gc-sections : Enable garbage collection of unused input sections # -Wl,-rpath='$$ORIGIN/../lib/linux' : Set shared object search path -LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections -Wl,-rpath='$$ORIGIN/usr/lib/x86_64-linux-gnu/' +LDFLAGS= -Wall -Wl,-Map,$(BINDIR)/$(BIN).map -Wl,--cref -Wl,--gc-sections ifeq ($(MAKECMDGOALS),debug) From 8db6b72ff285850b3ada610ee578758729848af1 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 15 Jan 2025 19:33:12 +0100 Subject: [PATCH 09/14] Fix local linux vscp-helper-lib package installation. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a79d691..8c10352 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,7 @@ jobs: - name: Download and install vscp-helper-lib run: | sudo wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v15.0.0/libvscphelper_15.0.0_amd64.deb - sudo apt install libvscphelper_15.0.0_amd64.deb + sudo apt install ./libvscphelper_15.0.0_amd64.deb sudo ldconfig ls /usr/lib/x86_64-linux-gnu/libvscp* From a8e15e65eaf93a84cef74361eb09905f5195c6e6 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 15 Jan 2025 19:34:47 +0100 Subject: [PATCH 10/14] Remove ls which was for debugging purposes. --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8c10352..81132db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,7 +32,6 @@ jobs: sudo wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v15.0.0/libvscphelper_15.0.0_amd64.deb sudo apt install ./libvscphelper_15.0.0_amd64.deb sudo ldconfig - ls /usr/lib/x86_64-linux-gnu/libvscp* - name: Build logger (release) run: | From e858a6c037884c24473310485a50deaf79c6f4a8 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 15 Jan 2025 19:46:19 +0100 Subject: [PATCH 11/14] Linux bash script implemented to setup the environment. --- .github/workflows/main.yml | 6 ++--- README.md | 51 ++------------------------------------ setup_linux.sh | 31 +++++++++++++++++++++++ 3 files changed, 35 insertions(+), 53 deletions(-) create mode 100644 setup_linux.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 81132db..2709441 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,11 +27,9 @@ jobs: with: submodules: recursive - - name: Download and install vscp-helper-lib + - name: Setup for linux run: | - sudo wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v15.0.0/libvscphelper_15.0.0_amd64.deb - sudo apt install ./libvscphelper_15.0.0_amd64.deb - sudo ldconfig + ./setup_linux.sh - name: Build logger (release) run: | diff --git a/README.md b/README.md index 2ad09e8..f88ee38 100644 --- a/README.md +++ b/README.md @@ -42,55 +42,8 @@ More information can be found on the main site http://www.vscp.org ## Prerequisite ### Linux - -1. Get the standard gcc build environment: - ```bash - sudo apt update - sudo apt install build-essential - ``` -2. Install expat packages: - ```bash - sudo apt install libexpat1 - sudo apt install libexpat1-dev - ``` -3. Install OpenSSL v1.1: - 1. Install dependencies: - ```bash - sudo apt install checkinstall zlib1g-dev - ``` - 2. Download OpenSSL: - ```bash - cd /usr/local/src/ - sudo wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz - sudo tar -xf openssl-1.1.1k.tar.gz - cd openssl-1.1.1k.tar.gz - ``` - 3. Install and compile OpenSSL: - ```bash - sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib - sudo make - sudo make test - sudo make install - ``` - 4. Configure link libraries: - ```bash - cd /etc/ld.so.conf.d/ - sudo nano openssl-1.1.1k.conf - ``` - Now add /usr/local/ssl/lib to the openssl-1.1.1k.conf file and save. - 5. Reload dynamic link: - ```bash - sudo ldconfig -v - ``` -4. Install vscp-helper-lib: - 1. Download vscp-helper-lib: - ```bash - sudo wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v15.0.0/libvscphelper_15.0.0_amd64.deb - ``` - 2. Install vscp-helper-lib: - ```bash - sudo apt install libvscphelper_15.0.0_amd64.deb - ``` +1. Open a terminal. +2. Call ```setup_linux.sh``` ### Windows diff --git a/setup_linux.sh b/setup_linux.sh new file mode 100644 index 0000000..551ef77 --- /dev/null +++ b/setup_linux.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +echo Install expat +sudo apt install libexpat1 +sudo apt install libexpat1-dev + +echo Download and install vscp-helper-lib +sudo wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v15.0.0/libvscphelper_15.0.0_amd64.deb +sudo apt install ./libvscphelper_15.0.0_amd64.deb + +echo Install dependencies +sudo apt install build-essential checkinstall zlib1g-dev + +echo Download OpenSSL +cd /usr/local/src/ +sudo wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz +sudo tar -xf openssl-1.1.1k.tar.gz +cd openssl-1.1.1k.tar.gz + +echo Install and compile OpenSSL +sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib +sudo make +sudo make test +sudo make install + +echo Configure link libraries +cd /etc/ld.so.conf.d/ +echo "/usr/local/ssl/lib" >> openssl-1.1.1k.conf + +echo Reload dynamic link +sudo ldconfig -v From f57a252c2563e2cb8b9516935788343b342c522a Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 15 Jan 2025 19:47:34 +0100 Subject: [PATCH 12/14] Call setup_linux.sh with sudo. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2709441..e12bccc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,7 +29,7 @@ jobs: - name: Setup for linux run: | - ./setup_linux.sh + sudo ./setup_linux.sh - name: Build logger (release) run: | From 0dc43f35c8428b0d68d61433f457325ebdf6a8d8 Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 15 Jan 2025 19:50:18 +0100 Subject: [PATCH 13/14] Execution permission for setup_linux.sh granted. --- setup_linux.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 setup_linux.sh diff --git a/setup_linux.sh b/setup_linux.sh old mode 100644 new mode 100755 From 154f69c755f399486601a1c4bfdc5add36f6559f Mon Sep 17 00:00:00 2001 From: BlueAndi Date: Wed, 15 Jan 2025 20:00:46 +0100 Subject: [PATCH 14/14] Fixed entering OpenSSL source directory. --- setup_linux.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup_linux.sh b/setup_linux.sh index 551ef77..901fc98 100755 --- a/setup_linux.sh +++ b/setup_linux.sh @@ -1,21 +1,21 @@ #!/bin/bash echo Install expat -sudo apt install libexpat1 -sudo apt install libexpat1-dev +sudo apt-get install libexpat1 +sudo apt-get install libexpat1-dev echo Download and install vscp-helper-lib sudo wget https://github.com/grodansparadis/vscp-helper-lib/releases/download/v15.0.0/libvscphelper_15.0.0_amd64.deb -sudo apt install ./libvscphelper_15.0.0_amd64.deb +sudo apt-get install ./libvscphelper_15.0.0_amd64.deb echo Install dependencies -sudo apt install build-essential checkinstall zlib1g-dev +sudo apt-get install build-essential checkinstall zlib1g-dev echo Download OpenSSL cd /usr/local/src/ sudo wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz sudo tar -xf openssl-1.1.1k.tar.gz -cd openssl-1.1.1k.tar.gz +cd openssl-1.1.1k echo Install and compile OpenSSL sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib