Serialization | Iot framework ServerSuperIO tutorial 2. service instance configuration parameter description, superio application instance

Source: Internet
Author: User

Serialization | Iot framework ServerSuperIO tutorial 2. service instance configuration parameter description, superio application instance

I. Summary

SuperIO (SIO) is located in the PC terminal (host computer) application. It has only one service instance and the configuration parameter is a global attribute. However, the ServerSuperIO (SSIO) and SuperIO (SIO) positioning are different. SSIO is located on the server side. Both the serial communication mode and the network communication mode support multiple service instances, therefore, each service instance has its own configuration parameters. All configuration parameters are defined in ServerConfig. cs file.

As shown in the following figure:

Ii. configuration parameters

# Region global [Category ("1. global "), DisplayName (" ServerSession "), Description (" identifies the unique service ID, generally Guid "), DefaultValue (" "), ReadOnly (true)] public string ServerSession {get; set;} [Category ("1. global "), DisplayName (" ServerName "), Description (" Name of the Service title "), DefaultValue (" ")] public string ServerName {get; set ;} [Category ("1. global "), DisplayName (" DeliveryMode "), Description (" distribution policy after receiving data, including: distribution by device IP (DeviceIP), distribution by device code (DeviceCode) "), DefaultValue (DeliveryMode. deviceIP)] public DeliveryMode {get; set;} [Category ("1. global "), DisplayName (" ControlMode "), Description (" scheduling device driver and IO instance policies, including Loop and Parallel), autonomous mode (Self) and Singleton mode (Singleton) "), DefaultValue (ControlMode. loop)] public ControlMode {get; set;} [Category ("1. global "), DisplayName (" StartReceiveDataFliter "), Description (" identify whether to filter data according to the protocol filter after receiving data. If not, data is directly returned "), defaultValue (false)] public bool StartReceiveDataFliter {get; set;} [Category ("1. global "), DisplayName (" StartCheckPackageLength "), Description (" identifies whether to check the data length. If this parameter is enabled, the GetPackageLength API driven by the Protocol is called, until the returned data length is received "), DefaultValue (false)] public bool StartCheckPackageLength {get; set ;}# endregion # region serial port [Category (" 2. serial Port "), DisplayName (" ComReadBufferSize "), Description (" setting the maximum byte array for receiving data at a time "), DefaultValue (1024)] public int ComReadBufferSize {get; set ;} [Category ("2. serial Port "), DisplayName (" ComWriteBufferSize "), Description (" set the maximum byte array for one data transmission "), DefaultValue (1024)] public int ComWriteBufferSize {get; set ;} [Category ("2. serial Port "), DisplayName (" ComReadTimeout "), Description (" set the time-out for one data read "), DefaultValue (1000)] public int ComReadTimeout {get; set ;} [Category ("2. serial Port "), DisplayName (" ComWriteTimeout "), Description (" set the time-out for one data transmission "), DefaultValue (1000)] public int ComWriteTimeout {get; set ;} [Category ("2. serial Port "), DisplayName (" ComLoopInterval "), Description (" waiting time between sending and receiving data in polling mode, serial communication does not support other control modes "), defaultValue (1000)] public int ComLoopInterval {get; set ;}# endregion # region network [Category ("3. network "), DisplayName (" NetReceiveBufferSize "), Description (" setting the maximum byte array for receiving data at a time "), DefaultValue (1024)] public int NetReceiveBufferSize {get; set ;} [Category ("3. network "), DisplayName (" NetSendBufferSize "), Description (" set the maximum byte array for one data transmission "), DefaultValue (1024)] public int NetSendBufferSize {get; set ;} [Category ("3. network "), DisplayName (" NetReceiveTimeout "), Description (" set the time-out for one data read "), DefaultValue (1000)] public int NetReceiveTimeout {get; set ;} [Category ("3. network "), DisplayName (" NetSendTimeout "), Description (" set the time-out for one data transmission "), DefaultValue (1000)] public int NetSendTimeout {get; set ;} [Category ("3. network "), DisplayName (" NetLoopInterval "), Description (" waiting time between sending and receiving data in polling mode "), DefaultValue (1000)] public int NetLoopInterval {get; set;} [Category ("3. network "), DisplayName (" MaxConnects "), Description (" Maximum number of connections allowed on the client, exceeding the maximum value, automatically disabling remote connection "), DefaultValue (1000)] public int MaxConnects {get; set;} [Category ("3. network "), DisplayName (" KeepAlive "), Description (" A mechanism for detecting dead connections and semi-Connections "), DefaultValue (5000)] public uint KeepAlive {get; set;} [Category ("3. network "), DisplayName (" ListenPort "), Description (" port listening for receiving data "), DefaultValue (6699)] public int ListenPort {get; set ;} [Category ("3. network "), DisplayName (" BackLog "), Description (" specify the maximum number of incoming connections that can be accommodated in the queue "), DefaultValue (1000)] public int BackLog {get; set;} [Category ("3. network "), DisplayName (" CheckSameSocketSession "), Description (" for a fixed device, only one valid connection is allowed, and multiple IP connections are allowed, disconnect the previous connection "), DefaultValue (true)] public bool CheckSameSocketSession {get; set;} [Category (" 3. network "), DisplayName (" SocketMode "), Description (" indicates that the device is in TcpServer and TcpClient modes. If the device is in TcpClient mode, it actively connects to the remote IP address and port "), defaultValue (SocketMode. tcp)] public SocketMode {get; set;} [Category ("3. network "), DisplayName (" ClearSocketSession "), Description (" identify whether to clean up the connection. If a connection does not receive data within a certain period of time, it will take the initiative to disconnect "), defaultValue (false)] public bool ClearSocketSession {get; set;} [Category ("3. network "), DisplayName (" ClearSocketSessionInterval "), Description (" if the ID is used to clean up the connection, then the ID is used to clean up the connection interval "), DefaultValue (10)] public int ClearSocketSessionInterval {get; set;} [Category ("3. network "), DisplayName (" ClearSocketSessionTimeOut "), Description (" if the mark is used to clean up the connection, then how long the mark has not received the data for cleanup "), DefaultValue (30)] public int ClearSocketSessionTimeOut {get; set ;}# endregion

Iii. Common configuration parameters

Common configuration parameters include communication parameters, control parameters, and advanced application parameters. The following code

IServer server = new ServerFactory (). createServer (new ServerConfig () {ServerName = "Service 1", // service instance name ComReadTimeout = 1000, // serial port read data timeout ComWriteTimeout = 1000, // serial port data sending timeout NetReceiveTimeout = 1000, // network receiving data timeout NetSendTimeout = 1000, // network sending data timeout ControlMode = ControlMode. parallel, // control mode SocketMode = SocketMode. tcp, // whether the network communication mode is TCP or UDP StartReceiveDataFliter = false, // whether to enable the receiving data filter. Next we will introduce ClearSocketSession = false, // whether to check whether the network instance is valid, startCheckPackageLength = false // check whether the package length is detected. Next important });

The ControlMode parameter is a control mode that combines SSIO with real-world application scenarios. It is mainly used to call the scheduling mode for sending and receiving data from devices. See: serialization | Iot framework ServerSuperIO tutorial 1.4 communication modes.

Iv. configuration tools

Secondary developers can configure parameters for service instances, device drivers, and service instances through the ServerSuperIO. Tool project. For example:

Note: The next article introduces the device driver.

 

1. [serialization] C # communication (Serial Port and network) Framework Design and Implementation

2. [Open Source] C # cross-platform Iot communication framework ServerSuperIO (SSIO) Introduction

2. Overall system construction solution using SuperIO and open-source cross-platform Iot framework ServerSuperIO

3. C # technical route of industrial IoT and integrated system solutions (data sources, data collection, data upload and receiving, ActiveMQ, Mongodb, WebApi, and mobile App)

5. ServerSuperIO Open Source Address: https://github.com/wxzz/ServerSuperIO

Internet of Things & integrated technology (. NET) QQ Group:54256083

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.