Skip to content

MetaData Manufacturer Interface

bradreevmx edited this page Jul 20, 2018 · 4 revisions

API List

Meta Data Managment

WriteAdmin
Delete
WriteAdmin
ReadAdminList

Mediation

WriteMediator
ReadMediatorList
ReadMediatorAdminList
ReadMediationState
WriteMediatorAdmin
ExitMediationState


Meta Data Management

Write

This function write a new Tag and Data to the ModelID.

Input Parameters

Type Name Description
address ModelId ModelId for the model.
string Tag MetaData Tag
string Data Tag Value

Return Values

Type Name Description
bool Status True if the operation was successful

Example

var Tag = 'InstallEnglish'
var Data = 'Press the learn button for three seconds, until the green LED starts to blink slowly.'
MetaData.Write(Tag, Data, {from:ContractOwner,gas:470000});

Delete

This function deletes the last MetaData Tag/Data for the modelID. If an intermediate tag needs to be modified, the manufacturer must delete all entries including the tag which needs to be modified. The manufacturer would then write the update, and all newer tags which followed from the updated record.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
bool Status True if the operation was successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
MetaData.Delete(ModelId, {from:AdminA,gas:470000});

WriteAdmin

This function assigns an Admin to the device security record for the ModelID. There may be up to five administrators per ModelID record.

Input Parameters

Type Name Description
address ModelId ModelId for the model.
uint Index Admin Index
address NewAdmin Administrator's ID to be written into the index

Return Values

Type Name Description
bool Status True if the operation was successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
MetaData.WriteAdmin(ModelId, 1, AdminB, {from:AdminA,gas:470000});

ReadAdminList

This function returns the current list of Administrators.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
address AdminList List of administrators

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
MetaData.ReadAdminList(ModelId, {from:AdminA,gas:470000});

Mediation Management

WriteMediator

This function writes a mediator to the ModelID record. There may be up to 5 mediators per ModelID.

Input Parameters

Type Name Description
address ModelId ModelId for the model.
uint Index Mediator Index
address MediatorID MediatorID to be written to the MediatorList

Return Values

Type Name Description
bool Status True if the operation was successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
var Index = 0;
var MediatorId = "0x1bbe4a661fdcb10ccc698ff484549555513684dc"
MetaData.WriteMediator(ModelId, Index, MediatorId, {AdminId,gas:470000});

ReadMediatorList

This function returns the entire Mediator List.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
address[] MedaitorID Mediator List

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
MetaData.ReadMediatorList(ModelId, {AdminId,gas:470000})

ReadMediatorAdminList

This function returns the entire list of Administrators which each Mediator has voted for.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
address[] MedaitorID Mediator List

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
MetaData.ReadMediatorAdminList(ModelId, {AdminId,gas:470000})

ReadMediationState

This function returns the current mediation state for the ModelID.

The mediation states are as follows:

State Value
MediationStateNormal 0
MediationStateInMediation 1
MediationStateReadyForNewAdmin 2

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
utin MediationState Mediation State

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
MetaData.ReadMediationState(ModelId, {AdminId,gas:470000})

WriteMediatorAdmin

A mediator shall use this function to write a new administrator.

Input Parameters

Type Name Description
address ModelId ModelId for the model.
uint Index Mediator's index
address AdminID New administrator's ID

Return Values

Type Name Description
bool Status True when successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
var Index = 1
var NewAdmin = "0xbd4d579e0819c4ab3d1b6d59b8429218fc92111"
MetaData.WriteMediatorAdmin(ModelId, Index, NewAdmin, {AdminId,gas:470000})

ExitMediationState

Once a new admin has been added, based on the agreement of the mediators, the new admin will take ownership of the record and exit mediation.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
bool Status True when successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507"
MetaData.ExitMediationState(ModelId, {AdminId,gas:470000})

Clone this wiki locally