function send_dmx_input_level_info_message($id, &$in_states)
{
    global $dinames;
    $endpoint_name = '';
    $displaytext = '';
    $state = substr($in_states, $id * 2, 2) == '00' ? 'Off' : 'On';
    $level = hexdec(substr($in_states, $id * 2, 2)) . '/255';
    $displaytext = '';
    if (isset($dinames[$id + 1]) and $dinames[$id + 1] != '') {
        $endpoint_name = $dinames[$id + 1] . '.Level';
        $displaytext = sprintf("displaytext=Status and Dimmer Level of DMX Channel %s, %s\n", $id + 1, $dinames[$id + 1]);
    }
    $msg = sprintf("input.state\n{\nstate=%s\nlevel=%s\n%s}\n", $state, $level, $displaytext);
    xap_sendInfoMsg($msg, '', xap_make_endpoint_source(XAPSRC_DMX_IN1, $id, $endpoint_name), xap_make_endpoint_uid(XAPUID_DMX_IN1, $id));
}
function send_io_output_binary_info_message($id, &$out_states)
{
    global $onames;
    $endpoint_name = '';
    $displaytext = '';
    $state = substr($out_states, $id * 2, 2) == 'FF' ? 'On' : 'Off';
    if (isset($onames[$id + 1]) and $onames[$id + 1] != '') {
        $endpoint_name = $onames[$id + 1];
        $displaytext = sprintf("displaytext=Status of Lighting Fixture %s\n", $onames[$id + 1]);
    }
    $msg = sprintf("output.state\n{\nstate=%s\n%s}\n", $state, $displaytext);
    xap_sendInfoMsg($msg, '', xap_make_endpoint_source(XAPSRC_IO_OUT, $id, $endpoint_name), xap_make_endpoint_uid(XAPUID_IO_OUT, $id));
}