[Tutorial on industrial serial port and network software communication platform (SuperIO)] 7. Secondary Development Service driver, network software superio
SuperIO data download: Role of http://pan.baidu.com/s/1pJ7lZWf1.1 Service Interface
The data collected by the device driver module provides a variety of application services as needed, such as data upload service, Data Request Service, 4-20mA service, SMS service, LED service, and OPC service. To ensure real-time and stable data, service interfaces can provide a wide range of functional service mechanisms to facilitate developers to perform secondary development.
1.2 interface function description
Develop the device output interface, mainly considering the output of various data formats during or during the integration process in the integration project. The SuperIO. Export. IExportData interface must be inherited. The interfaces include:
1) StartService
When the IsAutoStart method of the service is "auto start", the platform automatically calls this interface function when loading the service.
2) ReleaseService
API for releasing service resources.
3) OnClick
When the service type (ServiceType) is "display mode", the service name is displayed in the "service" menu. When you click the service menu item, click the interface function to call the form in this interface function.
4) WriteLogHandler
The log event interface displays the log information in the "running monitor.
5) ServiceType
Service types: Display Mode and hidden mode. The service of the display module displays the service name in the "service" menu. The hidden mode is not displayed in the "menu" menu. You can set this service to automatically start, the software automatically starts the service during the loading process.
6) IsAutoStart
The Service Startup type that identifies whether the service is automatically started.
7) ThisKey
Return the Form ID, which is unique. If the same form exists, the form is not displayed again.
8) ThisName
Form name.
9) UpdateDevice
Update device data and receive the object instance that is passed in by the OnDeviceObjectChangedHandler event of the device.
10) RemoveDevice
Remove a device. This function is called when the device is deleted.
11) Dispose
Release resource functions.
1.3 Development Service-driven
1) Add references to SuperIO components.
2) create a new class that inherits the SuperIO. Services. AppService abstract class and implements interface functions.
3) You can use the UpdateDevice interface function to update the cached data of the device.
1.4 debug Service Driver
The Interface Test has a form interface and must inherit "SuperIO. UI. mainForm class, and set the software platform as the debugging mode "SuperIO. device. debugDevice. isDebug = true ;",
Initialize the instance in Form_Load and load the graphic display module for debugging. this is mainly used to create an instance, such as the this. DebugAppService (SuperIO. Services. IAppService) _ service) statement. For example:
1.5 mount a service driver
Find the "configtool.exe" application in the "industry serial port" and "network software communication platform". Select the "service configuration" tab and click the "Attach service" button to mount the service driver module you just developed to the platform. For example:
1.6 run on the software platform
The service type and start type are used in combination. The service type is display mode, and both manual start and automatic start modes are supported. The service type is hidden mode and set to automatic start mode, in this way, the service is automatically started when the program is loaded.
For example:
Author: QQ: 504547114
QQ group: 54256083
Http://www.bmpj.net
Source Article address: http://www.bmpj.net/index.php? M = article & f = view & id = 7