Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Mobile Operator

Windows 10 – app to service

  • Last UpdatedFeb 17, 2025
  • 2 minute read

Steps to create a peripheral using windows service application

  1. Open Visual Studio then go to File > New > Project. That will open a dialog box for a new project then select "Window Service" and click on the OK button.

  2. Add IntelaTrac.Mobile.Peripheral.Sdk.UWP.dll reference to the Windows service project and download the latest newtonsoft.json dependencies from Nuget package manager.

  3. After creating the project, you can see the service design page as in the following and click on the link "click here to switch to code view".

  4. The Windows Service class should contain the two functions OnStart() and OnStop() and contain the following code:

    public partial class WinService : ServiceBase

    {

    public WinService()

    {

    InitializeComponent();

    }

    protected override void OnStart(string[] args)

    {

    // Add code here

    }

    protected override void OnStop()

    {

    // Add code here

    }

    }

  5. Add a namespace using Intelatrac.Mobile.Peripheral.Sdk in windows service class.

  6. Create a new class IntelatracRequest.cs and implement the IRequestHandler interface. For example, refer IntelaTracRequest.cs in the TestPluginService project from the samples folder.

  7. Refer section 2.1 IRequestHandler for details regarding the IRequestHandler methods.

  8. In the OnStart method of the Windows service class, create an instance of Intelatrac.Mobile.Peripheral.Sdk.PeripheralService with IP and port number of the device where the service will be hosted as parameters.

  9. Create an instance of PeripheralService with passing "server URL" inside in OnStart method in windows service class.

    Note: The IP and port number should match the URL and port number of server information in Peripheral Information Bag.

  10. Register the request handler created in step 6 and the peripheral type with the PeripheralService instance as shown below:

    new PeripheralService("localhost", "1000").Register(peripheralType, new IntelaTracRequest());

    • Peripheral Type indicates the category of the peripheral plugin. For example, "Barcode", "RFID", "Temperature", etc.

    • Peripheral type registered with the Peripheral Service should match with the Type configured under server information in Peripheral information bag.

  11. Go to Solution Explorer and right-click on WinService.cs then go to the view designer then look at the design view then right-click on the design page and click on "add installer" and it will look like this:

  12. After adding the ProjectInstaller.cs, you have 2 components in the design view of the ProjectInstaller.cs (serviceProcessInstaller1 and serviceInstaller1). You should then set up the properties as you need.

  13. Click on serviceinstaller1 and go to the properties in the right pane and edit the service name Service1 if required.

  14. Click on serviceProcessInstaller1 and go to the properties in the right pane and select Account and choose LocalService from the dropdown and save.

  15. Build the project and install the service using installutil command

  16. Check more info for installing service: Install/uninstall Service

  17. Once the service is installed, right click on the service to open property of service. Switch to "Log on" tab, select the "Local System account" radio button and select the "Allow service to interact with desktop" checkbox. Apply the changes and close properties.

  18. Run the service.

    Note: Ensure "Loop Back Service" is checked for the AVEVA Mobile Operator application.

TitleResults for “How to create a CRG?”Also Available in