-
Notifications
You must be signed in to change notification settings - Fork 0
Model Info Manufacturer Interface
The manufacturer interface performs three primary functions: Administration management, Model and Component management, and Mediation controls. Only users contained in the AdminList shall be allowed to modify the data record. All reads are public to all users but are listed included in the Manufacturer interface as the manufacturer would be the primary user of these functions.
Write
WriteComponent
DeleteComponent
This function writes the MfgId and Model Data for a ModelId. Only those listed in the AdminList are allowed to perform this operation, which is controlled with the WriteAdmin function as described in the Administration management APIs. In order to delete a device, all components must be deleted (DeleteComponent), and then all fields in the model record shall be set to null with the Write function.
| Type | Name | Description |
|---|---|---|
| address | ModelId | ModelId for the model. |
| string | Data | JSON data describing the model. |
| address | MfgId | Manufacturer's ID |
| Type | Name | Description |
|---|---|---|
| bool | Status | True if the operation was successful |
var JsonData = '{"Mfg":"MfgA","Model":"ModelB","HwVer":"Hw1","FwVer":"Fw2"}'
var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
ModelInfo.Write(ModelId, JsonData, {from:ContractOwner,gas:470000})
This function adds a component to a ModelId. Only those listed in the AdminList are allowed to perform this operation, which is controlled with the WriteAdmin function as described in the Administration management APIs.
| Type | Name | Description |
|---|---|---|
| address | ModelId | ModelId for the model. |
| address | Component | ModelId of component. |
| Type | Name | Description |
|---|---|---|
| bool | Status | True if the operation was successful |
var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
var Component = "0x1bbe4a661fdcb10ccc698ff484549555513684dc"
ModelInfo.WriteComponent(ModelId, Component, {from:AdminA,gas:470000})
This function deletes a component to a ModelId. Only those listed in the AdminList are allowed to perform this operation, which is controlled with the WriteAdmin function as described in the Administration management APIs.
| Type | Name | Description |
|---|---|---|
| address | ModelId | ModelId for the model. |
| address | Component | ModelId of component. |
| Type | Name | Description |
|---|---|---|
| bool | Status | True if the operation was successful |
var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
var Component = "0x1bbe4a661fdcb10ccc698ff484549555513684dc"
ModelInfo.DeleteComponent(ModelId, Component, {from:AdminA,gas:470000})
This function writes an AdminId to a ModelId. If the device is unclaimed, then the first user to call the WriteAdmin for the ModelId shall be granted administrator rights. Otherwise, only those listed on the AdminList shall be allowed to modify the AdminList. In order to remove a user off the AdminList, an existing Admin user shall call this function and write NULL to the admin index they wish to remove.
Currently, the maximum number of administrators per ModelId is 5.
| Type | Name | Description |
|---|---|---|
| address | ModelId | ModelId for the model. |
| uint | Index | AdminList Index |
| address | AdminId | New AdminId to be written to the AdminList |
| Type | Name | Description |
|---|---|---|
| bool | Status | True if the operation was successful |
var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
var Index = 0
var AdminId = "0x1bbe4a661fdcb10ccc698ff484549555513684dc"
ModelInfo.WriteAdmin(ModelId, Index, AdminId, {AdminId,gas:470000})
This function returns the entire AdminList.
Currently, the maximum number of administrators per ModelId is 5.
| Type | Name | Description |
|---|---|---|
| address | ModelId | ModelId for the model. |
| Type | Name | Description |
|---|---|---|
| address[] | AdminId | True if the operation was successful |
var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
ModelInfo.ReadAdminList(ModelId, {AdminId,gas:470000})
0x2ce23c3c4692079c1eba9ffce2b7175fa43d106e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000