RemoteTrayModel: PublicModelInterface<RemoteTrayModelImpl>

Model for managing remote tray configurations in the KOS Freestyle system.

A remote tray represents a physical or virtual tray that can be enabled/disabled remotely and is associated with a holder in the dispensing system. This model manages the tray's configuration, activation state, and trouble propagation from its associated holder.

Key Features

  • Remote enable/disable capability through configuration properties
  • Automatic trouble propagation from associated holder
  • Active state management based on configuration
  • Integration with the KOS dispensing system through holder references

Properties

  • id - Unique identifier for the remote tray
  • name - Display name of the tray
  • holderPath - Path reference to the associated holder model
  • configPath - Configuration path for tray settings
  • remoteTrayEnabled - Configuration property controlling tray activation
  • active - Computed property indicating if the tray is currently active
  • holder - Reference to the associated holder model
  • troubles - Propagated troubles from the associated holder

Methods

  • updateModel(options) - Updates the model with new configuration options
  • init() - Initializes the remote tray model
  • load() - Loads the remote tray configuration and data

Example

// Create a new remote tray instance
const remoteTray = RemoteTray.instance('tray-1')
.options({
name: 'Remote Tray 1',
holderPath: '/holders/holder-1',
configPath: '/config/trays/tray-1'
})
.build();

// Check if tray is active
if (remoteTray.active) {
console.log(`${remoteTray.name} is enabled`);
}

// Access associated holder
const holder = remoteTray.holder;
console.log(`Holder status: ${holder?.status}`);

Example

// Monitor trouble states
const TrayStatus = ({ tray }: { tray: RemoteTrayModel }) => {
const troubles = tray.troubles;
const isEnabled = tray.remoteTrayEnabled.value;

return (
<div>
<h3>{tray.name}</h3>
<p>Status: {isEnabled ? 'Enabled' : 'Disabled'}</p>
{troubles.length > 0 && (
<Alert severity="warning">
{troubles.length} issue(s) detected
</Alert>
)}
</div>
);
};

Example

// Programmatically enable/disable tray
async function toggleRemoteTray(tray: RemoteTrayModel) {
const currentState = tray.remoteTrayEnabled.value;
await tray.remoteTrayEnabled.setValue(!currentState);

console.log(`Tray ${tray.name} is now ${!currentState ? 'enabled' : 'disabled'}`);
}

Subcategory

Freestyle Models

See

  • HolderModel - The associated holder model
  • ActiveAware - Interface for active state management
  • TroubleAware - Interface for trouble tracking