APIs for the Milli Manufacturing Tools

RMA Test and Milli Personalization APIs

Introduction 

This page describes the APIs exposed by the Milli Manufacturing Tools application. An Itron Partner can build their own custom applications by integrating with these APIs. The sections below describe the Milli Personalization and the RMA Test APIs. The Reporting Module APIs are described here.

 

Pre-Requisites

The Milli Manufacturing Tools Application is a C#/.NET based application that requires Visual Studio IDE for development. To be able to view the APIs and use them in a custom application, please install Visual Studio Community 2017 on your development machine. Here are the steps to do this:

  • Download Visual Studio Community 2017, double-click on the installer, and follow the steps to install.
  • Select .Net Desktop Development and click Install. See the following image for reference. 

 

 

Milli Personalization APIs

The Personalization APIs are a set of .NET classes with a common Personalization Base class. The following combination of properties and methods provide the personalization:

  • Properties
    • ComPort – COM port representing the debug UART or in future, the FSU
    • ConfigPath – file path for the Personalization Config to be applied to the Milli
       
  • Methods
    • ApplyConfiguration – applies the contents of ConfigScript to the UUT
    • ConfigScript – deserialization of the file referenced by ConfigPath
    • ValidateConfiguation – validates the script referenced by ConfigPath, and set ConfigScript
    • VerifyPersonalization – verifies the settings applied on the Milli
    • GetMacAddress –​ reads the MAC address of the Milli connected with COM port
       
  • Events
    • OnError  When there is an error to be raised, register a callback method with OnError of WiredPersonalization class
    • ConfigProcess – raised after getting a response from Milli for each sysvar command
    • OnResetMilli – raised to notify the user when the calling application needs to restart Milli manually
    • OnPersonalizationComplete – raised after successful personalization of Milli

 

 

Properties

The following section describes the available configurable properties associated with the Milli Manufacturing Tools App. 

COMPort

Signature: public string ComPort { get; set; } –

This property is used to set COM Port name on which Milli is connected through UART cable.

 

ConfigPath

Signature: public string ConfigPath { get; set; }

This property is used to set metadata JSON file path

 

 

Methods

The following section describes the available configurable methods associated with the Milli Manufacturing Tools App. 

ApplyConfiguration

Signature: public void ApplyConfiguration(CancellationToken ct)

This method writes the sysvars on to Milli based on the metadata JSON values. This method takes a CancellationToken as an optional parameter. This token is used to cancel personalization process from UI/reference app.

 

ValidateConfiguration

Signature: public void ValidateConfiguration()

This method used to read the metadata JSON from provided config path and validate it to confirm that metadata JSON is well formed. After validating metadata JSON, the Milli Personalization library de-serializes the JSON and prepares commands based on the sysvar value provided in metadata JSON.

 

VerifyPersonalization

Signature: public bool VerifyPersonalization();

This method is used to verify the sysvars which have been written onto Milli as described in 3.2.1. This API should be called on ‘OnPersonalizationComplete’ event (refer 3.3.4) , using same personalization object.

 

GetMacAddress

Signature: public string GetMacAddress()

This API reads the MAC address of the Milli connected with COM port. API should not be called before setting 'ComPort' property of Personalize object.

 

Events

The WiredPersonalization class exposes the following events. The calling application can register a call back method and invoke the events.

OnError

When there is an error to be raised, register a callback method with OnError of WiredPersonalization class.

Create an object of WiredPersonalization class to access OnError event and register the call back method.

Implement the call back method and access the error as e.Message where ConfigProgressArgs is a sample Class.

 

ConfigProcess

This event is raised after getting a response from Milli for each sysvar command. Register a handler if you want to capture this event while processing each sysvar.

Create an object of WiredPersonalization class to access ConfigProgress event and register the event handler.

Implement the handler method and access the Result as e.Message where ConfigProgressArgs is a Class.

 

OnResetMilli

This event is raised to notify the user when the calling application needs to restart Milli manually.

Create an object of WiredPersonalization class to access OnResetMilli event and register the event handler

Implement the handler and intimate user to restart Milli by displaying any message or pop up box.

 

OnPersonalizationComplete

This event is raised after successful personalization of Milli. To acess OnPersonalization Colmplete event and register the event handler, create an object of WiredPersonalization class.

Implement the handler method which executes when the personalization process is completed successfully.

 

Sample Code

The following code snippet is a sample usage of the WiredPersonalization class library. This code is meant to be used as an example and should be modified according to the specific use case to be implemented. 

 

 

RMA Test APIs

The RMA Test APIs are a set of .NET classes with a common Commands  class. The following combination of methods and events perform RMA Tests.

  • Methods​
    • ​Commands Class Methods
      • SetBoot - sets the self-test image on the Milli using sio_load.exe
      • Connect - connects and enables access to the COM Ports to which Milli modules are connected
      • Disconnect - disconnects the Milli modules from their associated COM Ports
      • StartRftest - starts the RF test
      • TerminateRfTest - ends the RF Test process
      • GetMacAddress - extracts the MAC address associated with the UUT
      • IsMilliOnSelfTestImage - checks if Milli(UUT and KGU) is currently running Self Test Image
    • ​ResponseAnalyzer Class Methods
      • CalculatePacketSuccessPercent - calculates the Packet Success Percentage 
      • ParseCfgResponseToGetMac - parses the Configuration response to obtain the MAC address of the unit

 

  • Events
    • ​Command Class Events
      • OnError - register a callback method when there is an error to be raised
      • OnStepComplete - raise this event when there is a successful step completion
      • RestartMilli - an event needs to be raised to prompt user to restart the Milli
      • RFTestProgress -  monitor RF Test Progress
    • ResponseAnalyzer Class Events
      • OnRfTestComplete - When RF Test Completes, to raise an event
      • OnErrorWhileParsingResponse - to capture the error encountered while parsing the response

 

Command Class Methods

SetBoot

Signature: public bool SetBoot (string pathForSioload, string portName)

This method sets the self-test image on the Milli using sio_load.exe.

The input parameters are as follows: 

  • the path where the sio_load.exe has placed
  • the port to which the UUT or KGU is connected

This method starts with the raising of an event, which instructs the user to restart the Milli. Once the Mill is restarted, the command executes. 

In the event of a successful SetBoot execution, a True value is returned.

 

Connect

Signature: public bool Connect (string portName, int baud rate, PortType portType)

The Connect method connects and starts access to the ComPort to which Milli modules are connected.

The input parameters are as follows:

  • portName as string
  • baud rate as int
  • portType as PortType 
    • This is an enumeration parameter. Types include: UUT and KGM

 

The Connect method returns a boolean value which states whether the connection was a success or failure.

Execute the Connect method after executing the SetBoot method.

Disconnect

Signature: public void Disconnect (PortType portType)

The Disconnect method disconnects the Milli modules from their associated COM Port. 

The input parameters are as follows: 

  • portType as PortType 
    • This is an enumeration parameter. Types include: UUT and KGM

StartRfTest

Signature: public virtual void StartRfTest (ResponseAnalyzer resp)

The public void StartRfTest method starts the RF test. The command starts the RF server on the Known Good Milli Unit. It then starts the actual RF test on the UUT. 

Before performing the RF Test:

  • Ensure that the Milli Units  are connected
  • Execute the SetBoot method

 

The input parameters are as follows:

The object of ResponseAnalyzer class processes the response from the Milli Unit and raises the appropriate events.

 

TerminateRfTest

Signature: public void TerminateRfTest()

This method terminates the RF Test process.

 

GetMacAddress

public string GetMacAddress(ResponseAnalyzer resp)

This method extracts the MAC address associated with the UUT. 

The input parameters are as follows: 

  •  The object of ResponseAnalyzer class processes the response from the Milli Unit to get the MAC Address

 

IsMilliOnSelfTestImage

Signature: public virtual bool IsMilliOnSelfTestImage(string portName,int baudRate,PortType portType)

This method checks if Milli(UUT and KGU) is currently running Self Test Image

The input parameters are as follows: 

  • portName as string
  • baud rate as int
  • portType as PortType 
    • This is an enumeration parameter. Types include: UUT and KGM

 

 

ResponseAnalyzer Class Methods 

CalculatePacketSuccessPercent

Signature: public  RFTestResponseData CalculatePacketSuccessPercent (string response,string macAddress)

This method calculates the Packet Success Percentage. 

 

ParseCfgResponseToGetMac

Signature: public string ParseCfgResponseToGetMac (string cfgResponse) 

This method parses the Configuration response to obtain the MAC address of the unit. The response includes all of the configuration information.

 

Commands Class Events 

OnError

When there is an error to be raised, register a callback method with OnError of commands class.

Create an object of Commands class to access OnError event and register the call back method

_commands.OnError += Commands_OnError;

Implement the call back method and access the error as e.Error where ErrorEventArgs is a class.

public string Error { get; set; }
public void Commands_OnError(Commands sender, EventsHandler.ErrorEventArgs e)
        {
            Error = e.Error;
 }

 

OnStepComplete

When there is a step complete to be raised on successful step completion ex:, “UUT Connected” message on successful connection of UUT, register a callback method.

Create object of Commands class to access OnStepComplete event and register the call back method

 _commands.OnStepComplete += Commands_OnStepComplete;

Implement the call back method and we will now access the Result as e.Result where StepCompleteEventArgs is a Class.

public string Message { get; set; }
private void Commands_OnStepComplete(Commands sender, EventsHandler.StepCompleteEventArgs e)
{
            Message = e.Result;
}

 

RestartMilli

When an event needs to be raised to prompt user to restart the Milli.

Create object of Commands class to access RestartMilli event and register the call back method

 _commands.RestartMilli += Commands_RestartMilli;

Implement the call back method and access the Message as e.Message where RestartMilliForSetBootEventArgs is a class.

public string Message { get; set; }
  private void Commands_RestartMilli(Commands sender, EventsHandler.RestartMilliForSetBootEventArgs e)
        {
            Message = e.Message;
}

 

RFTestProgress

This  event needs to be raised to monitor RF Test Progress

Create object of Commands class to access RFTestProgress event and register the call back method

 _commands.RFTestProgress += MonitorRFTestProgress;

Implement the call back method and access the status as e.status where RFTestProgressEventArgs is a class.

public string RFProgressBarStatus { get; set; }
  private void MonitorRFTestProgress(Commands sender, EventsHandler.RFTestProgressEventArgs e)
        {
            RFProgressBarStatus = e.status;
}

 

 

ResponseAnalyzer Class Events

OnRfTestComplete

When RF Test Completes, to raise an event, register a callback method as below

Create object of ResponseAnalyzer class to access OnRfTestComplete event and register the following callback method:
 _responseAnalyzer.OnRfTestComplete += ResponseAnalyzer_OnRfTestComplete

Implement the call back method and access  ResponseData as e.ResponseData where RFTestReadResultEventArgs is a class: 
 private RFTestResponseData _rfTestResponseData;
private void ResponseAnalyzer_OnRfTestComplete(ResponseAnalyzer sender, EventsHandler.RFTestReadResultEventArgs e)
        {
            _rfTestResponseData = e.ResponseData;

}

 

OnErrorWhileParsingResponse

To capture the error encountered while parsing the response, a callback method has to be registered as below

Create object of ResponseAnalyzer class to access OnErrorWhileParsingResponse event and register the following callback method:

_responseAnalyzer.OnErrorWhileParsingResponse += _responseAnalyzer_OnErrorWhileParsingResponse;

Implement the call back method and access the data as e.data where RFTestErrorEventArgs is a class.

private RFTestResponseData _rfTestResponseData;

private void _responseAnalyzer_OnErrorWhileParsingResponse(ResponseAnalyzer sender, EventsHandler.RFTestErrorEventArgs e)
        {
            _rfTestResponseData = e.data;

}