nds2-client - ClientAdministrator
0.16.8
|
Typedefs | |
typedef struct signal_conv1 | signal_conv_t1 |
Functions | |
DLL_EXPORT int | daq_recv_channel_groups (daq_t *daq, daq_channel_group_t *group, int num_groups, int *num_channel_groups_received) |
Receive a list of channel groups. More... | |
DLL_EXPORT int | daq_set_server (daq_t *daq, const char *host, int port) |
Set the server address. More... | |
DLL_EXPORT long | read_server_response (nds_socket_type fd) |
Get a response code (internal function). More... | |
DLL_EXPORT long | read_server_response_wait (nds_socket_type fd, int wt) |
Get a response integer (internal function). More... | |
DLL_EXPORT size_t | swap_data (size_t gran, size_t nBytes, char *data) |
Swap data bytes. More... | |
DLL_EXPORT enum chantype | cvt_group_chantype (int group_num) |
Convert group code to channel type. More... | |
DLL_EXPORT long | dca_strtol (const char *str) |
DLL_EXPORT int | _daq_wait_data (nds_socket_type fd, int wt) |
Wait for data to arrive. More... | |
DLL_EXPORT int | read_bytes (nds_socket_type fd, char *cptr, size_t numb) |
Read a `numb' bytes. More... | |
DLL_EXPORT int | read_float (nds_socket_type fd, float *data) |
Read a float data word. More... | |
DLL_EXPORT int | read_uint4 (nds_socket_type fd, uint4_type *data) |
Read a 4-byte integer data word. More... | |
DLL_EXPORT int | _daq_read_cstring (nds_socket_type fd, size_t maxlen, char *buf) |
read an nds string. More... | |
DLL_EXPORT int | _daq_read_string (nds_socket_type fd, size_t maxlen, char *buf) |
read an nds2 string. More... | |
DLL_EXPORT int | null_term (char *p, int len) |
Add a NULL after the last non-blank in a string. More... | |
DLL_EXPORT size_t | _daq_get_string (const char **p, const char *end, char *out, size_t lmax) |
Copy a blank or null terminated string to an output buffer. More... | |
DLL_EXPORT int | _daq_cvt_string (unsigned long in, char *out) |
Convert an integer to a string. More... | |
DLL_EXPORT int | _daq_cvt_ll_string (unsigned long long in, char *out) |
Convert an integer to a string. More... | |
DLL_EXPORT int | _daq_cycle_conn (daq_t *daq) |
The internal and obsolete interface group contains the aspects of the classic NDS interfadce that have been superceded and the items that are not used directly by the client API.
typedef struct signal_conv1 signal_conv_t1 |
Signal conversion structure. It's not clear how this is used in the NDS1 protocol.
DLL_EXPORT int _daq_cvt_ll_string | ( | unsigned long long | in, |
char * | out | ||
) |
Convert an integer to a string.
Convert the specified integerlong long to a string
in | Integer to be converted. |
out | Output string. |
DLL_EXPORT int _daq_cvt_string | ( | unsigned long | in, |
char * | out | ||
) |
Convert an integer to a string.
Convert the specified integer to a string
in | Integer to be converted. |
out | Output string. |
DLL_EXPORT int _daq_cycle_conn | ( | daq_t * | daq | ) |
Internal function to force a reconnection for nds1 connections.
daq | The connection to close and reconnect |
DLL_EXPORT size_t _daq_get_string | ( | const char ** | p, |
const char * | end, | ||
char * | out, | ||
size_t | lmax | ||
) |
Copy a blank or null terminated string to an output buffer.
Copy a data string to the specified memory location. Any leading blanks are skipped. The non-blank characters are then copied until a blank is found, the end of the input string is reached or the maximum byte count is reached. A NULL is appended on the output string if space is available. The number of bytes copied is returned and the input pointer is updated.
p | Input string pointer address. |
end | End of input string. |
out | Output string. |
lmax | Output buffer length. |
read data from string pointed to by *p. skip past any leading spaces. copy all data to out until a space or a null is found or out is full. return the number of characters copied and increment *p as appropriate.
DLL_EXPORT int _daq_read_cstring | ( | nds_socket_type | fd, |
size_t | maxlen, | ||
char * | buf | ||
) |
read an nds string.
Read an NDS null terminated string from the specified socket. The string is copied to the specified buffer and a null character is added at the end of the string if there is room in the buffer.
fd | Socket file descriptor |
maxlen | Length of output buffer. |
buf | String buffer. |
DLL_EXPORT int _daq_read_string | ( | nds_socket_type | fd, |
size_t | maxlen, | ||
char * | buf | ||
) |
read an nds2 string.
Read an NDS2 byte-counted string from the specified socket. The string is transferred as an integer byte-count followed by text. The string is copied to the specified buffer and a null character is added at the end of the string if there is room in the buffer.
fd | Socket file descriptor |
maxlen | Length of output buffer. |
buf | String buffer. |
DLL_EXPORT int _daq_wait_data | ( | nds_socket_type | fd, |
int | wt | ||
) |
Wait for data to arrive.
Wait for data to arrive on the specified socket up to the maximum specified time.
fd | File descriptor of the socket to be tested. |
wt | Maximumwait time in seconds. |
DLL_EXPORT enum chantype cvt_group_chantype | ( | int | group_num | ) |
Convert group code to channel type.
Convert an nds group number to an nds2 channel type code.
group_num | Group code to be converted. |
DLL_EXPORT int daq_recv_channel_groups | ( | daq_t * | daq, |
daq_channel_group_t * | group, | ||
int | num_groups, | ||
int * | num_channel_groups_received | ||
) |
Receive a list of channel groups.
Get a list of defined channel groups. daq_recv_channel_groups requests a list of channel groups from the server and the fills in the list with the channel group data.
daq | Pointer to client status structure. |
group | Pointer to an allocated list of group information. |
num_groups | Maximum number of groups to read (size of list). |
num_channel_groups_received | Number of groups defined. |
DLL_EXPORT int daq_set_server | ( | daq_t * | daq, |
const char * | host, | ||
int | port | ||
) |
Set the server address.
Look up the server address specified by the host string and port number. The resulting ip address is stored in daq->srvr_addr
.
daq | Pointer to the client status structure |
host | Server node name string pointer. |
port | Server port number |
DLL_EXPORT long dca_strtol | ( | const char * | str | ) |
Convert a null terminated hex string to a long integer.
str | Pointer to hexidecimal string. |
DLL_EXPORT int null_term | ( | char * | p, |
int | len | ||
) |
Add a NULL after the last non-blank in a string.
Replace the character after the last non-whitespace character in a string with a NULL. If the entire string is white-space the first character is set to NULL. Whitespace is defined by the isspace() function.
p | Pointer to the initial string. |
len | Length of the initial string. |
DLL_EXPORT int read_bytes | ( | nds_socket_type | fd, |
char * | cptr, | ||
size_t | numb | ||
) |
Read a `numb' bytes.
Read a specified number of bytes from a specified socket.
fd | File descriptor to be read from. |
cptr | buffer for read data. |
numb | Number of bytes to be read. |
DLL_EXPORT int read_float | ( | nds_socket_type | fd, |
float * | data | ||
) |
Read a float data word.
Read a float from the indicated socket and swap bytes from network byte ordering (big-endian) to host byte ordering.
fd | Socket file descriptor. |
data | pointer to the output float word. |
DLL_EXPORT long read_server_response | ( | nds_socket_type | fd | ) |
Get a response code (internal function).
Get a 4 hex digit integer data word response from the server.
fd | Opened socked file descriptor. |
DLL_EXPORT long read_server_response_wait | ( | nds_socket_type | fd, |
int | wt | ||
) |
Get a response integer (internal function).
Get a 4 hex digit integer data word response from the server.
fd | Opened socket file descriptor. |
wt | Maximum wait time in tenths of a second. Defaults to 10s if 0 is passed. |
DLL_EXPORT int read_uint4 | ( | nds_socket_type | fd, |
uint4_type * | data | ||
) |
Read a 4-byte integer data word.
Read an unsigned integer from the indicated socket and swap bytes from network byte ordering (big-endian) to host byte ordering.
fd | Socket file descriptor. |
data | pointer to the output float word. |
DLL_EXPORT size_t swap_data | ( | size_t | gran, |
size_t | nBytes, | ||
char * | data | ||
) |
Swap data bytes.
Swap bytes of data words according to the specified word size from network (big-endian) byte ordering to the local host byte ordering. If gran<2
no swapping is performed and the number of words returned is nBytes
. If the local host uses network byte-ordering no swapping is performed and the number of words returned is nBytes/gran
.
gran | Granularity (word size in bytes). |
nBytes | Number of data bytes to be swapped. |
data | Pointer to the first data byte. |