|
imu_imar
|
#include <iostream>#include <stdio.h>#include <stdlib.h>#include <signal.h>#include <sys/types.h>#include <imu_imar/Imar.hpp>Typedefs | |
| typedef void(* | handling_t) (int sig, void *data) |
| POINTER TO HANDLING FUNCTION. More... | |
Functions | |
| bool | signal_set (int sig, handling_t pfunc, void *values) |
| Function that set a defined handler for a signal. More... | |
| bool | signal_catcher (int sig_1, int sig_2, int sig_3, int sig_4, handling_t pfunc, void *values) |
| The Function catchs the signal introduced in the parameter of this function. More... | |
| void | signal_terminator (int sig, void *values) |
| Function for handling system signals. More... | |
| int | main (int argc, char **argv) |
| typedef void(* handling_t) (int sig, void *data) |
POINTER TO HANDLING FUNCTION.
SIGHUP 1 Termin. Hang up on controlling terminal SIGINT 2 Termin. Interrupt. Generated when we enter CNRTL-C and it is delivered to all processes/threads associated to the current terminal. If generated with kill, it is delivered to only one process/thread. SIGQUIT 3 Core Generated when at terminal we enter CNRTL-\ SIGILL 4 Core Generated when we executed an illegal instruction SIGTRAP 5 Core Trace trap (not reset when caught) SIGABRT 6 Core Generated by the abort function SIGFPE 8 Core Floating Point error SIGKILL 9 Termin. Termination (can't catch, block, ignore) SIGBUS 10 Core Generated in case of hardware fault SIGSEGV 11 Core Generated in case of illegal address SIGSYS 12 Core Generated when we use a bad argument in a system service call SIGPIPE 13 Termin. Generated when writing to a pipe or a socket while no process is reading at other end SIGALRM 14 Termin. Generated by clock when alarm expires SIGTERM 15 Termin. Software termination signal SIGURG 16 Ignore Urgent condition on IO channel SIGCHLD 20 Ignore A child process has terminated or stopped SIGTTIN 21 Stop Generated when a backgorund process reads from terminal SIGTTOUT 22 Stop Generated when a background process writes to terminal SIGXCPU 24 Discard CPU time has expired SIGUSR1 30 Termin. User defiled signal 1 SIGUSR2 31 Termin. User defined signal 2
| int main | ( | int | argc, |
| char ** | argv | ||
| ) |
Open serial port
Argv[1] normally is "/dev/ttyUSB0" driver description file on Linux system
Store the read values in the Circular Buffer
Synchronize with the starting byte
| bool signal_catcher | ( | int | sig_1, |
| int | sig_2, | ||
| int | sig_3, | ||
| int | sig_4, | ||
| handling_t | pfunc, | ||
| void * | values | ||
| ) |
The Function catchs the signal introduced in the parameter of this function.
The function associates the signals with the handling function to be handled when the process would receives such signal from the operating system. The handling function should have two parameters when defined in the main program. one parameter (integer) for the signal number, another for the pointer to void (values) Normally the last one is a pointer to a structure.
| [in] | sig_1 | integer for the number of signal 1 to be handled |
| [in] | sig_2 | integer for the number of signal 2 to be handled |
| [in] | sig_3 | integer for the number of signal 3 to be handled |
| [in] | sig_4 | integer for the number of signal 4 to be handled |
| [in] | pfunc | pointer to the handling function |
| [in] | values | pointer to void, the parameter of the handling function. |
| bool signal_set | ( | int | sig, |
| handling_t | pfunc, | ||
| void * | values | ||
| ) |
Function that set a defined handler for a signal.
| [in] | sig | integer for the number of signal to be handled |
| [in] | pfunc | pointer of the handling function |
| [in] | values | pointer of void, the parameter of the handling function. |
| void signal_terminator | ( | int | sig, |
| void * | values | ||
| ) |
Function for handling system signals.
This function is the handler when the catched system signal happen.
| [in] | sig | integer of the catched signal |
| [in] | values | pointer of void (pointer of the IMU structure after casting in the function) |
1.8.11