I've just registered a project with Sourceforge now called GloPosCom. This blog will be the place I submit information regarding the project.
The project shall provide an API for communicating global positioning coordinates from a portable device/laptop to one or more XMPP-clients. The API reside on the portable device/laptop and communicate with one or several XMPP-clients through a XMPP-gateway. The API in itself is a XMPP-client. The XMPP-clients can send commands that are handled by the API.
So far I've only created an "engine" that is IO-multiplexed (I don't want to deal with the various ways multithreading is done on the various platforms) and a simple API to interact with the engine.
The engine currently connects to GTalk via the iksemel library and reads GPS-coordinates via the nmeap library . A small test-program I've written allows you to send commands from a GTalk client to the engine and the engine replies with the current position.
Since GTalk requires TLS and I could not find GnuTLS for all the platforms I want the API/engine to run on I had to alter iksemel some. It now uses OpenSSL instead of GnuTLS.
Here is the test program (just to illustrate the API):
#include "engine.h"
#include "openssl.h"
int main(int argc, char* argv[])
{
engine_t* engine;
BIO* logger;
logger = BIO_new_fd(0, BIO_NOCLOSE);
engine = engine_new();
engine_set_logger(engine, ENGINE_XMPP, logger);
engine_set_logger(engine, ENGINE_GPS, logger);
engine_set_xmpp_server(engine, "talk.google.com");
engine_set_xmpp_account(engine, "user@hosted-domain-or-gtalk.com", "password");
engine_set_gps_device(engine, "/dev/tty.gps");
engine_run(engine);
engine_stop(engine);
return 0;
}
The engine_run function do "polling" and can be extended to include other tasks the application shall perform:
The engine_run function look like this:
engine_xmpp_connect(engine->xmpp);
engine_gps_connect(engine->gps);
while(1)
{
engine_xmpp_process(engine->xmpp);
engine_gps_process(engine->gps);
}
So far I've not added much error-handling or any retry mechanisms if the GPS-
Bluetooth link go down or if the network connection is terminated.
No comments:
Post a Comment