gtk_progress_bar_set_text(batbar, batstr);
}
+void on_notify_ok_clicked (GtkButton *button, gpointer user_data)
+{
+ mwdata_t *mdata = (mwdata_t *)user_data;
+ GtkWidget *notify_win;
+ GtkTextView *tview;
+ GtkTextBuffer *tbuf;
+ GtkTextIter siter, eiter;
+ gchar *text;
+
+ tview = GTK_TEXT_VIEW (gtk_builder_get_object (mdata->builder, "notify_textview"));
+ tbuf = gtk_text_view_get_buffer(tview);
+ gtk_text_buffer_get_start_iter(tbuf, &siter);
+ gtk_text_buffer_get_end_iter(tbuf, &eiter);
+
+ text = gtk_text_buffer_get_text(tbuf, &siter, &eiter, FALSE);
+
+ mw_do_notification(&mdata->mwdevice, "Notification", text, 2);
+
+ notify_win = GTK_WIDGET (gtk_builder_get_object (mdata->builder, "notify_win"));
+ gtk_widget_hide (notify_win);
+}
+
+void on_notify_cancel_clicked (GtkButton *button, gpointer user_data)
+{
+ mwdata_t *mdata = (mwdata_t *)user_data;
+ GtkWidget *notify_win;
+
+ notify_win = GTK_WIDGET (gtk_builder_get_object (mdata->builder, "notify_win"));
+ gtk_widget_hide (notify_win);
+}
+
+
void on_rtc_button_clicked (GtkButton *button, gpointer user_data)
{
mwdata_t *mdata = (mwdata_t *)user_data;
void on_notify_button_clicked (GtkButton *button, gpointer user_data)
{
mwdata_t *mdata = (mwdata_t *)user_data;
+ GtkWidget *notify_win;
+ notify_win = GTK_WIDGET (gtk_builder_get_object (mdata->builder, "notify_win"));
+ gtk_widget_show (notify_win);
}
void bitmap_read(mwdevice_t *mwdevice, char *filename)
free(bmapbuf);
}
+void on_vibrate_button_clicked (GtkButton *button, gpointer user_data)
+{
+ mwdata_t *mdata = (mwdata_t *)user_data;
+}
+
+void on_set_hands_clicked (GtkButton *button, gpointer user_data)
+{
+ mwdata_t *mdata = (mwdata_t *)user_data;
+ time_t mtime;
+ struct tm mtm;
+ unsigned short hour;
+
+ mtime = time(NULL);
+ localtime_r(&mtime, &mtm);
+
+ hour = (unsigned char) mtm.tm_hour;
+ if (hour > 12)
+ hour -= 12;
+
+ mw_advance_watch_hands(&mdata->mwdevice, hour, (unsigned char) mtm.tm_min, (unsigned char) mtm.tm_sec);
+}
+
void on_bitmap_button_clicked (GtkButton *button, gpointer user_data)
{
mwdata_t *mdata = (mwdata_t *)user_data;
gtk_widget_destroy(dialog);
}
+void setup_watchtype_gui(mwdata_t *mdata)
+{
+ GtkWidget *w;
+
+ if (mdata->mwdevice.devtype == MW_DEVICE_TYPE_DIGITAL || mdata->mwdevice.devtype == MW_DEVICE_TYPE_DEVB_DIGI) {
+ w = GTK_WIDGET (gtk_builder_get_object (mdata->builder, "set_hands"));
+ gtk_widget_hide(w);
+ }
+ if (mdata->mwdevice.devtype == MW_DEVICE_TYPE_ANA_DIGI || mdata->mwdevice.devtype == MW_DEVICE_TYPE_DEVB_ANA_DIGI) {
+ w = GTK_WIDGET (gtk_builder_get_object (mdata->builder, "F_button_label"));
+ gtk_widget_hide(w);
+ w = GTK_WIDGET (gtk_builder_get_object (mdata->builder, "E_button_label"));
+ gtk_widget_hide(w);
+ w = GTK_WIDGET (gtk_builder_get_object (mdata->builder, "D_button_label"));
+ gtk_widget_hide(w);
+ }
+}
+
+void mw_get_device_type_response_cb(mwdevice_t *mwdevice, unsigned char devtype, void *user_data)
+{
+ mwdata_t *mdata = (mwdata_t *)user_data;
+
+ setup_watchtype_gui(mdata);
+}
+
void mw_get_real_time_clock_response_cb(mwdevice_t *mwdevice, struct tm *mw_tm, void *user_data)
{
mwdata_t *mdata = (mwdata_t *)user_data;
int rcvd;
int processed;
- rcvd = read(mdata->mwdevice.mw_fd, mdata->rcvbuf+mdata->rcvbuf_pos, 64);
+ rcvd = read(mdata->mwdevice.mw_fd, mdata->rcvbuf/*+mdata->rcvbuf_pos*/, 64);
#ifdef DEBUG
fprintf(stderr, "read %d bytes:\n", rcvd);
#endif
}
-
-int
-main (int argc, char *argv[])
+int main (int argc, char *argv[])
{
GtkBuilder *builder;
GtkWidget *window;
mw_init(&mdata.mwdevice, mw_fd);
+ mw_set_get_device_type_response_cb(&mdata.mwdevice, mw_get_device_type_response_cb, &mdata);
mw_set_get_real_time_clock_response_cb(&mdata.mwdevice, mw_get_real_time_clock_response_cb, &mdata);
mw_set_get_battery_voltage_response_cb(&mdata.mwdevice, mw_get_battery_voltage_response_cb, &mdata);
mdata.bat_timeout_id = g_timeout_add_seconds(10, battery_level_get_timeout, &mdata);
+ // setup_watchtype_gui(&mdata);
gtk_main ();
return 0;
}
+
<object class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="n_rows">3</property>
+ <property name="n_rows">2</property>
<property name="n_columns">3</property>
<child>
<object class="GtkVButtonBox" id="vbuttonbox1">
<property name="bottom_attach">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="rtc_button">
+ <property name="label" translatable="yes">RTC</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <signal name="clicked" handler="on_rtc_button_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkProgressBar" id="battery_status_bar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="show_text">True</property>
+ <property name="fraction">0.28571428571428592</property>
+ <property name="text" translatable="yes">Battery</property>
+ <property name="adjustment">bat_adjust</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="power_status_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">unknown</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkDrawingArea" id="drawingarea1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="info_button">
+ <property name="label">gtk-about</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_info_button_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
<child>
<object class="GtkButton" id="notify_button">
<property name="label" translatable="yes">Notification</property>
<signal name="clicked" handler="on_notify_button_clicked" swapped="no"/>
</object>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
<signal name="clicked" handler="on_bitmap_button_clicked" swapped="no"/>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
<property name="use_action_appearance">False</property>
<signal name="clicked" handler="on_vibrate_button_clicked" swapped="no"/>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="set_hands">
+ <property name="label" translatable="yes">Set Hands</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <signal name="clicked" handler="on_set_hands_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkStatusbar" id="statusbar1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkWindow" id="notify_win">
+ <property name="can_focus">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="ypad">1</property>
+ <property name="label" translatable="yes"><b>Notification text</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <object class="GtkTextView" id="notify_textview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="notify_cancel">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_notify_cancel_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="notify_ok">
+ <property name="label">gtk-apply</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_notify_ok_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkWindow" id="window1">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>RTC</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="padding">5</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">4</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Date</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Time</property>
+ </object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="rtc_button">
- <property name="label" translatable="yes">RTC</property>
+ <object class="GtkRadioButton" id="h12_radio">
+ <property name="label" translatable="yes">12h</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
- <signal name="clicked" handler="on_rtc_button_clicked" swapped="no"/>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">h24_radio</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
</packing>
</child>
<child>
- <placeholder/>
+ <object class="GtkRadioButton" id="h24_radio">
+ <property name="label" translatable="yes">24h</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
</child>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkVBox" id="vbox6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkProgressBar" id="battery_status_bar">
+ <object class="GtkCalendar" id="calendar1">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="show_text">True</property>
- <property name="fraction">0.28571428571428592</property>
- <property name="text" translatable="yes">Battery</property>
- <property name="adjustment">bat_adjust</property>
+ <property name="can_focus">True</property>
+ <property name="year">2011</property>
+ <property name="month">7</property>
+ <property name="day">21</property>
+ <property name="show_week_numbers">True</property>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="power_status_label">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">unknown</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Format</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="mmdd_radio">
+ <property name="label" translatable="yes">MM/DD</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">ddmm_radio</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="ddmm_radio">
+ <property name="label" translatable="yes">DD.MM</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
</object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkDrawingArea" id="drawingarea1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
<child>
- <object class="GtkStatusbar" id="statusbar1">
+ <object class="GtkHButtonBox" id="hbuttonbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="get_watch_rtc_button">
+ <property name="label" translatable="yes">Get RTC from
+watch</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="get_sys_rtc_button">
+ <property name="label" translatable="yes">Get RTC from
+System</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="set_rtc_button">
+ <property name="label" translatable="yes">Set RTC</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="rtc_ok_button">
+ <property name="label">gtk-apply</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
#include <string.h>
#include <stdio.h>
-#include "mw_utility.h"
#include "metawatch.h"
+#include "mw_utility.h"
#include "fonts.h"
+/* ----------------------------------------------------------------------
+ * Generic drawing functions
+ * ---------------------------------------------------------------------- */
+
/*
* The pixmap buffer has at least one byte per pixel, even for monochrome (bpp=1)
* bitmaps
}
}
+
+/* ----------------------------------------------------------------------
+ * Complex combined functions, for user convenience
+ * ---------------------------------------------------------------------- */
+
+/*
+ * send a text notification, automatically take care of device type (ana/digi)
+ * char *title is displayed inverse in top line
+ * char *text is the notification text
+ * vibrate is the number of 300ms vibrations, 0 for none
+ */
+void mw_do_notification(mwdevice_t *mwdevice, char *title, char *text, unsigned char vibrate)
+{
+ mw_buffer *mwbuf;
+ unsigned char *bbuf;
+ int len,i,c,r;
+ char sstr[32];
+
+ // fprintf(stderr, "do_notify devtype=%d, title='%s', text='%s', vibrate=%d\n", mwdevice->devtype, title, text, vibrate);
+ if (mwdevice->devtype == MW_DEVICE_TYPE_DIGITAL || mwdevice->devtype == MW_DEVICE_TYPE_DEVB_DIGI) {
+ mwbuf = mw_alloc_pbuffer(96, 96, 1);
+ mw_buf_clear(mwbuf, MW_BLACK);
+
+ mw_buf_print(mwbuf, 0, 0, title, 0, MW_BLACK, MW_WHITE);
+
+ i=0;
+ c=0; r=1;
+ memset(sstr,0,32);
+ while (i<strlen(text)) {
+ sstr[c++] = text[i++];
+ if (c>=16 || i>=strlen(text)) {
+ mw_buf_print(mwbuf, 0, r*9, sstr, 0, MW_WHITE, MW_BLACK);
+ memset(sstr,0,32);
+ c=0; r++;
+ if (r>10)
+ break;
+ };
+ };
+
+ bbuf = mw_make_mw_buffer(mwbuf, &len);
+ mw_send_bitmap(mwdevice, MW_SCREEN_MODE_NOTIFICATION, 96, 96, 0, bbuf, len);
+ mw_update_display(mwdevice, MW_SCREEN_MODE_NOTIFICATION, 1);
+ mw_free_pbuffer(mwbuf);
+ } else if (mwdevice->devtype == MW_DEVICE_TYPE_ANA_DIGI || mwdevice->devtype == MW_DEVICE_TYPE_DEVB_ANA_DIGI) {
+ fprintf(stderr, "do notify OLED\n");
+ mwbuf = mw_alloc_pbuffer(80, 16, 1);
+ mw_buf_clear(mwbuf, MW_BLACK);
+
+ mw_buf_print(mwbuf, 0, 0, title, 0, MW_BLACK, MW_WHITE);
+
+ i=0;
+ c=0; r=1;
+ memset(sstr,0,32);
+ while (i<strlen(text) && r<2) {
+ sstr[c++] = text[i++];
+ if (c>=13 || i>=strlen(text)) {
+ mw_buf_print(mwbuf, 0, r*9, sstr, 0, MW_WHITE, MW_BLACK);
+ memset(sstr,0,32);
+ c=0; r++;
+ };
+ };
+
+ bbuf = mw_make_mw_oled_buffer(mwbuf, &len);
+ mw_write_oled_buffer(mwdevice, 0, MW_OLED_UPPER, 80, 0, bbuf, len);
+
+ mw_buf_clear(mwbuf, MW_BLACK);
+ c=0; r=0;
+ memset(sstr,0,32);
+ while (i<strlen(text) && r<2) {
+ sstr[c++] = text[i++];
+ if (c>=13 || i>=strlen(text)) {
+ mw_buf_print(mwbuf, 0, r*9, sstr, 0, MW_WHITE, MW_BLACK);
+ memset(sstr,0,32);
+ c=0; r++;
+ if (r>2)
+ break;
+ };
+ };
+
+ bbuf = mw_make_mw_oled_buffer(mwbuf, &len);
+ mw_write_oled_buffer(mwdevice, 0, MW_OLED_LOWER, 80, 0, bbuf, len);
+
+ mw_free_pbuffer(mwbuf);
+ } else
+ fprintf(stderr, "Watch type not set - forgot to call mw_init()?\n");
+
+ if (vibrate)
+ mw_set_vibrate_mode(mwdevice, 1, 300, 300, vibrate);
+}
+