#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
+#include <libsoup/soup.h>
+
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+
/*
#include <bluetooth/sdp.h>
#include <bluetooth/sdp_lib.h>
int con_fd; /* console input fd */
char cmdline[128];
int cmdline_pos;
+ SoupSession *msoup;
+ SoupMessage *smsg;
} mwdata_t;
void bitmap_test(mwdevice_t *mwdevice)
mw_free_pbuffer(mwbuf);
}
+static void
+weather_soup_callback (SoupSession *session, SoupMessage *msg, gpointer user_data)
+{
+ xmlDocPtr xdoc;
+
+ /* Handle the response here */
+ if (msg->response_body->data != NULL && msg->response_body->length != 0) {
+ fprintf(stderr, "%s\n", msg->response_body->data);
+ xdoc = xmlReadMemory(msg->response_body->data, msg->response_body->length, "noname.xml", NULL, 0);
+ if (xdoc == NULL) {
+ fprintf(stderr, "Failed to parse document\n");
+ return;
+ }
+ xmlFreeDoc(xdoc);
+ xmlCleanupParser();
+ }
+}
+
+void do_weather(mwdata_t *mwdata)
+{
+ mwdata->msoup = soup_session_async_new();
+ mwdata->smsg = soup_message_new ("GET", "http://www.google.com/ig/api?weather=siegen&hl=de");
+ soup_session_send_message (mwdata->msoup, mwdata->smsg);
+ soup_session_queue_message (mwdata->msoup, mwdata->smsg, weather_soup_callback, mwdata);
+}
+
void print_help(void)
{
}
if (strncmp(cmdline, "cal", 3) == 0) {
draw_idle_calendar(&mwdata->mwdevice);
}
+ if (strncmp(cmdline, "wet", 3) == 0) {
+ do_weather(mwdata);
+ }
+ if (strncmp(cmdline, "c24", 3) == 0) {
+ mdata[0] = MW_RTC_CLOCK_24HR;
+ mw_nval_operation(&mwdata->mwdevice, MW_NVAL_OPERATION_WRITE, MW_NVAL_TIME_FORMAT, 1, mdata);
+ }
+ if (strncmp(cmdline, "g24", 3) == 0) {
+ mdata[0] = 0;
+ mdata[1] = 0;
+ mw_nval_operation(&mwdata->mwdevice, MW_NVAL_OPERATION_READ, MW_NVAL_TIME_FORMAT, 2, mdata);
+ }
}