- Table of contents
- ENX controls (ENX V2.6.02)
ENX controls (ENX V2.6.02)¶
To control ENX we have few types of control :
- ENX environment with the following functions:
- LOAD / SAVE : Load and SAVE an ENX environment file configuration
- LIST: List the existing device or driver
- SHOW: Show description of a device
- LOG_LEVEL : to set the log level of enx
- ABOUT : gives information about our ENX version
- QUIT : to disconnect from ENX
- ENX user control.
- For the moment the only function available to control/handle the ID is the CONNECT function.
- Control of drivers and devices with the following functions:
- DRIVER_ADD / DRIVER_REMOVE : Load and unload a library
- CREATE / DELETE : Create and delete device
Load / Save functions¶
The LOAD and SAVE functions have one parameter:
- CONF_FILE: file name to load/save. The file can be in the base directory or in a directory given by the shell variable ENX_SCRIPT.
The ENX script file is a list of command line written in a text file. SAVE generate an ENX script and LOAD execute it. For exemple, to add a new driver and add device, the file should look like:
!driver_add NAME1 FILE # This is a comment !create NAME2 BASE_ADDR RANGE NAME1
XML request¶
A LOAD XML request look like:
<command> <name>LOAD</name> <param name=”conf_file”>FILENAME</param> </command>
A Save XML request look like:
<command> <name>SAVE</name> <param name=”conf_file”>FILENAME</param> </command>
ENX returns¶
When all is OK, you should have a return with the keyword ACK. And the returns should looks like:
<result type="ack"> </result>
If something is wrong you should have a message with the keyword error. To have more details about error, looks here.
List function¶
The LIST function has the following parameter:
- ITEM: param to choose which list you want. The possible value are DRIVER, DEVICE or SCRIPT.
XML request¶
A LIST XML request look like:
<command> <name>LIST</name> <param name=”item”>ITEM_TYPE</param> </command>
ITEM_TYPE can only be one the following keywords: DRIVER, DEVICE or SCRIPT.
ENX returns¶
When all is OK, you should have a return with the keyword LIST. And the returns should looks like:
<result type="list"> <item>ITEM_TYPE</item> <val>Name 1</val> <val>...</val> <val>Name N</val> </result>
If something is wrong you should have a message with the keyword error. To have more details about error, looks here.
Show function¶
The SHOW function has the following parameter:
- DEVICE: for the moment not used...
XML request¶
A SHOW XML request look like:
<command> <name>SHOW</name> <param name=”device”>DEVICE_NAME</param> </command>
ENX returns¶
When all is OK, you should have a return with the keyword SHOW. And the returns should looks like:
<result type="SHOW"> <device> <param name=”name”>NAME_OF_FIRST_DEVICE</param> <param name="Driver_Name">NAME_OF_THE_DRIVER_USED</param> <param name="Base_Address">0x00000000</param> <param name="Range_Address">0x0000FFFF</param> <param name="Multi_Instanciation">TRUE</param> </device> <device> <param name=”name”>NAME_OF_SECOND_DEVICE</param> <param name="Driver_Name">NAME_OF_THE_DRIVER_USED</param> <param name="Base_Address">0x00000000</param> <param name="Range_Address">0x0000FFFF</param> <param name="Multi_Instanciation">TRUE</param> </device> ... </result>
If something is wrong you should have a message with the keyword error. To have more details about error, looks here.
Log level function¶
The LOG_LEVEL function has only one parameter:
- LEVEL: log level you want in ENX. Possible value is OFF, FATAL, ERROR, WARN, INFO, DEBUG or ALL_LEVEL.
XML request¶
A LOG_LEVEL XML request look like:
<command> <name>LOG_LEVEL</name> <param name=”level”>LOG_LEVEL_VALUE</param> </command>
ENX returns¶
When all is OK, you should have a return with the keyword ACK. And the returns should looks like:
<result type="ack"> </result>
If something is wrong you should have a message with the keyword error. To have more details about error, looks here.
About function¶
The ABOUT function doesn't have parameter.
It's used to obtain information about ENX version number, last compilation date, ...
XML request¶
An ABOUT XML request look like:
<command> <name>ABOUT</name> </command>
ENX returns¶
When all is OK, you should have a return with the keyword ABOUT. And the returns should looks like:
<result type="about"> <version>VERSION_NUMBER</version> <compilation_date>DATE_OF_COMPILATION</compilation_date> <port>PORT_NUMBER</port> </result>
In console mode, the port number is given, even if it's doesn't have any sense!
If something is wrong you should have a message with the keyword error. To have more details about error, looks here.
User Control - ID¶
CONNECT is used to ask a new ID to ENX server. This function doesn't accept any parameters.
XML request¶
A XML request looks like:
<control> <name>CONNECT</name> </control>
ENX returns¶
When all is OK, you should have a return with the keyword NEW_ID. And the returns should looks like:
<result type="new_id"> <id>ID_NUMBER</id> </result>
For the moment, the ID_NUMBER is a number between 1 and 65535.
If something is wrong you should have a message with the keyword error. To have more details about error, looks here.
Driver add and remove¶
To manage drivers, we have the following functions:
- DRIVER_ADD: Load a new library
- DRIVER_REMOVE: Unload and unconfigure a driver library
The driver load function has two parameters:
- DRIVER: name of the driver
- LIB_FILE: name of the library file. This name can be absolute PATH, else the library will be search in directory defined by the LD_LIBRARY_PATH environment variable.
The driver unload function has one parameter:
- DRIVER
XML request¶
A DRIVER_ADD XML request looks like:
<command> <name>DRIVER_ADD</name> <param name=”driver”>DRIVER_NAME</param> <param name=”lib_file”>LIB_FILE</param> </command>
A DRIVER_REMOVE XML request looks like:
<command> <name>DRIVER_ADD</name> <param name=”driver”>DRIVER_NAME</param> </command>
ENX returns¶
When all is OK, you should have a return with the keyword ACK. And the returns should looks like:
<result type="ack"> </result>
If something is wrong you should have a message with the keyword error. To have more details about error, looks here.
Device create and delete¶
To create a new device you must have the following parameters:
- DEVICE: Name you want to give to the new device
- BASE_ADDRESS: First address of the device (default value is 0)
- RANGE_ADDRESS: Address range (default value is 0xFFFF)
- DRIVER: Name of the driver to use for the new device
To delete a device you must provide this parameter:
- DEVICE: Name of the device you want to remove or show
XML request¶
A CREATE XML request looks like:
<control> <name>CREATE</name> <param name=”device”>DEVICE_NAME</param> <param name=”base_address”>BASE_ADDRESS</param> <param name=”range_address”>RANGE_ADDRESS</param> <param name=”driver”>DRIVER_NAME</param> </control>
A DELETE XML request looks like:
<control> <name>DELETE</name> <param name=”device”>DEVICE_NAME</param> </control>
ENX returns¶
When all is OK, you should have a return with the keyword ACK. And the returns should looks like:
<result type="ack"> </result>
If something is wrong you should have a message with the keyword error. To have more details about error, looks here.