Technical information
Programming - Asset Management
52
RMS Enterprise - NetLinx Programmer’s Guide
Asset Registration Functions (Cont.)
RmsAssetRegister
DuetDevice
Description: This method is used exclusively to perform asset registration for Duet based devices. This method should only
be used when registering a device that is using a Duet device module. The RMS Client will interrogate the Duet device module
to obtain the default device information, parameters, metadata properties, and control methods.
Arguments:
• DEV device - asset physical device instance
• DEV duetDevice - Duet virtual device instance
• RmsAsset asset - asset configuration to register
Returns: 1 if asset registration call was successful; 0 if asset registration call was unsuccessful
Syntax:
DEFINE_FUNCTION CHAR RmsAssetRegisterDuetDevice(DEV realDevice, DEV duetDevice, RmsAsset asset)
{
STACK_VAR CHAR rmsCommand[RMS_MAX_CMD_LEN];
// ensure RMS is ONLINE, REGISTERED, and ready for ASSET registration
IF(![vdvRMS,RMS_CHANNEL_ASSETS_REGISTER])
{
SEND_STRING 0, '>>>> RMS API ERROR <RmsAssetRegisterDuetDevice> :: RMS is not ready to accept asset
management registrations.';
RETURN FALSE;
}
// the asset client key is the DPS string
// for NetLinx-based devices
IF(asset.clientKey == '')
{
asset.clientKey = RmsDevToString(realDevice);
}
// create asset registration send command
rmsCommand = RmsPackCmdHeader('ASSET.REGISTER.DUET.DEV');
rmsCommand = RmsPackCmdParam(rmsCommand,RmsDevToString(realDevice));
rmsCommand = RmsPackCmdParam(rmsCommand,RmsDevToString(duetDevice));
rmsCommand = RmsPackCmdParam(rmsCommand,asset.name);
rmsCommand = RmsPackCmdParam(rmsCommand,asset.clientKey);
rmsCommand = RmsPackCmdParam(rmsCommand,asset.assetType);
rmsCommand = RmsPackCmdParam(rmsCommand,asset.globalKey);
// add device to registration queue
SEND_COMMAND vdvRMS, rmsCommand;
// now that the asset has been created in the
// asset registration queue, finalize and submit
// the asset
RETURN RmsAssetRegistrationSubmit(asset);
}