Brief description of class still missing. More...
#include <GpsBuffer.h>
Public Member Functions | |
| void | broadcast (const char *bytes, int bytesCount) |
| GpsBuffer (int fileDescriptor, UbxDevice *device, GpsServer *server) | |
| ~GpsBuffer () | |
Protected Member Functions | |
| virtual int | bytesAvailable (char *buffer, int bytesCount) |
Brief description of class still missing.
Full description of class still missing
| GpsBuffer::GpsBuffer | ( | int | fileDescriptor, |
| UbxDevice * | device, | ||
| GpsServer * | server | ||
| ) |
Description of constructor still missing
References TRACE.
: DynamicBuffer(fileDescriptor) { TRACE; _device=device; _server=server; _broadcast=false; }
| void GpsBuffer::broadcast | ( | const char * | bytes, |
| int | bytesCount | ||
| ) |
References GpCoreTools::DynamicBuffer::send(), and TRACE.
| int GpsBuffer::bytesAvailable | ( | char * | buffer, |
| int | bytesCount | ||
| ) | [protected, virtual] |
Communication protocol:
'start' Requests acquisition to start 'stop' Requests acquisition to stop 'broadcast=on/off' Starts/stops broadcast 'state' Returns current status 'raw' Requests sending current raw file 'navigation' Requests download of navigation from GPS
Implements GpCoreTools::DynamicBuffer.
References UbxDevice::requestNavigation(), UbxDevice::sendRaw(), UbxDevice::sendState(), UbxDevice::startBroadcast(), UbxDevice::startRecording(), UbxDevice::stopRecording(), and TRACE.
{
TRACE;
int bytesRead=0;
while(bytesRead<bytesCount) {
// Scan for a line
int newBytesRead;
for(newBytesRead=bytesRead; newBytesRead<bytesCount && buffer[newBytesRead]!='\n'; newBytesRead++) {}
if(newBytesRead==bytesCount) {
return bytesRead; // partial line
}
switch(buffer[bytesRead]) {
case 'b':
if(File::match(buffer, bytesRead, bytesCount, "broadcast=on")) {
_broadcast=true;
_device->startBroadcast();
} if(File::match(buffer, bytesRead, bytesCount, "broadcast=off")) {
_broadcast=false;
}
break;
case 'n':
if(File::match(buffer, bytesRead, bytesCount, "navigation")) {
_device->requestNavigation();
}
break;
case 'r':
if(File::match(buffer, bytesRead, bytesCount, "raw")) {
_device->sendRaw(this);
}
break;
case 's':
if(File::match(buffer, bytesRead, bytesCount, "state")) {
_device->sendState(this);
} else if(File::match(buffer, bytesRead, bytesCount, "stop")) {
_device->stopRecording();
} else if(File::match(buffer, bytesRead, bytesCount, "start")) {
_device->startRecording();
}
break;
default:
break;
}
bytesRead=newBytesRead+1;
// Skip blanks and additionnal end of line characters
while(bytesRead<bytesCount && isspace(buffer[bytesRead])) {bytesRead++;}
}
return bytesRead;
}