32 #define ISAAC_INCREASE_NR_OR_DIE \ 36 printf("Not enough arguments!\n"); \ 40 int main(
int argc,
char **argv)
46 const char __tcp_interface[] =
"*";
47 const char __web_interface[] =
"*";
48 const char __sim_interface[] =
"*";
49 const char* tcp_interface = __tcp_interface;
50 const char* web_interface = __web_interface;
51 const char* sim_interface = __sim_interface;
52 const char __name[] =
"ISAAC Visualization server";
53 const char __url[] =
"127.0.0.1";
54 const char* name = __name;
55 const char* url = __url;
58 char* twitch_apikey = NULL;
59 char* twitch_url = NULL;
60 int twitch_bitrate = 400;
65 if (strcmp(argv[nr],
"--help") == 0)
69 printf(
"isaac [--help] [--url <X>] [--name <X>] [--web_port <X>] [--tcp_port <X>]\n");
70 printf(
" [--sim_port <X>] [--web_int <X>] [--tcp_int <X>] [--sim_int <X>]\n");
71 printf(
" [--dump <X>] [--version]\n");
72 printf(
"Explanation:\n");
73 printf(
" --help: Shows this help\n");
74 printf(
" --url: Set the url to connect to from outside. Default 127.0.0.1\n");
75 printf(
" --name: Set the name of the server.\n");
76 printf(
" --web_port: Set port for the websocket clients to connect. Default %i\n",web_port);
77 printf(
" --tcp_port: Set port for the tcp clients to connect. Default %i\n",tcp_port);
78 printf(
" --sim_port: Set port for the simulations to connect to. Default %i\n",sim_port);
79 printf(
" --web_int: Set interface for the websocket clients to connect. Default %s\n",web_interface);
80 printf(
" --tcp_int: Set interface for the tcp clients to connect. Default %s\n",tcp_interface);
81 printf(
" --sim_int: Set interface for the simulations to connect. Default %s\n",sim_interface);
82 printf(
" --dump: Dump all received jpegs to the disk in the given folder\n");
83 printf(
" --version: Shows the version\n");
85 printf(
" --twitch: Set twitch apikey for twitch live streaming\n");
86 printf(
"--twitch_url: Set twitch rtmp-url for ssh forwarding or another rtmp service\n");
87 printf(
"--twitch_bitrate: Set twitch bitrate. Default 400\n");
92 if (strcmp(argv[nr],
"--version") == 0)
98 if (strcmp(argv[nr],
"--web_port") == 0)
101 web_port = atoi(argv[nr]);
104 if (strcmp(argv[nr],
"--tcp_port") == 0)
107 tcp_port = atoi(argv[nr]);
110 if (strcmp(argv[nr],
"--sim_port") == 0)
113 sim_port = atoi(argv[nr]);
116 if (strcmp(argv[nr],
"--web_int") == 0)
119 web_interface = argv[nr];
122 if (strcmp(argv[nr],
"--tcp_int") == 0)
125 tcp_interface = argv[nr];
128 if (strcmp(argv[nr],
"--sim_int") == 0)
131 sim_interface = argv[nr];
134 if (strcmp(argv[nr],
"--url") == 0)
140 if (strcmp(argv[nr],
"--name") == 0)
147 if (strcmp(argv[nr],
"--twitch") == 0)
150 twitch_apikey = argv[nr];
153 if (strcmp(argv[nr],
"--twitch_url") == 0)
156 twitch_url = argv[nr];
159 if (strcmp(argv[nr],
"--twitch_bitrate") == 0)
162 twitch_bitrate = atoi(argv[nr]);
166 if (strcmp(argv[nr],
"--dump") == 0)
173 printf(
"Don't know argument %s\n",argv[nr]);
179 printf(
"Using web_port=%i, tcp_port=%i and sim_port=%i\n",web_port,tcp_port,sim_port);
182 Broker broker(name,sim_port,sim_interface);
184 if (webSocketDataConnector->
init(web_port,web_interface) == 0)
187 if (tCPDataConnector->
init(tcp_port,tcp_interface) == 0)
191 if (rTPImageConnector_h264->
init(5000,5099) == 0)
194 if (rTPImageConnector_jpeg->
init(5100,5199) == 0)
199 if (uRIImageConnector->
init(0,0) == 0)
207 twitchImageConnector =
new RTMPImageConnector( std::string(
"Twitch"), std::string(twitch_apikey), std::string(twitch_url), twitch_bitrate,
true );
209 twitchImageConnector =
new RTMPImageConnector( std::string(
"Twitch"), std::string(twitch_apikey), std::string(
"live-fra.twitch.tv/app"), twitch_bitrate,
true );
210 if (twitchImageConnector->
init(0,0) == 0)
216 if (sDLImageConnector->
init(0,0) == 0)
224 if (saveFileImageConnector->
init(0,0) == 0)
231 printf(
"Error while running isaac\n");
235 delete webSocketDataConnector;
236 delete tCPDataConnector;
238 delete uRIImageConnector;
241 delete rTPImageConnector_h264;
242 delete rTPImageConnector_jpeg;
243 delete twitchImageConnector;
246 delete sDLImageConnector;
247 delete saveFileImageConnector;
#define ISAAC_INCREASE_NR_OR_DIE
int main(int argc, char **argv)
errorCode init(int minport, int maxport)
errorCode init(int minport, int maxport)
errorCode init(int minport, int maxport)
errorCode init(int minport, int maxport)
errorCode init(int minport, int maxport)
errorCode addImageConnector(ImageConnector *imageConnector)
#define ISAAC_SERVER_VERSION_STRING
errorCode init(int port, std::string interface)
errorCode addDataConnector(MetaDataConnector *dataConnector)
errorCode init(int port, std::string interface)