camera/XPortSim.cc File Reference


Detailed Description

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
#include <signal.h>
#include <fcntl.h>
#include "XPort.h"
#include "Utils.h"
#include "qnx_port.h"
#include "BicamConsts.h"

Functions

void sig_handler (int sig)
 Signal handler (SIGINT, SIGTERM) for XPortSim process.
int sendBytes (int sd, char *buf, int len)
 send bytes to specified socket.
int sendResponse (int sd, XPortResponse *xpResponse)
 Send XPortResponse to specified socket.
int sendMessage (int sd, char *msg)
 Send bytes to specified socket.
void startMockXPort (char *host)
 Start XPortSim server.
int getListenerSocket (int *sd, char *hostname, unsigned short port, struct sockaddr_in *servAddr)
 Establish listener socket.
void * gpioListener ()
 GPIO handler.
void * serialListener ()
 Serial handler.
void startMockXPort (const char *host)
 start XPortSim server
int main (int argc, char *argv[])
 XPortSim Entry Point.

Variables

boolean shutdownFlag = FALSE
 shutdown if TRUE
pid_t mockXPortPID
 Process ID of XPortSim server.
pid_t gpioPID
 Process ID of GPIO TCP/IP process.
pid_t serialPID
 Process ID of Serial IO TCP/IP process.


Function Documentation

int getListenerSocket ( int *  sd,
char *  hostname,
unsigned short  port,
struct sockaddr_in *  servAddr 
)

Establish listener socket.

Parameters:
sd socket descriptor to assign
hostname XPortSim server hostname
port XPortSim server TCP/IP port
servAddr socket address

void* gpioListener (  ) 

GPIO handler.

Receives incoming XPort GPIO traffic and returns appropriate messages.

int main ( int  argc,
char *  argv[] 
)

XPortSim Entry Point.

Starts XPortSim server.

Parameters:
argc number of command line arguments
argv command line parameters
Returns:
0 if normal termination, error code otherwise

int sendBytes ( int  sd,
char *  buf,
int  len 
)

send bytes to specified socket.

Parameters:
sd socket descriptor
buf byte buffer
len number of bytes to send

int sendMessage ( int  sd,
char *  msg 
)

Send bytes to specified socket.

Parameters:
sd socket descriptor
msg bytes to send.

int sendResponse ( int  sd,
XPortResponse xpResponse 
)

Send XPortResponse to specified socket.

Parameters:
sd socket descriptor
xpResponse pointer to XPortResponse

void* serialListener (  ) 

Serial handler.

Receives incoming XPort Serial traffic and returns appropriate messages. ToDo: use local serial port for full emulation.

void sig_handler ( int  sig  ) 

Signal handler (SIGINT, SIGTERM) for XPortSim process.

Parameters:
sig signal received

void startMockXPort ( const char *  host  ) 

start XPortSim server

Parameters:
host hostname

void startMockXPort ( char *  host  ) 

Start XPortSim server.

Parameters:
host hostname


Generated on Tue Jul 15 13:10:22 2008 for Benthic Imaging AUV by  doxygen 1.5.4