AICU

AICU


Manage the AICU functionality of the support Aopen Device

To Enable the AICU API on a supported device, enter the device option aicu and set the value to true

Note this API is only availble for DE3450 devices on windows/linux

Methods

(async) getAlarms() → {Promise.<module:AICU~Alarms>}

Retrieve the current alarms.

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const padTime = time => '00'.slice(String(time).length) + String(time);

const getAlarms = async() => {
     await agent.onReadyAsync();

     const alarms = await agent.getAlarms();

     for (const [day, value] of Object.entries(alarms)) {
         const {on, off} = value;
         console.log(day);
         console.log(`Device turns on at ${padTime(on.hour)}:${padTime(on.minute)}`);
         console.log(`Device turns off at ${padTime(off.hour)}:${padTime(off.minute)}`);
     }
};

getAlarms();

(async) getData() → {Promise.<Array.<String>>}

Get the AICU Customer Data

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const getData = async() => {
     await agent.onReadyAsync();
     const data = await agent.AICU.getData();

     console.log('AICU Data');
     for (const [index, row] of data.entries()) {
         console.log(index, row);
     }
};

getData();

(async) getEdid(port, emulatedopt) → {Promise}

Get the EDID from the specified display

Parameters:
Name Type Attributes Default Description
port Number

The HDMI port

emulated boolean <optional>
false

Whether or not to get the EDID that is stored in the emulator.

(async) getEmulator(port) → {Promise.<module:AICU~EmulatorState>}

Get the emulator state.

Parameters:
Name Type Description
port Number

The HDMI port to query the emulator state of.

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const PORT = 1;

const getEmulator = async() => {
     await agent.onReadyAsync();

     const emState = await agent.AICU.getEmulator(PORT);

     if (emState.ok && emState.emulating) {
         console.log('Emulator Enabled');
     } else {
         console.log('Failed to set Emulator state to enabled')
     }
};

getEmulator();

(async) getFirmwareVersion() → {Promise.<module:AICU~FirmwareVersion>}

Get the firmware version of the AICU and the version of the AICU.

Returns a promise that resolves to the Firmware version

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const getFirmwareVersion = async() => {
     await agent.onReadyAsync();

     const result = await agent.AICU.getFirmwareVersion();
     const {aicuFirmwareVersion, aicuVersion}

     console.log(`The firmware version is: ${aicuFirmwareVersion}`);
     console.log(`The AICU version is: ${aicuVersion}`);
};

getFirmwareVersion();

(async) getHDMIPortStatus(port) → {Promise.<module:AICU~HDMIStatus>}

Check the status of the cable connected to a HDMI port

Parameters:
Name Type Description
port Number

The HDMI port to check either 1 or 2

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const PORT = 1;

const getHDMIStatus = async() => {
     await agent.onReadyAsync();
     const status = await agent.AICU.getHDMIPortStatus(PORT);

     if (status.connected) {
         console.log('The HDMI cable is connected')
     } else {
         console.log(status.description);
     }
};

getHDMIStatus();

(async) getMCUDateTime() → {Promise.<String>}

Retrieve the current date and time as recorded by the Microcontroller Unit (MCU)

Returns a promise that resolves to the current date time
Format: YY/mm/dd/dow HH:MM:SS

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const getMCUDateTime = async() => {
     await agent.onReadyAsync();
     const dateTime = await agent.AICU.getMCUDateTime();

     // Prints: "The date & time is: 18/09/21/05 23:30:40"
     console.log(`The date & time is: ${dateTime}`);
};

getMCUDateTime();

(async) getRTCRAM() → {Promise}

Get the RTC RAM

(async) powerOff() → {Promise}

Power Off the device.

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const powerOff = async() => {
     await agent.onReadyAsync();
     await agent.AICU.powerOff();
};

powerOff();

(async) powerOffForce() → {Promise}

Power off the device forcefully.

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const powerOffForce = async() => {
     await agent.onReadyAsync();
     await agent.AICU.powerOffForce();
};

powerOffForce();

(async) powerOn() → {Promise}

Power On the device.

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const powerOn = async() => {
     await agent.onReadyAsync();
     await agent.AICU.powerOn();
};

powerOn();

(async) reboot() → {Promise}

Reboot the device.

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const reboot = async() => {
     await agent.onReadyAsync();
     await agent.AICU.reboot();
};

reboot();

(async) sendKey() → {Promise}

(async) setAlarms(alarms) → {Promise.<module:AICU~Result>}

Set the alarms for device on time and device off time. per day of week.

Parameters:
Name Type Description
alarms Alarms

The alarms to set

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const setAlarms = async() => {
     await agent.onReadyAsync();

     const alarms = await agent.getAlarms();

     // We are going to set the on and off time on Monday
     alarms.monday.on = {hour: 9, minute: 0};
     alarms.monday.off = {hour: 21, minute: 30};

     const result = await agent.setAlarms(alarms);

     if (result.ok) {
         console.log('The alarms have been set');
     } else {
         console.log(`An error occured: ${result.error}`);
     }
};

setAlarms();

(async) setChannel() → {Promise}

(async) setData(data) → {Promise}

Save data to the AICU customer data store (UP to 4KB of data)

Parameters:
Name Type Description
data string

The data to save.

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const DATA = 'Hello World';

const setData = async() => {
     await agent.onReadyAsync();
     await agent.AICU.setData(DATA);
};

setData();

(async) setDebug(level) → {Promise}

Enable debug logs

Parameters:
Name Type Description
level DebugLevel

The debug level

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const DEBUG_LEVEL = 1;

const enableLogging = async() => {
     await agent.onReadyAsync();
     agent.AICU.onDebug(msg => console.log(`Debug: ${msg}`));
     await agent.AICU.setDebug(DEBUG_LEVEL);
};

enableLogging();

(async) setEdid() → {Promise}

(async) setEEPROMChannel(channel) → {Promise}

Set the EEPROM channel.

Parameters:
Name Type Description
channel EEPROMChannel

The channel to set

(async) setEmulator(port, direction) → {Promise.<null>}

Set the emulator state.

Parameters:
Name Type Description
port Number

The HDMI port to apply this setting to.

direction boolean

When true to Emulator, when false to Display

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const PORT = 1;
const STATE = true; // Enabled

const setEmulator = async() => {
     await agent.onReadyAsync();
     await agent.AICU.setEmulator(PORT, STATE);

     const emState = await agent.AICU.getEmulator(PORT);

     if (emState.ok && emState.emulating) {
         console.log('Emulator Enabled');
     } else {
         console.log('Failed to set Emulator state to enabled')
     }
};

setEmulator();

(async) setMCUDateTime(dateTime) → {Promise.<module:AICU~Result>}

Set the current time on the MCU.

Parameters:
Name Type Description
dateTime number

The time to set in unix epoch time.

Example
import Agent from '@meldcx/agent';
const agent = new Agent();

const setDateTime = async(time) => {
     await agent.onReadyAsync();
     const result = await agent.AICU.setMCUDateTime(time);

     if (result.ok) {
         console.log('The time has been set');
     } else {
         console.log(`An error occured: ${result.error}`);
     }
};

setDatetime(Date.now());