Hint for the txt-format-version; to read this version as PDF please load https://www.dk1ri.de/myc/commands.pdf Webserver for a MYC System Author: DK1RI Version V01.01.08 20240904 This paper is published in https://github.com/dk1ri as well Introduction This paper describes a special SK – a webserver. It is a user interface for a MYC system. A browser should have access to this webserver and is the real SK (skin). For more details of the MYC system please check the reference. The program is not finished! Definitions and formats see https://dk1ri.de/myc/Definitions.txt or https://dk1ri.de/myc/Definitions.pdf Status Apache webserver (XAMPP) on windows set up All commands are working; may be with some restrictions. USB interface to one device is working. Some user definable GUI setting (color, sequence, ignore commands or chapter, individual language) are implemented The webserver can handle announcelists with more than one device, as necessary, when using a commandouter. Individual data can be stored by user Attention: The syntax for rules was harmonized (“R “ was changed to “R;”), This may produce an error, when starting the webserver but has no influence to other function The devices will be modified in next future (202408). Some limitations - The idea is, that the communication to the webserver is without errors and the announcementfile has correct syntax. The webserver make some basic checks of the announcementfile, but most probably syntax errors will produce errors or crash the program. In this case, correct the announcement file and delete the file session_original_announce in the device directory. Than new data will be generated with the next start. - The commandrouter has interface to one device. As a solution without the commandrouter different devices can be selected when commandrouter is set to 0 in the configfile. - It is necessary to start three programs: browser, web-server and a python program for the device interface (if the device is connected via USB only) I did not found a solution to connect the webserver to USB directly. So data exchange is done by filetransfer using the additional python program. This cost time. - For read commands there may be a delay (dead) time after a command. - Windows only is tested (Win11) with firefox browser. - The MYC protocol has no limitations with the number of elements of some commands and the use of descriptions is not mandatory. With the usage of the webserver descriptions for large memories e.g. are necessary. Before using a device with a webserver it should be checked, weather there are meaningful results. - ext is not supported - CODING and restrictions of manual numeric input is not supported - some OPTIONs are not supported - modifying the design of the webpage is limited (see above). A solution using javascript is outstanding. Starting / preparations The following programs must be installed: on the client: a browser (firefox is used) enable javascript for the browser (for later use) on the webserver (Win10 and Win11 tested): xampp (standard installation, nothing special [19]) Your device must provide a filetransfer interface. A device with software interface should have this. For a (hardware) device with USB interface the following apply: install python (standard installation, nothing special [20]) usbserial is necessary for python: open Powershell cd C:\Users\your_name\AppData\Local\Programs\Python\Python_version\Scripts (you must replace yourname and version with your data) pip.exe install usbserial or C:\Users\your_name\AppData\Local\Programs\Python\Python_version\python.exe -m pip install usbserial move the original \xampp\htdocs to another directory, (if you need this for later usage). download a new htdocs from [17], unzip and copy to \xampp create a new \xampp\htdocs\devices\ directory download the device from [18], unzip and copy the content to \xampp\htdocs\devices. The __announcement file is necessary only. For most existing devices these data are available. Usage of the SK on the webserver: call the xampp control Panel start modul Apache (at least) it may be necessary to enable firewall for Apache web server if you have a device with software filetranfer: start this programm. Otherwise: connect the device and find out the USB port , the device is connected open Powershell cd \xampp\htdocs C:\Users\your_name\AppData\Local\Programs\Python\Python_version\python.exe USB_serial.py In a browser (on the same computer as the webserver) call localhost/myc.php If you use a different (remote) computer replace /localhost by the internetaddress or domainname. Some tips for usage, which may help: - to unselect a switch of an or command “control” + mouse-click! - for switches and range commands: if you change the stack, the new values are shown and the operating requests are ignored, if a read command is checked.. You must initiate changes of the new stack by another command. - Strings (for manual entries) can be entered in hex or binary format by starting with &H or &B for each character. If a character not belonging to this format is found the data are not converted. To enter a “0” when in binary input mode you must enter &T first. Numbers for manual entries can be entered in binary / hex format as well. The start with &H or &B. - Entering numbers manually, the right format must be observed. For some formats negative values are not allowed. Single and double must be (-)0.xxxe(-)xx. Wrong data are ignored. - for entering data of commands with more than one value (ob, on, of) the separation character is blank (“|”). So when you want to enter a “|” for strings you must write &H7C. Received data are printed as printable characters(including space) or &Hxx. Separator for multiple elements of ob / on and f commands is “ . “. - The number of entries for stacks and memory positions is not limited. But it is recommended, that the device delivers suitable descriptions with MUL and ADD using a small number of entries (< 100). - if you are testing new devices, the _alpha file is not updated. You must delete it for update with the next run of the program. - indivdual users ( with name other than “user” can store indivdual settings for GUI color, sequence of the controls and a personal translation of the (english) names Other devices For devices not found in [18] you can create your own. create the directory \xampp\devices\your_new_device copy your announcefile to this directory. The name should be _announcement or announcement.bas. Syntax errors in the announcement file may create a crash of the webserver. Other languages: Modifying the translations and adding additional languages is supported. It can be stored by user Some additional explanations I did some basic HTML programming earlier, and this is my first PHP program; so some enhancement have to be done. My intention was: - the web-server should work without the need of internet access (standalone). - the programming should be as simple as possible and require as less resources as possible to work on simple equipment as an old raspberry. - the programming should be as simple as possible, so that it works with all browsers. - the web-server do not use a database program, but calculate many data at the first start. - the usage should be simple (there is a lot to do) - the web-pages will be completely dynamic, so that all kinds of announcelists can be used. The code can be shrinked by deleting comments, Tabs and CR with a suitable program. Missing: automatically update when info data arraive. External programs Because I found no simple way for the web-server to communicate with USB device, an additional python script is necessary.. The web-server create file file with the data to send, and wait for an answer (for answer commands). The script USB_serial read the file, send data to the device, wait for answer (for answer commands) and put it to a file. The web-server read it, and update the values and display the page My Test environment I work with one windows laptop (Win10 or Win11) For development of the pages I use PhpStorm, and I installed a web-server (XAMPP).. Copyright Dieses Dokument darf unverändert kopiert werden. Die Ideen in diesem Dokument unterliegen der GPL (Gnu Public Licence,V2) soweit keine früheren, anderen Rechte betroffen sind. Die Veforwendung der Unterlagen erfolgt auf eigene Gefahr; es wird keinerlei Garantie übernommen. This document can be copied without changes. The ideas of this document can be used under GPL (Gnu Public License, V2) as long as no earlier other rights are affected. The usage of this document is on own risk, there is no warranty. Reference [1] https://dk1ri.de/myc/MYC.pdf (german) [2] https://dk1ri.de/myc/MYC.en.pdf [3] https://dk1ri.de/myc/Description.txt or https://dk1ri.de/myc/Description.pdf [4] https://dk1ri.de/myc/commands.txt or https://dk1ri.de/myc/commands.pdf [5] https://dk1ri.de/myc/Reserved_tokens.txt or https://dk1ri.de/myc/Reserved_tokens.pdf [6] https://dk1ri.de/myc/Rules.txt or https://dk1ri.de/myc/Rules.pdf [7] https://dk1ri.de/myc/commandrouter.txt or https://dk1ri.de/myc/commandrouter.pdf [8] https://dk1ri.de/myc/Rules_device.txt or https://dk1ri.de/myc/Rules_device.pdf [9] https://dk1ri.de/myc/skin.txt or https://dk1ri.de/myc/skin.pdf [10] https://dk1ri.de/myc/logicdevice.txt or https://dk1ri.de/myc/logicdevice.pdf [11] https://dk1ri.de/myc/Definitions.txt or https://dk1ri.de/myc/Definitions.pdf [12] https://dk1ri.de/myc/spec_version.txt or https://dk1ri.de/myc/spec_version.pdf [13] https://dk1ri.de/myc/webserver.txt or https://dk1ri.de/myc/webserver.pdf [14] https://dk1ri.de/myc/ki.txt or https://dk1ri.de/myc/ki.pdf [15] https://dk1ri.de/myc/communication.txt or https://dk1ri.de/myc/communication.pdf [16] https://dk1ri.de/myc/Security.txt or https://dk1ri.de/myc/Security.pdf [17] https://dk1ri.de/myc/htdocs.zip [18] https://dk1ri.de/ew_dat.htm [19] https://www.apachefriends.org/de/download_success.html [20] https://www.python.org/downloads/