Initial commit
This commit is contained in:
commit
f0b71fcae7
|
@ -0,0 +1,96 @@
|
|||
*~
|
||||
|
||||
# CMake artifacts
|
||||
/build*/
|
||||
/_packages/
|
||||
CMakeUserPresets.json
|
||||
|
||||
# Doxygen
|
||||
/docs/
|
||||
|
||||
# Visual Studio (Code)
|
||||
.localhistory/
|
||||
.history/
|
||||
.vscode/
|
||||
.vs/
|
||||
/out/
|
||||
CmakeSettings.json
|
||||
|
||||
# macOS General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
Thumbs.db:encryptable
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Windows folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares (Windows)
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
#
|
||||
# Qt ignores taken from https://github.com/github/gitignore/blob/master/Qt.gitignore
|
||||
#
|
||||
|
||||
# C++ objects and libs
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.a
|
||||
*.la
|
||||
*.lai
|
||||
*.so
|
||||
*.so.*
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Qt-es
|
||||
object_script.*.Release
|
||||
object_script.*.Debug
|
||||
*_plugin_import.cpp
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
*.pro.user
|
||||
*.pro.user.*
|
||||
*.qbs.user
|
||||
*.qbs.user.*
|
||||
*.moc
|
||||
moc_*.cpp
|
||||
moc_*.h
|
||||
qrc_*.cpp
|
||||
ui_*.h
|
||||
*.qmlc
|
||||
*.jsc
|
||||
Makefile*
|
||||
*build-*
|
||||
*.qm
|
||||
*.prl
|
||||
|
||||
# Qt unit tests
|
||||
target_wrapper.*
|
||||
|
||||
# QtCreator
|
||||
*.autosave
|
||||
|
||||
# QtCreator Qml
|
||||
*.qmlproject.user
|
||||
*.qmlproject.user.*
|
||||
|
||||
# QtCreator CMake
|
||||
CMakeLists.txt.user*
|
||||
|
||||
# QtCreator 4.8< compilation database
|
||||
compile_commands.json
|
||||
|
||||
# QtCreator local machine specific files for imported projects
|
||||
*creator.user*
|
||||
|
||||
*_qmlcache.qrc
|
|
@ -0,0 +1,67 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(QtZ21Server VERSION 0.1 LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
|
||||
|
||||
set(PROJECT_SOURCES
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mainwindow.ui
|
||||
|
||||
z21header.h
|
||||
z21.h
|
||||
z21.cpp
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
qt_add_executable(QtZ21Server
|
||||
MANUAL_FINALIZATION
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
# Define target properties for Android with Qt 6 as:
|
||||
# set_property(TARGET QtZ21Server APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
|
||||
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
||||
else()
|
||||
if(ANDROID)
|
||||
add_library(QtZ21Server SHARED
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||
else()
|
||||
add_executable(QtZ21Server
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(QtZ21Server PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
|
||||
|
||||
set_target_properties(QtZ21Server PROPERTIES
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||
MACOSX_BUNDLE TRUE
|
||||
WIN32_EXECUTABLE TRUE
|
||||
)
|
||||
|
||||
install(TARGETS QtZ21Server
|
||||
BUNDLE DESTINATION .
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
if(QT_VERSION_MAJOR EQUAL 6)
|
||||
qt_finalize_executable(QtZ21Server)
|
||||
endif()
|
|
@ -0,0 +1,11 @@
|
|||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
#include "mainwindow.h"
|
||||
#include "./ui_mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar"/>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -0,0 +1,250 @@
|
|||
/*
|
||||
z21.h - library for Z21 mobile protocoll
|
||||
Copyright (c) 2013-2022 Philipp Gahtow All right reserved.
|
||||
|
||||
ROCO Z21 LAN Protocol for Arduino.
|
||||
|
||||
Notice:
|
||||
- analyse the data and give back the content and a answer
|
||||
|
||||
Grundlage: Z21 LAN Protokoll Spezifikation V1.12
|
||||
|
||||
Änderungen:
|
||||
- 23.09.15 Anpassung LAN_LOCONET_DETECTOR
|
||||
Fehlerbeseitigung bei der LAN Prüfsumme
|
||||
Anpassung LAN_LOCONET_DISPATCH
|
||||
- 14.07.16 add S88 Gruppenindex for request
|
||||
- 22.08.16 add POM read notify
|
||||
- 19.12.16 add CV return value for Service Mode
|
||||
- 27.12.16 add CV no ACK and CV Short Circuit
|
||||
- 15.03.17 add System Information
|
||||
- 03.04.17 fix LAN_X_SET_LOCO_FUNCTION in DB3 type and index
|
||||
- 14.04.17 add EEPROM and store Z21 configuration (EEPROM: 50-75)
|
||||
- 19.06.17 add FW Version 1.28, 1.29 and 1.30
|
||||
- 06.08.17 add support for Arduino DUE
|
||||
- 27.08.17 fix speed step setting
|
||||
- 09.01.18 adjust POM write Byte and Bit
|
||||
- 21.01.18 adjust notifyz21LNdispatch to long Adr
|
||||
- 04.02.18 fix LocoNet dispatch
|
||||
- 22.10.18 add loco busy return
|
||||
- 02.11.18 adjust returnLocoStateFull with addition non broadcast when requestion only information
|
||||
- 04.11.18 fix EthSend handel of message with client == 0 and Broadcast with client and without
|
||||
- 10.05.20 add message LAN_GET_LOCOMODE and LAN_GET_TURNOUTMODE
|
||||
- 04.08.20 fix POM set CV result
|
||||
- 17.12.20 add support for ESP32 and adjust ESP8266
|
||||
- 01.03.21 set default EEPROM MainV and ProgV to 20V
|
||||
- 03.03.21 add new Z21 spezifications v1.10
|
||||
- 21.03.21 add request for client identification (ip-hash) and store this plus BC-Flag in EEPROM
|
||||
- 30.03.21 fix connecting problem WDP with reporting railpower when request status
|
||||
- 11.06.21 add NVS on ESP32 to store EEPROM data
|
||||
- 30.09.21 fix storage data in Ethsend with correct datalength; fix problem with LAN_X_GET_TURNOUT_INFO to return feedbacks also when LAN_X_SET_TURNOUT is called!
|
||||
- 06.11.21 fix EEPROM store BCFlags with IP Hash value. Use EEPROM value from 512 up to 736.
|
||||
- 16.11.21 add sending data to client only with "Z21bcNone", if client set and BC-Flag set (not "Z21bcNone") then don't inform the client!
|
||||
- 14.12.21 limit max packet size for Z21 LocoNet tunnel data to 20 bytes!
|
||||
- 03.02.22 fix setCANDetector() data values with 16bit
|
||||
- 10.02.22 add LAN_X_CV_POM_ACCESSORY statements
|
||||
- 24.04.22 add SystemState.Capabilities for feature report to clients (FW Version 1.42)
|
||||
modify LAN_X_LOCO_INFO to FW Version 1.42
|
||||
- 25.04.22 add LAN_X_SET_LOCO_FUNCTION_GROUP and LAN_X_SET_LOCO_BINARY_STATE
|
||||
fix SET_EXT_ACCESSORY and EXT_ACCESSORY_INFO
|
||||
- 29.04.22 add WLANMaus CV Read and write special functions
|
||||
*/
|
||||
|
||||
// include types & constants of Wiring core API
|
||||
#if defined(WIRING)
|
||||
#include <Wiring.h>
|
||||
#elif ARDUINO >= 100
|
||||
#include <Arduino.h>
|
||||
#else
|
||||
#include <WProgram.h>
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------
|
||||
#define z21Port 21105 // local port to listen on
|
||||
|
||||
//**************************************************************
|
||||
//#define SERIALDEBUG //Serial Debug
|
||||
|
||||
#if defined(SERIALDEBUG)
|
||||
#define ZDebug Serial //Port for the Debugging
|
||||
#endif
|
||||
|
||||
//**************************************************************
|
||||
//Firmware-Version der Z21:
|
||||
#define z21FWVersionMSB 0x01
|
||||
#define z21FWVersionLSB 0x42
|
||||
/*
|
||||
HwType:
|
||||
#define D_HWT_Z21_OLD 0x00000200 // schwarze Z21 (Hardware-Variante ab 2012)
|
||||
#define D_HWT_Z21_NEW 0x00000201 // schwarze Z21(Hardware-Variante ab 2013)
|
||||
#define D_HWT_SMARTRAIL 0x00000202 // SmartRail (ab 2012)
|
||||
#define D_HWT_z21_SMALL 0x00000203 // weiße z21 Starterset-Variante (ab 2013)
|
||||
#define D_HWT_z21_START 0x00000204 // z21 start Starterset-Variante (ab 2016)
|
||||
#define D_HWT_Z21_XL 0x00000211 // 10870 Z21 XL Series (ab 2020)
|
||||
#define D_HWT_SINGLE_BOOSTER 0x00000205 // 10806 Z21 Single Booster (zLink)
|
||||
#define D_HWT_DUAL_BOOSTER 0x00000206 // 10807 Z21 Dual Booster (zLink)
|
||||
#define D_HWT_Z21_SWITCH_DECODER 0x00000301 // 10836 Z21 SwitchDecoder (zLink)
|
||||
#define D_HWT_Z21_SIGNAL_DECODER 0x00000302 // 10836 Z21 SignalDecoder (zLink)
|
||||
*/
|
||||
//Hardware-Typ: 0x00000211 // 10870 Z21 XL Series (ab 2020)
|
||||
#define z21HWTypeMSB 0x02
|
||||
#define z21HWTypeLSB 0x11
|
||||
//Seriennummer inside EEPROM:
|
||||
#define CONFz21SnMSB 0 //0x01
|
||||
#define CONFz21SnLSB 1 //0xE8
|
||||
//**************************************************************
|
||||
//Store Z21 configuration inside EEPROM:
|
||||
#define CONF1STORE 50 //(10x Byte) - Prog, RailCom, etc.
|
||||
#define CONF2STORE 60 //(15x Byte) - Voltage: Prog, Rail, etc.
|
||||
#define CLIENTHASHSTORE 0x200 //512 Start where Client-Hash is stored
|
||||
|
||||
//--------------------------------------------------------------
|
||||
//certain global XPressnet status indicators:
|
||||
#define csNormal 0x00 // Normal Operation Resumed ist eingeschaltet
|
||||
#define csEmergencyStop 0x01 // Der Nothalt ist eingeschaltet
|
||||
#define csTrackVoltageOff 0x02 // Die Gleisspannung ist abgeschaltet
|
||||
#define csShortCircuit 0x04 // Kurzschluss
|
||||
#define csServiceMode 0x08 // Der Programmiermodus ist aktiv - Service Mode
|
||||
//Bitmask CentralStateEx:
|
||||
#define cseHighTemperature 0x01 // zu hohe Temperatur
|
||||
#define csePowerLost 0x02 // zu geringe Eingangsspannung
|
||||
#define cseShortCircuitExternal 0x04 // am externen Booster-Ausgang
|
||||
#define cseShortCircuitInternal 0x08 // am Hauptgleis oder Programmiergleis
|
||||
|
||||
//--------------------------------------------------------------
|
||||
#define z21clientMAX 30 //Speichergröße für IP-Adressen
|
||||
#define z21ActTimeIP 20 //Aktivhaltung einer IP für (sec./2)
|
||||
#define z21IPinterval 2000 //interval at milliseconds
|
||||
|
||||
//DCC Speed Steps
|
||||
#define DCCSTEP14 0x01
|
||||
#define DCCSTEP28 0x02
|
||||
#define DCCSTEP128 0x03
|
||||
|
||||
struct TypeActIP {
|
||||
byte client; // Byte client
|
||||
byte BCFlag; //BoadCastFlag - see Z21type.h
|
||||
byte time; //Zeit
|
||||
uint16_t adr; //Loco control Adr
|
||||
};
|
||||
|
||||
// library interface description
|
||||
class z21Class
|
||||
{
|
||||
// user-accessible "public" interface
|
||||
public:
|
||||
z21Class(void); //Constuctor
|
||||
|
||||
void receive(uint8_t client, uint8_t *packet); //Prüfe auf neue Ethernet Daten
|
||||
|
||||
void setPower(byte state); //Zustand Gleisspannung Melden
|
||||
byte getPower(); //Zusand Gleisspannung ausgeben
|
||||
|
||||
void setCVPOMBYTE (uint16_t CVAdr, uint8_t value); //POM write byte return
|
||||
|
||||
void setLocoStateExt (int Adr); //send Loco state to BC
|
||||
unsigned long getz21BcFlag (byte flag); //Convert local stored flag back into a Z21 Flag
|
||||
|
||||
void setS88Data(byte *data); //return state of S88 sensors
|
||||
|
||||
void setLNDetector(uint8_t client, byte *data, byte DataLen); //return state from LN detector
|
||||
bool setLNMessage(byte *data, byte DataLen, byte bcType, bool TX); //return LN Message
|
||||
|
||||
void setCANDetector(uint16_t NID, uint16_t Adr, uint8_t port, uint8_t typ, uint16_t v1, uint16_t v2); //state from CAN detector
|
||||
|
||||
void setTrntInfo(uint16_t Adr, bool State); //Return the state of accessory
|
||||
|
||||
void setExtACCInfo(uint16_t Adr, byte State, bool Status = 0x00); //Return EXT Accessory INFO
|
||||
|
||||
void setCVReturn (uint16_t CV, uint8_t value); //Return CV Value for Programming
|
||||
void setCVNack(); //Return no ACK from Decoder
|
||||
void setCVNackSC(); //Return Short while Programming
|
||||
|
||||
void sendSystemInfo(byte client, uint16_t maincurrent, uint16_t mainvoltage, uint16_t temp); //Send to all clients that request via BC the System Information
|
||||
|
||||
// library-accessible "private" interface
|
||||
private:
|
||||
|
||||
//Variables:
|
||||
byte Railpower; //state of the railpower
|
||||
long z21IPpreviousMillis; // will store last time of IP decount updated
|
||||
TypeActIP ActIP[z21clientMAX]; //Speicherarray für IPs
|
||||
|
||||
//Functions:
|
||||
void returnLocoStateFull (byte client, uint16_t Adr, bool bc); //Antwort auf Statusabfrage
|
||||
void EthSend (byte client, unsigned int DataLen, unsigned int Header, byte *dataString, boolean withXOR, byte BC);
|
||||
byte getLocalBcFlag (unsigned long flag); //Convert Z21 LAN BC flag to local stored flag
|
||||
void clearIP (byte pos); //delete the stored client
|
||||
void clearIPSlots(); //delete all stored clients
|
||||
void clearIPSlot(byte client); //delete a client
|
||||
byte addIPToSlot (byte client, byte BCFlag);
|
||||
|
||||
void setOtherSlotBusy(byte slot);
|
||||
void addBusySlot (byte client, uint16_t adr);
|
||||
void reqLocoBusy (uint16_t adr);
|
||||
|
||||
byte getEEPROMBCFlagIndex(); //return the length of BC-Flag store
|
||||
void setEEPROMBCFlag(byte IPHash, byte BCFlag); //add BC-Flag to store
|
||||
byte findEEPROMBCFlag(byte IPHash); //read the BC-Flag for this client
|
||||
|
||||
uint8_t LAST_EXTACC_msg = 0x00; //for LAN_X_GET_EXT_ACCESSORY_INFO
|
||||
bool LAST_EXTACC_received = false; //already had any EXTACC Message?
|
||||
};
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void notifyz21getSystemInfo(uint8_t client) __attribute__((weak));
|
||||
|
||||
extern void notifyz21EthSend(uint8_t client, uint8_t *data) __attribute__((weak));
|
||||
|
||||
extern void notifyz21LNdetector(uint8_t client, uint8_t typ, uint16_t Adr) __attribute__((weak));
|
||||
extern uint8_t notifyz21LNdispatch(uint16_t Adr) __attribute__((weak));
|
||||
extern void notifyz21LNSendPacket(uint8_t *data, uint8_t length) __attribute__((weak));
|
||||
|
||||
extern void notifyz21CANdetector(uint8_t client, uint8_t typ, uint16_t ID) __attribute__((weak));
|
||||
|
||||
extern void notifyz21RailPower(uint8_t State ) __attribute__((weak));
|
||||
|
||||
extern void notifyz21CVREAD(uint8_t cvAdrMSB, uint8_t cvAdrLSB) __attribute__((weak));
|
||||
extern void notifyz21CVWRITE(uint8_t cvAdrMSB, uint8_t cvAdrLSB, uint8_t value) __attribute__((weak));
|
||||
extern void notifyz21CVPOMWRITEBYTE(uint16_t Adr, uint16_t cvAdr, uint8_t value) __attribute__((weak));
|
||||
extern void notifyz21CVPOMWRITEBIT(uint16_t Adr, uint16_t cvAdr, uint8_t value) __attribute__((weak));
|
||||
extern void notifyz21CVPOMREADBYTE(uint16_t Adr, uint16_t cvAdr) __attribute__((weak));
|
||||
extern void notifyz21CVPOMACCWRITEBYTE(uint16_t Adr, uint16_t cvAdr, uint8_t value) __attribute__((weak));
|
||||
extern void notifyz21CVPOMACCWRITEBIT(uint16_t Adr, uint16_t cvAdr, uint8_t value) __attribute__((weak));
|
||||
extern void notifyz21CVPOMACCREADBYTE(uint16_t Adr, uint16_t cvAdr) __attribute__((weak));
|
||||
|
||||
extern uint8_t notifyz21AccessoryInfo(uint16_t Adr) __attribute__((weak));
|
||||
extern void notifyz21Accessory(uint16_t Adr, bool state, bool active) __attribute__((weak));
|
||||
extern void notifyz21ExtAccessory(uint16_t Adr, byte state) __attribute__((weak));
|
||||
|
||||
extern void notifyz21LocoState(uint16_t Adr, uint8_t data[]) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt(uint16_t Adr, uint8_t type, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt0to4(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt5to8(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt9to12(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt13to20(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt21to28(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt29to36(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt37to44(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt45to52(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt53to60(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFkt61to68(uint16_t Adr, uint8_t fkt) __attribute__((weak));
|
||||
extern void notifyz21LocoFktExt(uint16_t Adr, uint8_t low, uint8_t high) __attribute__((weak));
|
||||
extern void notifyz21LocoSpeed(uint16_t Adr, uint8_t speed, uint8_t steps) __attribute__((weak));
|
||||
|
||||
extern void notifyz21S88Data(uint8_t gIndex) __attribute__((weak)); //return last state S88 Data for the Client!
|
||||
|
||||
extern uint16_t notifyz21Railcom() __attribute__((weak)); //return global Railcom Adr
|
||||
|
||||
extern void notifyz21UpdateConf() __attribute__((weak)); //information for DCC via EEPROM (RailCom, ProgMode,...)
|
||||
|
||||
extern uint8_t notifyz21ClientHash(uint8_t client) __attribute__((weak));
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Z21type.h
|
||||
* Created on: 16.04.2016
|
||||
* Author: Philipp Gahtow
|
||||
*
|
||||
* 19.07.16 Add X-Bus (XpressNet)
|
||||
* 19.06.17 Add CAN and new BC-Flags
|
||||
*
|
||||
*/
|
||||
|
||||
//**************************************************************
|
||||
//Z21 LAN Protokoll Spezifikation:
|
||||
#define LAN_X_Header 0x40 //not in Spezifikation!
|
||||
#define LAN_GET_SERIAL_NUMBER 0x10
|
||||
#define LAN_GET_CODE 0x18 //SW Feature-Umfang der Z21
|
||||
#define LAN_LOGOFF 0x30
|
||||
#define LAN_X_GET_SETTING 0x21
|
||||
#define LAN_X_BC_TRACK_POWER 0x61
|
||||
#define LAN_X_UNKNOWN_COMMAND 0x61
|
||||
#define LAN_X_STATUS_CHANGED 0x62
|
||||
#define LAN_X_GET_VERSION 0x63 //AW: X-Bus Version 090040006321301260
|
||||
#define LAN_X_SET_STOP 0x80 //AW: LAN_X_BC_STOPPED
|
||||
#define LAN_X_BC_STOPPED 0x81
|
||||
#define LAN_X_GET_FIRMWARE_VERSION 0xF1 //AW: 0xF3
|
||||
#define LAN_SET_BROADCASTFLAGS 0x50
|
||||
#define LAN_GET_BROADCASTFLAGS 0x51
|
||||
#define LAN_SYSTEMSTATE_DATACHANGED 0x84
|
||||
#define LAN_SYSTEMSTATE_GETDATA 0x85 //AW: LAN_SYSTEMSTATE_DATACHANGED
|
||||
#define LAN_GET_HWINFO 0x1A
|
||||
#define LAN_GET_LOCOMODE 0x60
|
||||
#define LAN_SET_LOCOMODE 0x61
|
||||
#define LAN_GET_TURNOUTMODE 0x70
|
||||
#define LAN_SET_TURNOUTMODE 0x71
|
||||
#define LAN_X_GET_LOCO_INFO 0xE3
|
||||
#define LAN_X_SET_LOCO 0xE4 //X-Header
|
||||
#define LAN_X_SET_LOCO_FUNCTION 0xF8 //DB0
|
||||
#define LAN_X_SET_LOCO_BINARY_STATE 0xE5 //X-Header
|
||||
#define LAN_X_LOCO_INFO 0xEF
|
||||
#define LAN_X_GET_TURNOUT_INFO 0x43
|
||||
#define LAN_X_SET_TURNOUT 0x53
|
||||
#define LAN_X_TURNOUT_INFO 0x43
|
||||
#define LAN_X_SET_EXT_ACCESSORY 0x54 //new: 1.10
|
||||
#define LAN_X_GET_EXT_ACCESSORY_INFO 0x44 //new: 1.10
|
||||
#define LAN_X_CV_READ 0x23
|
||||
#define LAN_X_CV_WRITE 0x24
|
||||
#define LAN_X_CV_NACK_SC 0x61
|
||||
#define LAN_X_CV_NACK 0x61
|
||||
#define LAN_X_CV_RESULT 0x64
|
||||
#define LAN_RMBUS_DATACHANGED 0x80
|
||||
#define LAN_RMBUS_GETDATA 0x81
|
||||
#define LAN_RMBUS_PROGRAMMODULE 0x82
|
||||
|
||||
#define LAN_RAILCOM_DATACHANGED 0x88
|
||||
#define LAN_RAILCOM_GETDATA 0x89
|
||||
|
||||
#define LAN_LOCONET_Z21_RX 0xA0
|
||||
#define LAN_LOCONET_Z21_TX 0xA1
|
||||
#define LAN_LOCONET_FROM_LAN 0xA2
|
||||
#define LAN_LOCONET_DISPATCH_ADDR 0xA3
|
||||
#define LAN_LOCONET_DETECTOR 0xA4
|
||||
|
||||
#define LAN_CAN_DETECTOR 0xC4
|
||||
|
||||
#define LAN_X_CV_POM 0xE6 //X-Header
|
||||
#define LAN_X_CV_POM_WRITE_BYTE 0xEC //DB3 Option
|
||||
#define LAN_X_CV_POM_WRITE_BIT 0xE8 //DB3 Option
|
||||
#define LAN_X_CV_POM_READ_BYTE 0xE4 //DB3 Option
|
||||
#define LAN_X_CV_POM_ACCESSORY_WRITE_BYTE 0xEC //DB3 Option
|
||||
#define LAN_X_CV_POM_ACCESSORY_WRITE_BIT 0xE8 //DB3 Option
|
||||
#define LAN_X_CV_POM_ACCESSORY_READ_BYTE 0xE4 //DB3 Option
|
||||
|
||||
//ab Z21 FW Version 1.23
|
||||
#define LAN_X_MM_WRITE_BYTE 0x24
|
||||
|
||||
//ab Z21 FW Version 1.25
|
||||
#define LAN_X_DCC_READ_REGISTER 0x22
|
||||
#define LAN_X_DCC_WRITE_REGISTER 0x23
|
||||
|
||||
//**************************************************************
|
||||
//Z21 BC Flags
|
||||
#define Z21bcNone B00000000
|
||||
#define Z21bcAll 0x00000001
|
||||
#define Z21bcAll_s B00000001
|
||||
#define Z21bcRBus 0x00000002
|
||||
#define Z21bcRBus_s B00000010
|
||||
#define Z21bcRailcom 0x00000004 //RailCom-Daten fĂźr Abo Loks
|
||||
#define Z21bcRailcom_s 0x100
|
||||
|
||||
#define Z21bcSystemInfo 0x00000100 //LAN_SYSTEMSTATE_DATACHANGED
|
||||
#define Z21bcSystemInfo_s B00000100
|
||||
|
||||
//ab FW Version 1.20:
|
||||
#define Z21bcNetAll 0x00010000 // Alles, auch alle Loks ohne vorher die Lokadresse abonnieren zu mĂźssen (fĂźr PC Steuerung)
|
||||
#define Z21bcNetAll_s B00001000
|
||||
|
||||
#define Z21bcLocoNet 0x01000000 // LocoNet Meldungen an LAN Client weiterleiten (ohne Loks und Weichen)
|
||||
#define Z21bcLocoNet_s B00010000
|
||||
#define Z21bcLocoNetLocos 0x02000000 // Lok-spezifische LocoNet Meldungen an LAN Client weiterleiten
|
||||
#define Z21bcLocoNetLocos_s B00110000
|
||||
#define Z21bcLocoNetSwitches 0x04000000 // Weichen-spezifische LocoNet Meldungen an LAN Client weiterleiten
|
||||
#define Z21bcLocoNetSwitches_s B01010000
|
||||
|
||||
//ab FW Version 1.22:
|
||||
#define Z21bcLocoNetGBM 0x08000000 //Status-Meldungen von Gleisbesetztmeldern am LocoNet-Bus
|
||||
#define Z21bcLocoNetGBM_s B10010000
|
||||
|
||||
//ab FW Version 1.29:
|
||||
#define Z21bcRailComAll 0x00040000 //alles: Ănderungen bei RailCom-Daten ohne Lok Abo! -> LAN_RAILCOM_DATACHANGED
|
||||
#define Z21bcRailComAll_s B10000000
|
||||
|
||||
//ab FW Version 1.30:
|
||||
#define Z21bcCANDetector 0x00080000 //Meldungen vom Gelisbesetztmeldern am CAN-Bus
|
||||
#define Z21bcCANDetector_s B11000000
|
Loading…
Reference in New Issue