Document directory
- 2.5.1 compile and add a policy
- 2.5.2 configure Project Properties
- 2.5.4 project deployment and debugging
- 2.5.5 project operation
Document Name |
Yfios Policy Development Guide |
Version |
V1.0.0 |
Author |
Ye fan |
Date |
2012-12-25 |
History |
|
Document list |
Http://www.sky-walker.com.cn/MFRelease/YF_document_list.pdf |
1 yfios Introduction
Yfios is short for yfsoft I/O server. In the IOT and cloud computing era, everything is data-centric. Different sensors access the network in different ways, provide services to different end users through cloud computing.
In order to adapt to the development of this new situation, it accelerates and reduces the cost of various sensors and smart modules to the Internet. net micro framework system to build a lightweight embedded Configuration System in the IOT Era --Yfios.
For more information, see yfios technical whitepaper.
2. Policy development 2.1 yfios SDK Installation
See the yfios Installation Guide.
2.2 create a policy project
Select the yfios strategy template for policy development.
2.3 Code Template
Public strategyinfo getstrategyinfo ()
{
Strategyinfo info = new strategyinfo ();
Info. Name = Name;
Info. configsize = 0;
Return Info;
}
The Code Template automatically generates the above Code.
2.4 Hello World
In the onrun function, add the following code:
Public int onrun (ioperate op, strategymode mode, object Arg)
{
Op. Print (messagetype. debug, "onrun", name );
Op. Print (messagetype. Information, "Hello world !!! ", This. Name );
Return 0;
}
2.5 policy test 2.5.1 compile and add a policy
Compile the policy code we just compiled. Start the yfios Manager program, click the policy list item in the tree control, and double-click Create... in the list control ...] The policy form is displayed.
Select the debug \ Le \ yfiosstrategy1.pe file.
Go to the Execution Mode panel, select the execution mode as loop, and set the cycle to 200 ms.
2.5.2 configure Project Properties
Click project properties in the tree control and double-click Configuration data in the list control. The following page is displayed. By default, user debugging, general information, and system debugging information are not checked.
Select all options.
2.5.4 project deployment and debugging
After saving the project, click debug> deploy (or click the deployment icon) to deploy the project.
2.5.5 project operation
Click debug> start to start the project.
In the information output window, we can see that the policy has been correctly loaded and the Hello world !!!
3. Policy debugging
Although the compiled policy can be debugged in yfiosmanager by means of information output, this debugging method is not ideal if the policy is complicated.
Therefore, we construct a tinyiosemulator for policy debugging in the Visual Studio 2010 environment.
Because yfsoft. drivertest is a standard. Net micro framework program, you need to set the system to. Net micro framework system mode during debugging.
EnsurePf9AndGndConnection.
3.1 Build tinyiosemulator
The tinyiosemulator project must reference the policy we just created.
The main code for testing is as follows:
Public class yfiosemulator
{
Yfios IOS = new yfios ();
Public void run ()
{
Yfiosstrategy1 MVS = new yfiosstrategy1 ();
MVS. onload (IOS. Operate, null );
While (true)
{
MVS. onrun (IOS. Operate, new strategymode (), null );
Thread. Sleep (3000 );
}
}
}
3.2 single-step debugging
As you can see, in the Visual Studio development environment, we can debug it, And the debugging window also outputs Hello world !!! Information.
4 additional instructions
This article is just an article about getting started with policy development. To write a complicated policy, you also need to learn a variety of development knowledge.
The content related to higher-level policy development is as follows:
(1) set the rule running mode;
(2) Develop policy graphics;
(3) mutual policy calls;
(4) The policy code references the third library;
(5) yfiobc operations;
(6) directly call the driver for a policy;
5. Related Resources
1.. Net micro framework Official Website
Http://www.microsoft.com/netmf/default.mspx
2.. Net micro framework official blog
Http://blogs.msdn.com/netmfteam/
3. Chinese Blog
Http://blog.csdn.net/yefanqiu
Http://www.cnblogs.com/yefanqiu
4. Ye Fan Technology
Http://www.sky-walker.com.cn/
5. Iot Middleware Technology Development Forum
Http://www.yfios.net
Yfios/yfhmi free trial
Yfios and yfhmi will be available for free for six months from January 21,. Users who meet the application requirements will receive yfios and yfhmi trial opportunities in turn.
Application form download: http://sky-walker.com.cn/MFRelease/document/yfios_yfhmi_application.doc