<<<<<<<<<<<<<<<<<

signal_file_reader(signal_data)Signal_Datasignal_file_reader(signal_data)

NAME

signal_file_reader - reads binary data from a file into signal_data objects.

DESCRIPTION

This is a simple signal_reader designed to demonstrate the methods necessary for a class writer to create a signal_reader object. Signal_file_reader expects binary data arranged in packets (or time-steps). Each packet has a datum for each channel (1 - packet_size). The file may or may not have a header, which can be skipped over by setting the "data_start" instance variable. Data may be "int" (4 byte signed), "short" (2 byte signed), "float" (4 byte), or "char" (1 byte signed).

SUPERCLASS

signal_reader

INSTANCE VARIABLES

data_start Size of the file header, in bytes. This is skipped over to get to the data. It defaults to 0 (no header).

data_type Specifies binary data type. Use "int_data!", "short_data!", "char_data!", and "float_data!" to set. 0 = float, 1 = short, 2 = int, 3 = char.

packet_size Number of data words (channels) in each time-step. Defaults to 1.

sample_rate Number of packets (time-steps) per second (Hz). Defaults to 1.

MESSAGES

available_channels? Returns an ordered list of scalars (1 - packet_size). These are the channels available from the reader.

char_data! Set data_type to CHAR (1 byte signed).

data_start= offset Sets the file offset (in bytes) of the start of the data. Typically the size of the header.

data_start? Get the file position of the start of the data (in bytes).

data_type= value Set the data_type to value. 0 = float, 1 = short, 2 = int, 3 = char. User should use "float_data!", "short_data!", "int_data!", and "char_data!" to set this variable.

data_type? Get the value of the data_type.

float_data! Set data_type to floating point - 4 byte.

generate_data: start_packet, end_packet, start_index This method should NOT be called directly from the shell or another object. It is an internal method called during a "request_data:" from a connection. generate_data: reads packets of data from the file starting at the file position corresponding to "start_packet". For each channel in the requesting connection's SIGNALTYPE channel list, it converts the correcsponding data word to floating point (signal_data objects handle only floats), and writes it into the connection's data array starting at "start_index". It does this for start_packet to end_packet, inclusive. It does not set the labels or objects fields in the SIGNALTYPE structure.

int_data! Set data_type to integer - 4 byte, signed.

open! Opens the file specified by filename. Will automatically be done if the file is not open and data is requested.

packet_size= size Set the packet_size (number of channels, or data words, in each time-step) to size.

packet_size? Get the packet size.

short_data! Set the data type to short integer - 2 byte, signed.

EXAMPLE

SEE ALSO

signal_data signal_reader signal_filter


Please send comments and suggestions to
consult@rpi.edu