#include <iostream>#include <stack>#include <vector>#include <cstring>#include <cstdlib>#include <cstdio>#include <time.h>#include <unistd.h>#include <dlfcn.h>#include <pthread.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <sys/socket.h>#include <sys/un.h>#include <signal.h>#include <Platform.h>#include <ModuleData.h>#include <OpenSdkThread.h>#include <utils.h>#include "main.h"#include "helper.h"#include "gunzip.h"#include "OVirtualRobotComm.h"#include "opensdkAPI.h"#include <OPENR/ObjcommMessages.h>#include <OPENR/OPENRAPI.h>Go to the source code of this file.
Defines | |
| #define | CHECK_SYSCALL(val, msg) if ((val) == -1) { perror(msg); exit(4); } |
| #define | CLOSE_SOCKET(sock) if (sock != -1) { close(sock); sock = -1; } |
| #define | CREATE_SOCKET_THREAD(sock) |
Functions | |
| bool | load_module (const char *name) |
| bool | parse_object_cfg (void) |
| bool | parse_connect_cfg (void) |
| void | sendConnectMessages (void) |
| void * | listen_socket (void *_sock) |
| void | connect_to_actuators_server () |
| void | cleanup (void) |
| void | sig_handler (int sig) |
| int | main (int argc, char *argv[]) |
Variables | |
| stack< void * > | dlopenHandlers |
| vector< perThreadStruct * > | ThreadsList |
| stack< pthread_t > | skThreadsList |
| socketList_t | socketList [] |
| pthread_key_t | perThreadKey |
| bool | __in_shutdown = false |
| bool | __DoInitCompleted = false |
| bool | __DoStopCompleted = false |
| map< string, OServiceEntry > | _objectsEntryList |
| list< pair< string, string > > | connectionStrings |
|
|
Definition at line 55 of file loader/main.cc. Referenced by connect_to_opensdk_actuator(), listen_socket(), and main(). |
|
|
Definition at line 56 of file loader/main.cc. Referenced by cleanup(), and listen_socket(). |
|
|
Value: { \
pthread_t myThread; \
if (pthread_create(&myThread, NULL, listen_socket, sock)) { \
cerr << "Couldn't create a new thread to load servers" << endl; \
return 5; \
} \
skThreadsList.push(myThread); \
}
Definition at line 57 of file loader/main.cc. Referenced by main(). |
|
|
cleanup stuff at exit. called magically by atexit() Definition at line 295 of file loader/main.cc. References __DoInitCompleted, __DoStopCompleted, __in_shutdown, OpenSdkThread::cleanThreadPool(), CLOSE_SOCKET, dlopenHandlers, opensdk_yield, skThreadsList, socketList, and ThreadsList. Referenced by main(). |
|
|
connect to the actuators server/simulator Definition at line 277 of file loader/main.cc. References ACTUATORS_SERVER_SOCKET, socketList_t::fd_client, and socketList. Referenced by main(). |
|
|
create, listen and accept sockets Definition at line 243 of file loader/main.cc. References BLOCK_SIGNALS, CHECK_SYSCALL, and CLOSE_SOCKET. |
|
|
load a module to memory and create a thread for it Definition at line 98 of file loader/main.cc. References gunzip_module(), module_executor(), resolve_case_insensitive_path(), perThreadStruct::threadId, and ThreadsList. Referenced by parse_object_cfg(). |
|
||||||||||||
|
Definition at line 379 of file loader/main.cc. References __DoInitCompleted, BLOCK_SIGNAL, cleanup(), connect_to_actuators_server(), CREATE_SOCKET_THREAD, IMAGE, init_virtual_robot_comm(), OpenSdkThread::initThreadPool(), opensdk_yield, parse_connect_cfg(), parse_object_cfg(), perThreadKey, ROBOTDESIGN, sendConnectMessages(), SENSORS, sig_handler(), socketList, and ThreadsList. |
|
|
parse the CONNECT.CFG file fill in the DB with the information extracted Definition at line 164 of file loader/main.cc. References connectionStrings, getNonEmptyLine(), resolve_case_insensitive_path(), and subject. Referenced by main(). |
|
|
parse the OBJECT.CFG file and load the necessary modules Definition at line 139 of file loader/main.cc. References getNonEmptyLine(), load_module(), and resolve_case_insensitive_path(). Referenced by main(). |
|
|
connect objects, by sending Connect/Control messages Definition at line 195 of file loader/main.cc. References _objectsEntryList, _sendMessage(), perThreadStruct::ConnectHandlers, connectionStrings, and ThreadsList. Referenced by main(). |
|
|
signal handler (called by the OS) Definition at line 363 of file loader/main.cc. Referenced by main(). |
|
|
true if all objects have already run its DoInit() method Definition at line 85 of file loader/main.cc. Referenced by cleanup(), main(), VirtualRobotComm(), VirtualRobotComm_image(), and VirtualRobotComm_sensor(). |
|
|
true if all objects have already run its DoStop() method Definition at line 88 of file loader/main.cc. Referenced by cleanup(). |
|
|
whether we in are in shutdown proccess. if true, modules start the shutdown procedures automatically Definition at line 82 of file loader/main.cc. Referenced by cleanup(). |
|
|
hash table with the connection string/entry relations Definition at line 91 of file loader/main.cc. Referenced by RegisterServiceEntry(), and sendConnectMessages(). |
|
|
list with pairs of subject/observer connection strings Definition at line 94 of file loader/main.cc. Referenced by parse_connect_cfg(), and sendConnectMessages(). |
|
|
Definition at line 67 of file loader/main.cc. Referenced by cleanup(). |
|
|
thread specific data Definition at line 79 of file loader/main.cc. Referenced by main(), module_executor(), VirtualRobotComm(), VirtualRobotComm_image(), and VirtualRobotComm_sensor(). |
|
|
Definition at line 69 of file loader/main.cc. Referenced by cleanup(). |
|
|
Initial value: {
{-1, -1, NULL, ACTUATORS_SERVER_SOCKET},
{-1, -1, NULL, SENSORS_SERVER_SOCKET},
{-1, -1, NULL, IMAGE_SERVER_SOCKET},
}
Definition at line 72 of file loader/main.cc. Referenced by cleanup(), connect_to_actuators_server(), main(), process_images(), process_sensor_readings(), and send_server(). |
|
|
Definition at line 68 of file loader/main.cc. Referenced by _sendMessage(), cleanup(), load_module(), main(), and sendConnectMessages(). |
1.3.9.1