Serial Port Server with sample code

时间:2016-02-02 05:05:42
【文件属性】:

文件名称:Serial Port Server with sample code

文件大小:1.74MB

文件格式:7Z

更新时间:2016-02-02 05:05:42

USB Serial Port Daemon

;;============================================================================== ;; README ;; ;; This is a serial port communication utility similar to Hyperterminal on ;; MS-Windows 98/2k/XP/Vista/7/8. ;; It not only provides common funtions about serail communications, but also ;; provides USB serial port converter detecting/auto-connecting. When the USB ;; device changing is detected, the CDC serial port can be opened automatically. ;; This utility can be a serial port server as well. It will pass all data read ;; from the serail port to the client utility and pass the data from the client ;; utility to the serial port. More jobs can be done by implementing the client ;; utilities. It is listening on `[Listen_Port]/Data' port. ;; ;;------------------------------------------------------------------------------ ;; Tip: ;; - when the mouse hovers over a component, a hint is displayed. ;; ;;------------------------------------------------------------------------------ ;; parameters and descriptions are shown following in "INI" file format. ;; ;;------------------------------------------------------------------------------ ;; Shortcuts : ;; F1 : shows this file ;; ;; F6 : pick a line up and send to the serial port ... cursor is in ;; the message window ;; ;; Ctrl-O : open(reopen) the serial port which shows in the port box ;; Ctrl-C : close the serial port currently open ;; ;; Ctrl-Enter : send the string line to the serial port ... cursor is in the ;; input box ;; Alt-Enter : send the string line to the serial port and added the line ;; into drop down list as well ... cursor is in the input box ;;------------------------------------------------------------------------------ ;; Menu: ;; System/Sart Log : Starts log func ... all messages in window ;; will be recorded in the file ;; System/Stop Log : ... ;; System/Messager : chat with the client or server, if there is ;; System/Quit : Ctrl+Shift-Q ;;--- ;; Serial Port/Open : See "Ctrl-O" above ;; Serial Port/Close : See "Ctrl-C" above ;; Serial Port/Refresh list : Refresh the list of serial ports ;; Serial Port/Auto Open : Auto open the serial port when it is comming ;; Serial Port/Debug : Shows serial port debug msg such as open/close etc. ;; Serial Port/Hex : Shows data in hex format ;; Serial Port/CR : Appens \r\n at end of the line ;; Serial Port/Send file : will send the file which it's name is in ;; "Input" box ;; - The file will be splited in 256 bytes for ;; each block to sending. ;; - Between each blocks will delay the number ;; of ticks shows in "Auto sending delay ticks" ;; box. ;; Serial Port/Stop sending : Stop file sending ;; Serial Port/DTR : DTR enabled/disabled...[Serial_Port]/ControlDTR ;; Serial Port/RTS : RTS enabled/disabled...[Serial_Port]/ControlRTS ;; Serial Port/Send Line : Send the string line in the "Input" box to ;; the serial port ;;--- ;; Sock/Open : 1) Start listening on the ports in ;; [Listen_Port] section ;; 2) Try to connect to the servers in [Server] ;; section if there are ;; Sock/Close : Close all sockets ;; Sock/Debug : Shows socket messages in the window ;; Sock/Hex : Shows the data come from the sock in hex format ;; Sock/Send Line : This is for the test purpose ;;--- ;; Options : N/A ;;--- ;; Clear : Flush log file(if logging); clear message window ;;.............................................................................. ;; Hex options need to work with "dump" enabled ;; See batch script for detail ;;------------------------------------------------------------------------------ ;; "Serial Port/Send File" will send the file which it's name is in "Input" box ;; - The file will be splited in 256 bytes for each block to sending. ;; - Between blocks will delay the number of ticks shows in ;; "Auto sending delay ticks" box. ;;------------------------------------------------------------------------------ ;; Any suggestions, comment and bug report are very welcome. Thanks! ;; Sory for my English :-p ;;------------------------------------------------------------------------------ ;; _ _ _ ___ _ _ ;; _ _ _ ___ <_>__ __ | || || "| ___ ._ _ _ ___ <_>| | ___ ___ ._ _ _ ;; | | | |/ ._>| |\ \/\ \/| || || \_|/ . || ' ' |<_> || || | _ / | '/ . \| ' ' | ;; |__/_/ \___.|_|/\_\/\_\|_||_|`___/\_. ||_|_|_|<___||_||_|<_>\_|_.\___/|_|_|_| ;; <___' ;;============================================================================== ;;------------------------------------------------------------------------------ ;; please note: comments at end of the line are not acceptable ;; for example: ;; Key = 20 ;; Wrong ;; ;; below line is correct ;; Key = 20 ;;------------------------------------------------------------------------------ [Listen_Port] ;;; TCP server listening ports ;;; If you want to connect to YaTTYD over the Internet, below ports must be ;;; forwarding to the Internet; otherwise please see the comment in [Server] ;;------------------------------------------------------------------------------ Control =53001 ;;; Control port: chat and control channel ;;------------------------------------------------------------------------------ Data =53003 ;;; Data : listening port: all data come from this port ;;; will be passed to the serial port; and all data ;;; from serial port will be passed to this port to ;;; the client utility ;;------------------------------------------------------------------------------ debug =1 ;;; GUI->Sock->Debug ;;; Shows socket debug messages such as sock open/close etc. ;;------------------------------------------------------------------------------ [Server] ;;; YaTTYD can also running as a client end in the mean time ;;; The data come from serial port will be passed to "Data Server" ;;; "Data Server" is listening on "DataPort"; the address is "DataIP" ;;; ;;; Log server accept the log messages come from YaTTYD: ;;; All msg shown in the windows of YaTTYD will be sent to "Log Sever" ;;; "Log Server" is listening on port "LogPort"; the address is "LogIP" ;;; ;;; This option makes it is possible: ;;; Put YaTTYD in your customer side and connect to the device ;;; Open/forwarding your port to the Internet ;;; Listening on the port; wait the connection from YaTTYD ;;; Receiving data from the device : device->YaTTYD->your own server utility ;;; Sending data tp the device : your server->YaTTYD->device ;;------------------------------------------------------------------------------ ;ControlIP =agps.dyndns.org ControlIP =127.0.0.1 ControlPort =3057 ;; Control server IP and port ;; data behaviors here is similar ;; to [Listen_Port]/Control ;;------------------------------------------------------------------------------ ;DataIP =agps.dyndns.org DataIP =127.0.0.1 DataPort =3058 ;; refer to [Listen_Port]/Data ;;------------------------------------------------------------------------------ LogIP =agps.dyndns.org LogPort =3055 ;; log server ;;------------------------------------------------------------------------------ retry_delay =15 ;; if not connected to the server, retry ;; it after "retry_delay" seconds ;;------------------------------------------------------------------------------ [Serial_Port] ;;; serial port setting parameters ;;; the parameters will be updated when they are changed by GUI Baud=115200 DataBits =8 StopBits =1 Parity =None ControlDTR =1 ;;; GUI->Serial Port->DTR ControlRTS =1 ;;; GUI->Serial Port->RTS AutoOpen=1 ;;; GUI->Serial Port->Auto Open ;;; USB-Serial port will open automatically, ;;; when the USB-serial port is detected OpenDelay=5 ;;; After detected the USB changing delays n ticks ;;; (100ms per tick) then open the serial port. ;;; AutoOpen has to be 1 debug=1 ;;; GUI->Serial Port->Debug ;;; Shows debug messages such as port open/close etc. Hex=0 ;;; GUI->Serail Port->Debug ;;; shows data in hex format CR=1 ;;; GUI->Serail Port->CR ;;; Appends "\r\n" at the end of each input [http] root_dir = "wwwroot" port = 8181 [Application] one_insdence=1 Auto_Hide=1 Top=331 Left=777 Width=598 Height=301 ;;; default 380W x 240H Log =0 ;;; GUI->System->Start Log/Stop Log ;;===EOF======================================================================== Wrap=0


网友评论