Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • danc/MicroCART
  • snawerdt/MicroCART_17-18
  • bbartels/MicroCART_17-18
  • jonahu/MicroCART
4 results
Show changes
Commits on Source (10)
Showing
with 241 additions and 7309 deletions
...@@ -38,4 +38,5 @@ src/vrpn/build* ...@@ -38,4 +38,5 @@ src/vrpn/build*
src/vrpn/pc_linux64/* src/vrpn/pc_linux64/*
#Exacutables #Exacutables
./BlueTooth BlueTooth
logs
File deleted
...@@ -23,7 +23,9 @@ OBJECTS = $(CPPOBJECTS) $(COBJECTS) ...@@ -23,7 +23,9 @@ OBJECTS = $(CPPOBJECTS) $(COBJECTS)
LIBS= -lpthread -lbluetooth -lvrpn -lquat -Lsrc/vrpn/build -Lsrc/vrpn/build/quat LIBS= -lpthread -lbluetooth -lvrpn -lquat -Lsrc/vrpn/build -Lsrc/vrpn/build/quat
# Default target # Default target
all: logs vrpn/build $(EXE) all: logs $(EXE)
vrpn: vrpn/build
# Main target # Main target
$(EXE): $(OBJECTS) $(EXE): $(OBJECTS)
......
This is a readme, please update accordingly.
\ No newline at end of file
...@@ -67,7 +67,6 @@ int formatCommand(unsigned char *command, unsigned char **formattedCommand) { ...@@ -67,7 +67,6 @@ int formatCommand(unsigned char *command, unsigned char **formattedCommand) {
{ {
if(strcmp(tokens.tokens[0], registeredCommands[cmdIndex].commandText) == 0) if(strcmp(tokens.tokens[0], registeredCommands[cmdIndex].commandText) == 0)
{ {
switch (registeredCommands[cmdIndex].dataType) switch (registeredCommands[cmdIndex].dataType)
{ {
// Validate the float input // Validate the float input
...@@ -253,3 +252,17 @@ int processCommand(unsigned char *packet, unsigned int cmdIndex) { ...@@ -253,3 +252,17 @@ int processCommand(unsigned char *packet, unsigned int cmdIndex) {
// Only gets here if there is an error // Only gets here if there is an error
return -1; return -1;
} }
float getFloat(unsigned char* str, int pos) {
union {
float f;
int i;
} x;
x.i = ((str[pos+3] << 24) | (str[pos+2] << 16) | (str[pos+1] << 8) | (str[pos]));
return x.f;
}
int getInt(unsigned char* str, int pos) {
int i = ((str[pos+3] << 24) | (str[pos+2] << 16) | (str[pos+1] << 8) | (str[pos]));
return i;
}
...@@ -4,21 +4,30 @@ ...@@ -4,21 +4,30 @@
*/ */
#include "logger.h" #include "logger.h"
#include <stdio.h> #include <stdio.h>
#include <err.h>
#include <pthread.h>
int quadlog_file; static FILE * quadlog_file = NULL;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
int createLogFile(int argc, char* argv) int createLogFile(int argc, char* argv)
{ {
char log_file[300] = {'l', 'o', 'g','s', '/'}; if (quadlog_file != NULL) {
return -1;
}
if (pthread_mutex_lock(&mutex)) {
err(-2, "pthrtead_mutex_lock (%s:%d):", __FILE__, __LINE__);
}
char log_file[300];
strcpy(log_file, "logs/");
if(argc >= 2) if(argc >= 2)
{ {
strcat(log_file, argv); strncat(log_file, argv, 294);
printf("Creating log file '%s'...\n",log_file); printf("Creating log file '%s'...\n",log_file);
quadlog_file = open(log_file, O_WRONLY | O_CREAT, 0666); quadlog_file = fopen(log_file, "a");
return quadlog_file; } else {
}
else
{
time_t rawtime; time_t rawtime;
char timestr [30]; char timestr [30];
time(&rawtime); time(&rawtime);
...@@ -26,7 +35,7 @@ int createLogFile(int argc, char* argv) ...@@ -26,7 +35,7 @@ int createLogFile(int argc, char* argv)
// Lets convert space to _ in // Lets convert space to _ in
char *p = timestr; char *p = timestr;
int i = 0; size_t i = 0;
while(i < strlen(timestr)) while(i < strlen(timestr))
{ {
if (*p == ' ') if (*p == ' ')
...@@ -40,18 +49,60 @@ int createLogFile(int argc, char* argv) ...@@ -40,18 +49,60 @@ int createLogFile(int argc, char* argv)
strncat(log_file, timestr, strlen(timestr) -1 ); strncat(log_file, timestr, strlen(timestr) -1 );
strcat(log_file, ".txt"); strcat(log_file, ".txt");
printf("Creating log file '%s'...\n",log_file); printf("Creating log file '%s'...\n",log_file);
quadlog_file = open(log_file, O_WRONLY | O_CREAT, 0666); quadlog_file = fopen(log_file, "a");
return quadlog_file; }
if (pthread_mutex_unlock(&mutex)) {
err(-2, "pthrtead_mutex_unlock (%s:%d):", __FILE__, __LINE__);
} }
return 0;
} }
int updateLogFile(const struct ucart_vrpn_TrackerData * td) int updateLogFile(const struct ucart_vrpn_TrackerData * td)
{ {
return dprintf(quadlog_file, "FPS: %lf Pos (xyz): (%lf %lf %lf) Att (pry): (%lf %lf %lf)\n", int retval;
if (pthread_mutex_lock(&mutex)) {
err(-2, "pthrtead_mutex_lock (%s:%d):", __FILE__, __LINE__);
}
retval = fprintf(quadlog_file,
"FPS: %lf Pos (xyz): (%lf %lf %lf) Att (pry): (%lf %lf %lf)\n",
td->fps, td->x, td->y, td->z, td->pitch, td->roll, td->yaw); td->fps, td->x, td->y, td->z, td->pitch, td->roll, td->yaw);
if (pthread_mutex_unlock(&mutex)) {
err(-2, "pthrtead_mutex_unlock (%s:%d):", __FILE__, __LINE__);
}
return retval;
} }
int writeStringToLog(const char * string) int writeStringToLog(const char * string)
{ {
return dprintf(quadlog_file, "%s", string); int retval;
if (pthread_mutex_lock(&mutex)) {
err(-2, "pthrtead_mutex_lock (%s:%d):", __FILE__, __LINE__);
}
retval = fprintf(quadlog_file, "%s", string);
if (pthread_mutex_unlock(&mutex)) {
err(-2, "pthrtead_mutex_unlock (%s:%d):", __FILE__, __LINE__);
}
return retval;
}
void closeLogFile(void)
{
if (pthread_mutex_lock(&mutex)) {
err(-2, "pthrtead_mutex_lock (%s:%d):", __FILE__, __LINE__);
}
fclose(quadlog_file);
if (pthread_mutex_unlock(&mutex)) {
err(-2, "pthrtead_mutex_unlock (%s:%d):", __FILE__, __LINE__);
}
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
int createLogFile(int, char*); int createLogFile(int, char*);
int writeStringToLog(const char*); int writeStringToLog(const char*);
int updateLogFile(const struct ucart_vrpn_TrackerData* ); int updateLogFile(const struct ucart_vrpn_TrackerData* );
void closeLogFile();
#endif #endif
\ No newline at end of file
...@@ -3,14 +3,17 @@ ...@@ -3,14 +3,17 @@
* BlueTooth socket program for passing vrpn data to quad. * BlueTooth socket program for passing vrpn data to quad.
*/ */
//system includes //system includes
#include <err.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <signal.h> #include <signal.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/select.h>
#include <bluetooth/bluetooth.h> #include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h> #include <bluetooth/rfcomm.h>
#include <pthread.h> #include <pthread.h>
#include <assert.h>
//user created includes //user created includes
#include "communication.h" #include "communication.h"
...@@ -31,19 +34,24 @@ void sendStartPacket(void); ...@@ -31,19 +34,24 @@ void sendStartPacket(void);
void getVRPNPacket(struct ucart_vrpn_TrackerData *); void getVRPNPacket(struct ucart_vrpn_TrackerData *);
void printVrpnData(struct ucart_vrpn_TrackerData *); void printVrpnData(struct ucart_vrpn_TrackerData *);
int connectToZybo(); int connectToZybo();
void *handleQuadResponse(); // void *handleQuadResponse();
void *handleCliInput(); // void *handleCliInput();
int atomic_check(int*, pthread_mutex_t*); // int atomic_check(int*, pthread_mutex_t*);
void performCommand(char *cmdName, char * command); void performCommand(char *, char *);
int startsWith(const char *pre, const char *str); int startsWith(const char *, const char *);
int safe_fd_set(int , fd_set* , int* );
int safe_fd_clr(int , fd_set* , int* );
//static void cb(struct ucart_vrpn_TrackerData *); static void cb(struct ucart_vrpn_TrackerData *);
/* Thread-safe wrappers */
pthread_mutex_t quadSocketMutex;
static ssize_t writeQuad(const char * buf, size_t count);
// global variables // global variables
static volatile int keepRunning = 1; static volatile int keepRunning = 1;
const char *TRACKER_IP = "UAV@192.168.0.120:3883"; const char *TRACKER_IP = "UAV@192.168.0.120:3883";
int quadlog_file; static int zyboSocket;
int zyboSocket, status, bytes_read;
struct ucart_vrpn_tracker * tracker = NULL; struct ucart_vrpn_tracker * tracker = NULL;
const char *logHeader = "";//"#\n#\tDefault log header\n#\tEverything after '#'`s will be printed as is in the processed logs.\n#\n\0"; const char *logHeader = "";//"#\n#\tDefault log header\n#\tEverything after '#'`s will be printed as is in the processed logs.\n#\n\0";
...@@ -58,186 +66,137 @@ modular_structs_t structs = {}; ...@@ -58,186 +66,137 @@ modular_structs_t structs = {};
// Currently doing much more than it should. It will be slimmed down // Currently doing much more than it should. It will be slimmed down
// in the future. // in the future.
// static void cb(struct ucart_vrpn_TrackerData * td) static void cb(struct ucart_vrpn_TrackerData * td)
// { {
// static int count = 0; static int count = 0;
// if(!(count % 10)) {
// sendVrpnPacket(td);
// updateLogFile(td);
// }
// count++;
// // This will print the vrpn data to the terminal if necissary.
// // Commented out because the callback will cover quad log data
// // at the end of flight.
// /**if(!(count % 100)) {
// printVrpnData(td);
// printf("[Info] Received %d tracker updates.\n", count);
// }**/
// }
void *handleQuadResponse() {
unsigned char buffer[255];
while(keepRunning) {
// Clear the buffer and read the message from the socket (from the server)
memset(buffer, 0, 255);
// If there was an error reading from the socket, throw an error
if(read(zyboSocket, buffer, 255) <= 0) {
fprintf(stderr, "CLI QUAD: ERROR reading from quad.\n");
continue;
}
pthread_mutex_lock(&quadResponseMutex);
newQuadResponse = 1;
memcpy(respBuf, buffer, 255);
pthread_mutex_unlock(&quadResponseMutex);
//parse_packet(buffer, &respBuf, &metadata); if(!(count % 10)) {
// fprintf(stderr, "CLI QUAD: %s\n", buffer); sendVrpnPacket(td);
updateLogFile(td);
} }
pthread_exit(NULL); count++;
// This will print the vrpn data to the terminal if necissary.
// Commented out because the callback will cover quad log data
// at the end of flight.
/**if(!(count % 100)) {
printVrpnData(td);
printf("[Info] Received %d tracker updates.\n", count);
}**/
} }
void *handleCliInput() {
sleep(1);
while(keepRunning)
{
char userCommand[CMD_MAX_LENGTH] = {};
fprintf(stderr, "$microcart> ");
while(fgets(userCommand, sizeof(userCommand), stdin) != NULL && keepRunning) {
// if the user simply hit enter then let them try again
if((userCommand[0] == '\n') || (userCommand[0] == '\r'))
{
fprintf(stderr, "$microcart> ");
memset(userCommand, 0, CMD_MAX_LENGTH);
continue;
}
if((userCommand[strlen(userCommand) - 1] == '\n') || (userCommand[strlen(userCommand) - 1] == '\r'))
userCommand[strlen(userCommand) - 1] = '\0';
pthread_mutex_lock(&cliInputMutex);
newCliInput = 1;
memcpy(commandBuf, &userCommand, CMD_MAX_LENGTH);
pthread_mutex_unlock(&cliInputMutex);
fprintf(stderr, "$microcart> ");
memset(userCommand, 0, CMD_MAX_LENGTH);
}
}
pthread_exit(NULL);
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
pthread_t quadResponse, cliInput; // pthread_t quadResponse, cliInput;
respBuf = malloc(1024); fd_set rfds;
commandBuf = malloc(CMD_MAX_LENGTH); int activity;
int max_fd = 0;
signal(SIGINT, killHandler); signal(SIGINT, killHandler);
if ((zyboSocket = connectToZybo()) < 0) if (pthread_mutex_lock(&quadSocketMutex)) {
{ err(-2, "pthrtead_mutex_lock (%s:%d):", __FILE__, __LINE__);
perror("Error connecting to Zybo...");
free(respBuf);
free(commandBuf);
exit(1);
} }
// create vrpnTracker instance
// tracker = ucart_vrpn_tracker_createInstance(TRACKER_IP);
// Retrieve VRPN data from the control loop // if ((zyboSocket = connectToZybo()) < 0)
fprintf(stderr, "CLI: Starting quad receiving thread...\n"); // {
pthread_create(&quadResponse, NULL, handleQuadResponse, NULL); // perror("Error connecting to Zybo...");
fprintf(stderr, "CLI: Thread quad receiving started.\n"); // free(respBuf);
// free(commandBuf);
// exit(1);
// }
// Retrieve user command input if (pthread_mutex_unlock(&quadSocketMutex)) {
fprintf(stderr, "CLI: Starting cli input thread...\n"); err(-2, "pthrtead_mutex_unlock (%s:%d):", __FILE__, __LINE__);
pthread_create(&cliInput, NULL, handleCliInput, NULL); }
fprintf(stderr, "CLI: Thread Cli input started.\n");
// create vrpnTracker instance
//tracker = ucart_vrpn_tracker_createInstance(TRACKER_IP);
// open the log file // open the log file
if( (status = createLogFile(argc, argv[1])) < 0) if(createLogFile(argc, argv[1]))
{ {
perror("Error creating log file..."); perror("Error creating log file...");
free(respBuf);
free(commandBuf);
exit(1); exit(1);
} }
writeStringToLog(logHeader); // writeStringToLog(logHeader);
// clear the fd set
FD_ZERO(&rfds);
// watch for input from stdin (fd 0) to see when it has input
safe_fd_set(fileno(stdin), &rfds, &max_fd);
// watch for input from the zybo socket
//safe_fd_set(zyboSocket, &rfds, &max_fd);
//printf("zyboSocket = %d, max_fd = %d\n", zyboSocket, max_fd);
//tell the quad we are ready to send it vrpn data //tell the quad we are ready to send it vrpn data
printf("sending Start Packet...\n"); printf("sending Start Packet...\n");
sendStartPacket(); //sendStartPacket();
// this function will be called whenever tracker receives data // this function will be called whenever tracker receives data
// ucart_vrpn_tracker_addCallback(tracker, cb); // ucart_vrpn_tracker_addCallback(tracker, cb);
int updatePrompt = 0;
// start the prompt
fprintf(stdout, "$microcart> ");
while(keepRunning) while(keepRunning)
{ {
char tmpRespBuf[1024]; activity = select(max_fd+1, &rfds, NULL, NULL, NULL);
unsigned char tmpCommandBuf[CMD_MAX_LENGTH]; if(activity == -1) {
perror("select() ");
} else if (activity) {
if(updatePrompt) for(unsigned int fd = 0; fd <= max_fd; ++fd) {
{ if (FD_ISSET(fd, &rfds)) {
fprintf(stderr, "$microcart> "); if (fd == fileno(stdin)) {
updatePrompt = 0; unsigned char userCommand[CMD_MAX_LENGTH] = {};
} read(fileno(stdin), (char *)userCommand, sizeof(userCommand));
unsigned int cmdLen = strlen((char*) userCommand);
//check for user input via cli // if the user simply hit enter then let them try again
if(atomic_check(&newCliInput, &cliInputMutex)) if((userCommand[0] != '\n') && (userCommand[0] != '\r'))
{ {
pthread_mutex_lock(&cliInputMutex); // remove newline and return line chars
newCliInput = !newCliInput; if((userCommand[cmdLen - 1] == '\n') || (userCommand[cmdLen - 1] == '\r'))
memcpy(tmpCommandBuf, commandBuf, CMD_MAX_LENGTH); userCommand[cmdLen - 1] = '\0';
pthread_mutex_unlock(&cliInputMutex);
unsigned char *packet;
// I can use printf becuase the command was gathered using fgets. formatCommand(userCommand, &packet);
//fprintf(stderr, "\rINPUT FOUND via CLI: '%s'\n", tmpCommandBuf);
updatePrompt = !updatePrompt; printf("received input from cli: '%s'\n", userCommand);
unsigned char *packet;
formatCommand(tmpCommandBuf, &packet); fprintf(stdout, "CLI sees as: %f\n", getFloat(packet, 7));
}
// Write the command to the control_loop socket
//check for update/response from quad // int n = writeQuad(packet, ((packet[6] << 8) | packet[5]) + 8);
if(atomic_check(&newQuadResponse, &quadResponseMutex)) // if(n < 0) {
{ // fprintf(stdout, "CLI: ERROR writing to socket\n");
pthread_mutex_lock(&quadResponseMutex); // }
newQuadResponse = !newQuadResponse; }
memcpy(tmpRespBuf, respBuf, 1024);
pthread_mutex_unlock(&quadResponseMutex);
fprintf(stdout, "$microcart> ");
char buf[1025]; memset(userCommand, 0, cmdLen);
memcpy(buf, tmpRespBuf, 1024); } else if (fd == zyboSocket) {
buf[1025] = '\0';
//fprintf(stderr, "\rINPUT FOUND via QUAD: '%s'\n", buf); }
writeStringToLog(buf); }
updatePrompt = !updatePrompt; }
} }
} }
//ucart_vrpn_tracker_freeInstance(tracker); // ucart_vrpn_tracker_freeInstance(tracker);
//free(vrpnData);
free(respBuf); if (pthread_mutex_lock(&quadSocketMutex)) {
free(commandBuf); err(-2, "pthrtead_mutex_lock (%s:%d):", __FILE__, __LINE__);
pthread_mutex_destroy(&cliInputMutex); }
pthread_mutex_destroy(&quadResponseMutex);
close(zyboSocket); close(zyboSocket);
close(quadlog_file); if (pthread_mutex_unlock(&quadSocketMutex)) {
err(-2, "pthrtead_mutex_unlock (%s:%d):", __FILE__, __LINE__);
}
closeLogFile();
return 0; return 0;
} }
...@@ -247,18 +206,6 @@ void killHandler(int dummy) { ...@@ -247,18 +206,6 @@ void killHandler(int dummy) {
printf("\nleaving Bluetooth module\n"); printf("\nleaving Bluetooth module\n");
} }
void readAndPrint() {
// read data from the server
// this is a blocking call.
//TODO: Implement a non blocking version of this.
bytes_read = read(zyboSocket, respBuf, sizeof(respBuf) -1);
if( bytes_read > 0)
{
respBuf[bytes_read] = '\0';
printf("%s", respBuf);
}
}
void sendStartPacket() { void sendStartPacket() {
unsigned char packet[8] = {0}; unsigned char packet[8] = {0};
...@@ -285,7 +232,7 @@ void sendStartPacket() { ...@@ -285,7 +232,7 @@ void sendStartPacket() {
checksum ^= packet[i]; checksum ^= packet[i];
packet[metadata.data_len + 7] = checksum; //PACKET_END_BYTE; packet[metadata.data_len + 7] = checksum; //PACKET_END_BYTE;
status = write(zyboSocket, &packet, metadata.data_len + 8); int status = writeQuad((char * ) packet, metadata.data_len + 8);
if (status != 8) if (status != 8)
{ {
perror("Error sending start packet...\n"); perror("Error sending start packet...\n");
...@@ -317,7 +264,7 @@ void sendVrpnPacket(struct ucart_vrpn_TrackerData *info) { ...@@ -317,7 +264,7 @@ void sendVrpnPacket(struct ucart_vrpn_TrackerData *info) {
packet[pSize - 1] = checksum; //PACKET_END_BYTE; packet[pSize - 1] = checksum; //PACKET_END_BYTE;
n = write(zyboSocket, packet, pSize); n = writeQuad(packet, pSize);
if(n < 0) { if(n < 0) {
perror("vrpnhandler: ERROR writing to socket"); perror("vrpnhandler: ERROR writing to socket");
keepRunning = 0; keepRunning = 0;
...@@ -352,7 +299,7 @@ int connectToZybo() { ...@@ -352,7 +299,7 @@ int connectToZybo() {
printf("Attempting to connect to zybo. Please be patient...\n"); printf("Attempting to connect to zybo. Please be patient...\n");
// blocking call to connect to socket sock ie. zybo board // blocking call to connect to socket sock ie. zybo board
status = connect(sock, (struct sockaddr *)&addr, sizeof(addr)); int status = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
// connection failed // connection failed
if(status < 0) if(status < 0)
...@@ -368,18 +315,11 @@ int connectToZybo() { ...@@ -368,18 +315,11 @@ int connectToZybo() {
} }
} }
int atomic_check(int* atomicFlag, pthread_mutex_t* mutex) {
pthread_mutex_lock(mutex);
int result = *atomicFlag;
pthread_mutex_unlock(mutex);
return result;
}
void performCommand(char *cmdName, char * command) { void performCommand(char *cmdName, char * command) {
for(int i = 0; i < NUM_COMMANDS; ++i) for(int i = 0; i < NUM_COMMANDS; ++i)
{ {
if(startsWith(registeredCommands[i].commandText, command)); if(startsWith(registeredCommands[i].commandText, command));
fprintf(stderr, "\r\n You used cmd '%s'\n",registeredCommands[i].commandText); fprintf(stdout, "\r\n You used cmd '%s'\n",registeredCommands[i].commandText);
} }
} }
...@@ -387,4 +327,39 @@ int startsWith(const char *pre, const char *str) { ...@@ -387,4 +327,39 @@ int startsWith(const char *pre, const char *str) {
size_t lenpre = strlen(pre), size_t lenpre = strlen(pre),
lenstr = strlen(str); lenstr = strlen(str);
return lenstr < lenpre ? 0 : (strncmp(pre, str, lenpre) == 0); return lenstr < lenpre ? 0 : (strncmp(pre, str, lenpre) == 0);
} }
\ No newline at end of file
/* add a fd to fd_set, and update max_fd */
int safe_fd_set(int fd, fd_set* fds, int* max_fd) {
assert(max_fd != NULL);
FD_SET(fd, fds);
if (fd > *max_fd) {
*max_fd = fd;
}
return 0;
}
/* clear fd from fds, update max fd if needed */
int safe_fd_clr(int fd, fd_set* fds, int* max_fd) {
assert(max_fd != NULL);
FD_CLR(fd, fds);
if (fd == *max_fd) {
(*max_fd)--;
}
return 0;
}
static ssize_t writeQuad(const char * buf, size_t count) {
ssize_t retval;
if (pthread_mutex_lock(&quadSocketMutex)) {
err(-2, "pthrtead_mutex_lock (%s:%d):", __FILE__, __LINE__);
}
retval = writeQuad(buf, count);
if (pthread_mutex_unlock(&quadSocketMutex)) {
err(-2, "pthrtead_mutex_unlock (%s:%d):", __FILE__, __LINE__);
}
return retval;
}
---
Language: Cpp
BasedOnStyle: LLVM
Standard: Auto
IndentWidth: 4
TabWidth: 4
UseTab: Never
AccessModifierOffset: -4
AllowShortIfStatementsOnASingleLine: true
BreakBeforeBraces: Stroustrup
BreakConstructorInitializersBeforeComma: true
NamespaceIndentation: All
DerivePointerBinding: true
...
---
# Remove these blocked checks once the first batch are cleaned up
# - readability-braces-around-statements
Checks: '*,-clang-analyzer-alpha*,-llvm-include-order,-google-*,-llvm-header-guard,-readability-braces-around-statements,-misc-use-override'
HeaderFilterRegex: '.*'
...
[submodule "submodules/hidapi"]
path = submodules/hidapi
url = https://github.com/vrpn/hidapi.git
[submodule "submodules/jsoncpp"]
path = submodules/jsoncpp
url = https://github.com/vrpn/jsoncpp.git
compiler:
- clang
- gcc
before_install:
- git submodule update --init --recursive
- sudo apt-get update -qq
- sudo apt-get install -qq libgpm-dev freeglut3-dev libxmu-dev libxi-dev libusb-1.0-0-dev libqt4-dev
language: cpp
script: mkdir build && cd build && cmake -DVRPN_GPL_SERVER=TRUE -D VRPN_BUILD_EXTRA_COMPILER_WARNINGS=TRUE .. && make && make test
This diff is collapsed.
This diff is collapsed.
# Project configuration settings
set(VRPN_USE_PHANTOM_SERVER "@VRPN_USE_PHANTOM_SERVER@" CACHE BOOL "")
set(VRPN_INCLUDE_TIMECODE_SERVER "@VRPN_INCLUDE_TIMECODE_SERVER@" CACHE BOOL "")
set(VRPN_INCLUDE_INTERSENSE "@VRPN_INCLUDE_INTERSENSE@" CACHE BOOL "")
set(VRPN_USE_NATIONAL_INSTRUMENTS "@VRPN_USE_NATIONAL_INSTRUMENTS@" CACHE BOOL "")
set(VRPN_USE_NATIONAL_INSTRUMENTS_MX "@VRPN_USE_NATIONAL_INSTRUMENTS_MX@" CACHE BOOL "")
set(VRPN_USE_NIDAQ "@VRPN_USE_NIDAQ@" CACHE BOOL "")
set(VRPN_USE_USDIGITAL "@VRPN_USE_USDIGITAL@" CACHE BOOL "")
set(VRPN_USE_MICROSCRIBE "@VRPN_USE_MICROSCRIBE@" CACHE BOOL "")
set(VRPN_INCLUDE_PHASESPACE "@VRPN_INCLUDE_PHASESPACE@" CACHE BOOL "")
set(VRPN_USE_MOTIONNODE "@VRPN_USE_MOTIONNODE@" CACHE BOOL "")
set(VRPN_USE_WIIUSE "@VRPN_USE_WIIUSE@" CACHE BOOL "")
set(VRPN_USE_FREESPACE "@VRPN_USE_FREESPACE@" CACHE BOOL "")
set(VRPN_USE_DIRECTINPUT "@VRPN_USE_DIRECTINPUT@" CACHE BOOL "")
set(VRPN_USE_DIRECTSHOW "@VRPN_USE_DIRECTSHOW@" CACHE BOOL "")
set(VRPN_USE_SHARED_LIBRARY "@VRPN_USE_SHARED_LIBRARY@" CACHE BOOL "")
set(VRPN_USE_GPM_MOUSE "@VRPN_USE_GPM_MOUSE@" CACHE BOOL "")
set(VRPN_GPL_SERVER "@VRPN_GPL_SERVER@" CACHE BOOL "")
# Root directories to search for dependencies
set(WIIUSE22_ROOT_DIR "@WIIUSE_ROOT_DIR@" CACHE PATH "")
/*
*
* VRPN Header Format
*
* +------------+------------+------------+------------+
* | Total Length |
* +------------+------------+------------+------------+
* | Timestamp (Seconds) |
* +------------+------------+------------+------------+
* | Timestamp (Microseconds) |
* +------------+------------+------------+------------+
* | Sender |
* +------------+------------+------------+------------+
* | Type |
* +------------+------------+------------+------------+
* | padding |
* +------------+------------+------------+------------+
*
* Total Length = Padded Payload Length + Padded Header Length.
* Padded Header Length = 24 bytes.
* Padded Payload Length = Payload Length + (Payload Length % 8).
*
* All header fields are 32-bit integers sent in network order.
* Both header and payload are padded to end on 8-byte boundaries.
*
* Implementation in vrpn_Connection::marshall_message().
*
*/
/*
*
* VRPN Connection setup sequence
*
* Server opens a TCP socket and listens() on port - default vrpn_DEFAULT_LISTEN_PORT_NO
* Client connects() to port
* Server and client both write a COOKIE
* Server and client both wait (nonblocking) for a COOKIE and
* verify version #, etc.
* If either peer is requesting remote logging, a log_description message
* is sent.
* Server and client both open UDP sockets.
* Server and client both send udp_description messages.
* Server and client both send sender_description messages for all senders
* registered locally.
* Server and client both send type_description messages for all types
* registered locally.
*
* Implementation in vrpn_Connection::setup_new_connection(),
* finish_new_connection_setup(),
*/
/*
* VRPN Cookie Format
*
* +------------+------------+------------+------------+
* + 'v' | 'r' | 'p' | 'n' +
* +------------+------------+------------+------------+
* + ':' | ' ' | 'v' | 'e' +
* +------------+------------+------------+------------+
* + 'r' | '.' | ' ' | X +
* +------------+------------+------------+------------+
* + X | '.' | Y | Y +
* +------------+------------+------------+------------+
* + ' ' | ' ' | L | padding |
* +------------+------------+------------+------------+
* + padding |
* +------------+------------+------------+------------+
*
* XX = major version number (2 ASCII characters)
* YY = minor version number (2 ASCII characters)
* L = remote log mode requested (ASCII '0', '1', '2', or '3')
*
* This cookie is in ASCII so that humans scanning a dump can
* quickly determine whether or not it is a VRPN session.
*/
/*
* VRPN Log description message:
*
* type = vrpn_CONNECTION_LOG_DESCRIPTION (-4)
* sender = logging mode (0, 1, 2, or 3)
* payload length = strlen(logfile name) + 1
* data = null-terminated ASCII string giving pathname of file to log to
*/
/*
* VRPN UDP description message:
*
* type = vrpn_CONNECTION_UDP_DESCRIPTION (-3)
* sender = UDP port number to contact
* payload length = strlen(IP address) + 1
* data = ASCII string containing host's IP address
*/
/*
* VRPN Sender description message:
*
* type = vrpn_CONNECTION_SENDER_DESCRIPTION (-1)
* sender = ID of sender
* payload length = 5 + strlen(sender name)
* data =
*
* +------------+------------+------------+------------+
* + length of sender name + 1 |
* +------------+------------+------------+------------+
* + sender name |
* +------------+------------+------------+------------+
* + ... |
* +------------+------------+------------+------------+
*
* N.B. There is redundant length data here
*/
/*
* VRPN Type description message:
*
* type = vrpn_CONNECTION_TYPE_DESCRIPTION (-2)
* sender = ID of type
* payload length = 5 + strlen(sender name)
* data =
*
* +------------+------------+------------+------------+
* + length of type name + 1 |
* +------------+------------+------------+------------+
* + type name |
* +------------+------------+------------+------------+
* + ... |
* +------------+------------+------------+------------+
*
* N.B. There is redundant length data here
*/
/*
* VRPN disconnect message:
*
* type = vrpn_CONNECTION_DISCONNECT_MESSAGE (-5)
* sender = 0
* payload length = 0
*
* This message is never sent over the wire; it is written into logs
* to mark the point at which a connection was broken.
*/
This diff is collapsed.
# Example toolchain file for building with mingw32 on Ubuntu 10.04 x64
# Pass to CMake using cmake -DCMAKE_TOOLCHAIN_FILE=MinGWToolchain.cmake
# Not needed when actually building on Windows using mingw, only when
# cross-compiling
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Windows)
# which compilers to use for C and C++
set(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
set(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
set(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
# here is the target environment located
set(CMAKE_FIND_ROOT_PATH
/usr/i586-mingw32msvc
$ENV{HOME}/mingw-install)
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)