Iot framework ServerSuperIO tutorial-21. Terminal control sensors or devices to form loop control. Appendix: demo source code,
21.1 Overview
Previous work of ServerSuperIO gradually laid the foundation for loop control or cascade control, such as the development and application of service connectors and Device Driver connectors. In short, it is to control the device (driver) or sensor by issuing commands in multiple forms, sensors, apps, or other terminals that control sites or monitoring sites on the cloud control the sensor, and control another sensor based on the collected data of the sensor.
The following describes how to control sensor devices on the cloud, apps, or other terminals (for more information about sensor control sensors, see: 12. Service Interface Development and bidirectional interaction with the cloud ). According to the communication protocol, the structured scheme and the corresponding functions can be completed without too much code. The effect is as follows:
21.4 Control End
There are many types of control terminals: the cloud sends control commands to lower-level users, and the App or PC software Connection Service sends control commands. Sending control commands include:
Public override void StartService () {string devId = "ControlDeviceService"; Driver dev = new Driver (); dev. receiveRequestInfos + = Dev_ReceiveRequestInfos; dev. deviceParameter. deviceName = "control device drive"; dev. deviceParameter. deviceAddr = 0; dev. deviceParameter. deviceID = devId; dev. deviceParameter. deviceCode = ""; dev. deviceDynamic. deviceID = devId; dev. deviceParameter. NET. remoteIP = "127.0.0.1"; dev. deviceParameter. NET. remotePort = 9600; dev. deviceParameter. NET. controllerGroup = "LocalGroup"; dev. communicateType = CommunicateType. NET; dev. initialize (devId); IServer server = new ServerManager (). createServer (new ServerConfig () {ServerName = "", ListenPort = 6670, ComReadTimeout = 1000, ComWriteTimeout = 1000, NetReceiveTimeout = 1000, NetSendTimeout = 1000, ControlMode = ControlMode. singleton, SocketMode = SocketMode. tcp, StartReceiveDataFliter = false, ClearSocketSession = false, StartCheckPackageLength = false, CheckSameSocketSession = false,}); server. addDeviceCompleted + = server_AddDeviceCompleted; server. deleteDeviceCompleted + = server_DeleteDeviceCompleted; server. socketConnected + = server_SocketConnected; server. socketClosed + = server_SocketClosed; server. start (); server. addDevice (dev );}
Dev. the ReceiveRequestInfos event is an event interface that the control driver inherits from the RunDevice Driver Class extension in the ServerSuperIO framework. The ServerSuperIO Singleton mode receives data information, if the protocol is met, the data information is fed back to the Communicate interface of the driver. The ReceiveRequestInfos event transmits the data information to the Dev_ReceiveRequestInfos function subscribed to the event by the proxy service. The Code is as follows:
The Dev_ReceiveRequestInfos function in the proxy service transmits information to the Device Driver Based on DeviceCode (addr) through the iserviceconneinterface of the Service connector. The Code is as follows:
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 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
: Http://www.bmpj.net/thread-14-1-1.html
1. C # Introduction to cross-platform Iot communication framework ServerSuperIO (SSIO)
Serialization | Iot framework ServerSuperIO tutorial 1.4 communication modes and mechanisms.
Serialization | Iot framework ServerSuperIO tutorial 2. service instance configuration parameters
Serialization | Iot framework ServerSuperIO tutorial-3. Device Driver Introduction
Serialization | Iot framework ServerSuperIO tutorial-4. For example, you can develop a device driver that supports both serial and network communication.
Serialization | Iot framework ServerSuperIO tutorial-5. Polling communication mode development and precautions.
Serialization | Iot framework ServerSuperIO tutorial-6. concurrent communication mode development and precautions
Serialization | Iot framework ServerSuperIO tutorial-7. Self-control communication mode development and precautions
Serialization | Iot framework ServerSuperIO tutorial-8. single-instance communication mode development and precautions
Serialization | Iot framework ServerSuperIO tutorial-9. protocol filter to solve multiple packet-related, sticky packet, and redundant data
Serialization | Iot framework ServerSuperIO tutorial-10. Two Methods for continuous transmission of large data streams (such as files)
Serialization | Iot framework ServerSuperIO tutorial-11. Implement device (driver) and device (driver) interaction and cascade control.
Serialization | Iot framework ServerSuperIO tutorial-12. Service Interface Development and bidirectional interaction with the cloud
Serialization | Iot framework ServerSuperIO tutorial-13. Custom View display interface development to meet different display requirements
Serialization | Iot framework ServerSuperIO tutorial-14. Introduction to preparation tools and mounting of device drivers, view drivers, and service instances
Serialization | Iot framework ServerSuperIO tutorial-15. Use of data persistence Interfaces
Serialization | Iot framework ServerSuperIO tutorial-16.OPC Server usage steps
Serialization | Iot framework ServerSuperIO tutorial-17. Support for real-time databases and high-concurrency storage of measurement point data
Serialization | Iot framework ServerSuperIO tutorial-18. Integrated OPC Client and usage steps
Serialization | Iot framework ServerSuperIO tutorial-19. device drivers and OPC Client Support persistence of mysql, oracle, sqlite, and sqlserver
Alibaba Cloud Iot framework ServerSuperIO tutorial-20. Network Communication Controller grouping to improve interactive load balancing capabilities. V3.6.6 released