@@ -222,8 +199,47 @@ int nerd_data_stream(int data_fd, int numChannels, int *channel_list, int precis
}
channelprocessing++;
} while(channels_left > 0);
return numDuplicates;
}
int nerd_data_stream(int data_fd, int numChannels, int *channel_list, int precision, int convert, int lines, int showmem, unsigned short * currentcount)
{
//Variables that should persist across retries
static unsigned char buf[NERDJACK_PACKET_SIZE];
//static int charsleft = NERDJACK_PACKET_SIZE;
static int linesleft = 0;
int index = 0;
int alignment = 0;
signed short datapoint = 0;
unsigned short dataline[NERDJACK_CHANNELS];
long double voltline[NERDJACK_CHANNELS];
int i;
deststruct destination[NERDJACK_CHANNELS];
unsigned long memused = 0;
unsigned short packetsready = 0;
unsigned short adcused = 0;
unsigned short tempshort = 0;
int charsread = 0;
int numgroups = 0;
long double volts;
//Check to see if we're trying to resume
//Don't blow away linesleft in that case
if(lines != 0 && linesleft == 0) {
linesleft = lines;
}
int numDuplicates = nerd_init_channels(destination,numChannels, channel_list);
//Now destination structure array is set as well as numDuplicates.
int numChannelsSampled = numChannels - numDuplicates;
int numGroups = NERDJACK_NUM_SAMPLES / numChannelsSampled;
@@ -234,6 +250,14 @@ int nerd_data_stream(int data_fd, int numChannels, int *channel_list, int precis
//We want a complete packet, so take the chars so far and keep waiting
if(charsread != NERDJACK_PACKET_SIZE) {
//charsleft = NERDJACK_PACKET_SIZE - charsread;
//There was a problem getting data. Probably a closed
//connection. Stash the data we did get, save state, and hope
@@ -36,7 +36,7 @@ int nerd_generate_command(char * command, int * channel_list, int channel_count,
int nerd_send_command(const char * address, char * command);
/* Stream data out of the NerdJack */
int nerd_data_stream(int data_fd, int numChannels, int * channel_list, int precision, int convert, int lines, int showmem);
int nerd_data_stream(int data_fd, int numChannels, int * channel_list, int precision, int convert, int lines, int showmem, unsigned short * currentcount);
/* Detect the IP Address of the NerdJack and return in ipAddress */