copyright MBARI 2008
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <ctime>
#include <errno.h>
#include "Utils.h"
#include "qnx_port.h"
#include "BicamConsts.h"
Go to the source code of this file.
Classes | |
| class | XPortCommand |
| XPortCommand represents the 9-byte commands used to control the XPort GPIO pins. More... | |
| class | XPortResponse |
| XPortResponse represents the 5-byte response returned by the XPort after writing a command to the GPIO port. More... | |
| class | XPortConnection |
| Encapsulates configuration parameters associated with a Lantronix XPort terminal server. More... | |
| class | XPort |
| Encapsulates Lantronix XPort single port terminal server data and behavior. More... | |
Defines | |
| #define | SERVER_PORT 1500 |
| default server port for XPort simulator | |
| #define | MAX_MSG 100 |
| Max XPort message length. | |
| #define | GPIO_IP_PORT 0x77F0 |
| default TCP/IP port for GPIO control | |
| #define | SERIAL_IP_PORT 10001 |
| default TCP/IP port for Serial communication | |
| #define | XPCMD_GET_FUNCTIONS 0x10 |
| XPort GPIO command: get pin functions. | |
| #define | XPCMD_GET_DIRECTIONS 0x11 |
| XPort GPIO command: get pin directions (0:input, 1:output). | |
| #define | XPCMD_GET_ACTIVE_LEVELS 0x12 |
| XPort GPIO command: get pin active levels (1:active high, 0:active low ). | |
| #define | XPCMD_GET_CURRENT_STATES 0x13 |
| XPort GPIO command: get pin states (1: enabled 0:disabled). | |
| #define | XPCMD_SET_DIRECTIONS 0x19 |
| XPort GPIO command: set pin directions (0:input, 1:output). | |
| #define | XPCMD_SET_ACTIVE_LEVELS 0x1A |
| XPort GPIO command: set active levels (1:active high, 0:active low. | |
| #define | XPCMD_SET_CURRENT_STATES 0x1B |
| XPort GPIO command: set pin states (1: enabled 0:disabled). | |
| #define | XPMASK_GPIO_SEL_ALL 0x07 |
| mask: Select all GPIO (for eval board; pins 0-2) | |
| #define | XPMASK_GPIO_SEL_NONE 0x00 |
| mask: select none the GPIO pins | |
| #define | XPMASK_GPIO_SET_ALL 0x07 |
| mask: set all GPIO | |
| #define | XPMASK_GPIO_CLR_ALL 0x00 |
| mask: clear all GPIO | |
| #define | XP_GPIO_0 0x1 |
| mask: GPIO pin 0 | |
| #define | XP_GPIO_1 0x2 |
| mask: GPIO pin 1 | |
| #define | XP_GPIO_2 0x4 |
| mask: GPIO pin 2 | |
| #define | XP_GPIO_ALL 0x7 |
| mask: GPIO all pins (eval board) | |
| #define | XP_GPIO_NONE 0x0 |
| mask: GPIO no pins | |
| #define | XP_GPIO_IN 0x0 |
| mask: GPIO pins all inputs | |
| #define | XP_GPIO_OUT 0x7 |
| mask: GPIO pins all outputs (eval board) | |
| #define | XP_GPIO_LO 0x0 |
| mask: GPIO pins all active low | |
| #define | XP_GPIO_HI 0x7 |
| mask: GPIO pins all active high (eval board) | |
| #define | ERR_NULL -1 |
| error: value is null | |
| #define | ERR_BADCMD -2 |
| error: invalid command | |
| #define | ERR_BADPAR1 -3 |
| error: invalid param1 | |
| #define | ERR_BADPAR2 -4 |
| error: invalid param2 | |
| #define | TEST_FAILED -5 |
| return: test failed | |
| #define | TEST_OK 0 |
| return: test passed | |
| #define | IS_VALID 0 |
| return: is valid | |
| #define | XPCMD_SEND_MESSAGE 0x7F |
| Fake XPort command for sending serial data instead of GPIO. | |
| #define | XPORT_COMMAND_LEN 9 |
length of XPort commands:
| |
| #define | XPORT_RESPONSE_LEN 5 |
length (bytes) of XPort command response:
| |
| #define | MAX_XPORT_COMMANDS 32 |
| Max number of commands accepted on command line. | |
| #define | XP_CMD_LEN (sizeof(unsigned char)) |
| XPort GPIO command length. | |
| #define | XP_PARAM_LEN (sizeof(unsigned int)) |
| XPort GPIO parameter length. | |
Typedefs | |
| typedef short unsigned int | t_TCP_PORT |
| TCP/IP port data type. | |
Enumerations | |
| enum | ConnectionID { XPCON_SERIAL = 0, XPCON_GPIO, XPCON_ALL } |
| Mnemonic IDs for TCP/IP socket connections. | |
| #define XPCMD_SEND_MESSAGE 0x7F |
Fake XPort command for sending serial data instead of GPIO.
We use same XPortCommand struct to send serial data; param1 is an index into the messages[] array containing the message to send. param2 is unused.
1.5.4