167 lines
5.7 KiB
PHP
167 lines
5.7 KiB
PHP
<?php
|
|
/**
|
|
* @package di
|
|
*/
|
|
|
|
/**
|
|
* @return object
|
|
*/
|
|
function di_version()
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* @return array A string list of available interfaces
|
|
*/
|
|
function di_can_list()
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @param string $iface The CAN interface to open. E.g "can0", "vcan0".
|
|
* @see di_can_list To select an available $iface
|
|
* @return resource|null A CAN resource or null when iface is unavailable
|
|
*/
|
|
function di_can_open($iface)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* Set the CAN nodeid (src_id) from string. (128-bit hex-encoded string)
|
|
* @param string $nodeid The CAN nodeid
|
|
*/
|
|
function di_can_set_nodeid($fd, $nodeid)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* Close the CAN resource
|
|
* @param resource $fd
|
|
*/
|
|
function di_can_close($fd)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* Receive a CAN message
|
|
* @param resource $fd
|
|
* @return object A CAN message object
|
|
*/
|
|
function di_can_recv($fd)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* Send a CAN message
|
|
*
|
|
* @example tests/can_raw_send.php
|
|
* @param resource $fd
|
|
* @param array $msg A CAN message object.
|
|
* <ul>
|
|
* <li>'rt' => (bool) CAN message send marked as Realtime
|
|
* <li>'msgtype' => (int) CAN message type. Use one of DI_CAN_MSGTYPE_* constants</li>
|
|
* <li>'ttype' => (int) CAN transfer type. Use one of DI_CAN_TRANSFERTYPE_* constants</li>
|
|
* <li>'dtype' => (int) CAN message datatype. Use one of DI_CAN_RAW_DTYPE_*, DI_CAN_NET_DTYPE_*
|
|
* or DI_RPC_TYPE_* constants</li>
|
|
* <li>'ptype' => (int) CAN message payload type. Use one of DI_CAN_PTYPE_* constants</li>
|
|
* <li>'dst_id' => (int) CAN destination node id. Use a 32-bit number or one of DI_CAN_NODEID_* constants</li>
|
|
* <li>'msg' => (string) [optional] CAN message payload data (binary). Must be the type specified by ptype key.
|
|
* </ul>
|
|
*/
|
|
function di_can_send($fd, $msg)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* Send a CAN message empty reply
|
|
*
|
|
* @param resource $fd
|
|
* @param array $req A CAN message request object used as a base for the empty reply.
|
|
* <ul>
|
|
* <li>'canid' => (int) Raw CAN ID. Used to get the transaction id</li>
|
|
* <li>'msgtype' => (int) CAN message type. Use one of DI_CAN_MSGTYPE_* constants</li>
|
|
* <li>'ttype' => (int) CAN transfer type. Use one of DI_CAN_TRANSFERTYPE_* constants</li>
|
|
* <li>'dtype' => (int) CAN message datatype. Use one of DI_CAN_RAW_DTYPE_*, DI_CAN_NET_DTYPE_*
|
|
* or DI_RPC_TYPE_* constants</li>
|
|
* <li>'ptype' => (int) CAN message payload type. Use one of DI_CAN_PTYPE_* constants</li>
|
|
* <li>'dst_id' => (int) CAN destination node id. Use a 32-bit number or one of DI_CAN_NODEID_* constants</li>
|
|
* <li>'src_id' => (int) CAN source node id. Use a 32-bit number or one of DI_CAN_NODEID_* constants</li>
|
|
* <li>'msg' => (string) [optional] CAN message payload data (binary). Must be the type specified by ptype key.
|
|
* </ul>
|
|
*/
|
|
function di_can_send_empty_reply($fd, $req)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* Send a CAN request message and return a reply or NULL on timeout
|
|
*
|
|
* @param resource $fd
|
|
* @param array $msg A CAN message object.
|
|
* <ul>
|
|
* <li>'msgtype' => (int) CAN message type. Use one of DI_CAN_MSGTYPE_* constants</li>
|
|
* <li>'ttype' => (int) CAN transfer type. Use one of DI_CAN_TRANSFERTYPE_* constants</li>
|
|
* <li>'dtype' => (int) CAN message datatype. Use one of DI_CAN_RAW_DTYPE_*, DI_CAN_NET_DTYPE_*
|
|
* or DI_RPC_TYPE_* constants</li>
|
|
* <li>'ptype' => (int) CAN message payload type. Use one of DI_CAN_PTYPE_* constants</li>
|
|
* <li>'dst_id' => (int) CAN destination node id. Use a 32-bit number or one of DI_CAN_NODEID_* constants</li>
|
|
* <li>'msg' => (string) [optional] CAN message payload data (binary). Must be the type specified by ptype key.
|
|
* </ul>
|
|
* @param long $timeout_ms Reply timeout in milliseconds
|
|
*/
|
|
function di_can_reqrep($fd, $msg, $timeout_ms)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* Send a CAN request message with reply retries and return a reply or NULL on timeout
|
|
*
|
|
* @param resource $fd
|
|
* @param array $msg A CAN message object.
|
|
* <ul>
|
|
* <li>'msgtype' => (int) CAN message type. Use one of DI_CAN_MSGTYPE_* constants</li>
|
|
* <li>'ttype' => (int) CAN transfer type. Use one of DI_CAN_TRANSFERTYPE_* constants</li>
|
|
* <li>'dtype' => (int) CAN message datatype. Use one of DI_CAN_RAW_DTYPE_*, DI_CAN_NET_DTYPE_*
|
|
* or DI_RPC_TYPE_* constants</li>
|
|
* <li>'ptype' => (int) CAN message payload type. Use one of DI_CAN_PTYPE_* constants</li>
|
|
* <li>'dst_id' => (int) CAN destination node id. Use a 32-bit number or one of DI_CAN_NODEID_* constants</li>
|
|
* <li>'msg' => (string) [optional] CAN message payload data (binary). Must be the type specified by ptype key.
|
|
* </ul>
|
|
* @param long $timeout_ms Reply timeout in milliseconds
|
|
* @param long $retries Amount of retries
|
|
*/
|
|
function di_can_reqrep_with_retry($fd, $msg, $timeout_ms, $retries)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* Queue a CAN message for periodic sending
|
|
* @param resource $fd
|
|
* @param array $msg A CAN message object
|
|
* @param integer $time Periodic time to send the message in milliseconds
|
|
* @return integer A token for di_can_send_dequeue
|
|
*/
|
|
function di_can_send_queue($fd, $msg, $time)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|
|
|
|
/**
|
|
* Dequeue a CAN message which is previously queued with di_can_send_queue
|
|
*/
|
|
function di_can_send_dequeue($fd, $token)
|
|
{
|
|
die("This function should not be called this way");
|
|
}
|