Update to spec
authorNils Faerber <nils.faerber@kernelconcepts.de>
Fri, 11 Nov 2011 23:15:16 +0000 (00:15 +0100)
committerNils Faerber <nils.faerber@kernelconcepts.de>
Fri, 11 Nov 2011 23:15:16 +0000 (00:15 +0100)
metawatch.c
metawatch.h
metawatch_protocol.h
mw_main.c

index d1d6d2b..e487e35 100644 (file)
@@ -428,6 +428,7 @@ void mw_set_get_battery_voltage_response_cb(mwdevice_t *mwdevice, void (*mw_get_
                mwdevice->mw_gbatvrsp_data = user_data;
 }
 
                mwdevice->mw_gbatvrsp_data = user_data;
 }
 
+#if 0
 int mw_read_button_config_response(mwdevice_t *mwdevice, unsigned char *btnrsp, int len)
 {
 #ifdef DEBUG
 int mw_read_button_config_response(mwdevice_t *mwdevice, unsigned char *btnrsp, int len)
 {
 #ifdef DEBUG
@@ -447,6 +448,7 @@ int mw_read_button_config_response(mwdevice_t *mwdevice, unsigned char *btnrsp,
 
        return 0;
 }
 
        return 0;
 }
+#endif
 
 void mw_set_read_button_config_response_cb(mwdevice_t *mwdevice, void (*mw_read_button_config_response_cb) (mwdevice_t *mwdevice, void *user_data), void *user_data)
 {
 
 void mw_set_read_button_config_response_cb(mwdevice_t *mwdevice, void (*mw_read_button_config_response_cb) (mwdevice_t *mwdevice, void *user_data), void *user_data)
 {
@@ -459,7 +461,7 @@ void mw_set_read_button_config_response_cb(mwdevice_t *mwdevice, void (*mw_read_
 int mw_button_event_message(mwdevice_t *mwdevice, unsigned char *btnevt, int len, unsigned char opts)
 {
 #ifdef DEBUG
 int mw_button_event_message(mwdevice_t *mwdevice, unsigned char *btnevt, int len, unsigned char opts)
 {
 #ifdef DEBUG
-       fprintf(stderr, "  button %d options %d\n", btnevt[0], opts);
+       fprintf(stderr, "Button event message, button %d options %d\n", btnevt[0], opts);
 #endif
 
        if (mwdevice->mw_button_event_message_cb != NULL)
 #endif
 
        if (mwdevice->mw_button_event_message_cb != NULL)
@@ -522,8 +524,11 @@ void mw_set_status_change_event_cb(mwdevice_t *mwdevice, void (*mw_status_change
                mwdevice->mw_stchev_data = user_data;
 }
 
                mwdevice->mw_stchev_data = user_data;
 }
 
-int mw_low_battery_warning_message(mwdevice_t *mwdevice, unsigned char option, unsigned char *statrsp, int len)
+int mw_low_battery_warning_message(mwdevice_t *mwdevice)
 {
 {
+#ifdef DEBUG
+       fprintf(stderr, "Watch battery low, please connect charger\n");
+#endif
        if (mwdevice->mw_low_battery_warning_message_cb != NULL)
                mwdevice->mw_low_battery_warning_message_cb(mwdevice, mwdevice->mw_lbatwarnmsg_data);
 
        if (mwdevice->mw_low_battery_warning_message_cb != NULL)
                mwdevice->mw_low_battery_warning_message_cb(mwdevice, mwdevice->mw_lbatwarnmsg_data);
 
@@ -538,8 +543,11 @@ void mw_set_low_battery_warning_message_cb(mwdevice_t *mwdevice, void (*mw_low_b
                mwdevice->mw_lbatwarnmsg_data = user_data;
 }
 
                mwdevice->mw_lbatwarnmsg_data = user_data;
 }
 
-int mw_low_battery_bt_off_message(mwdevice_t *mwdevice, unsigned char option, unsigned char *statrsp, int len)
+int mw_low_battery_bt_off_message(mwdevice_t *mwdevice)
 {
 {
+#ifdef DEBUG
+       fprintf(stderr, "Watch battery extremely low - radio will turn off\n");
+#endif
        if (mwdevice->mw_low_battery_bt_off_message_cb != NULL)
                mwdevice->mw_low_battery_bt_off_message_cb(mwdevice, mwdevice->mw_lbatbtoff_data);
 
        if (mwdevice->mw_low_battery_bt_off_message_cb != NULL)
                mwdevice->mw_low_battery_bt_off_message_cb(mwdevice, mwdevice->mw_lbatbtoff_data);
 
@@ -601,18 +609,19 @@ int mw_decode_frame(mwdevice_t *mwdevice, unsigned char *buf, int len)
                case MW_READ_LIGHT_SENSOR_RSP:
                        mw_read_light_sensor_response(mwdevice, msgdata, msgdatalen);
                        break;
                case MW_READ_LIGHT_SENSOR_RSP:
                        mw_read_light_sensor_response(mwdevice, msgdata, msgdatalen);
                        break;
+#if 0
                case MW_READ_BUTTON_CONFIG_RSP:
                        mw_read_button_config_response(mwdevice, msgdata, msgdatalen);
                        break;
                case MW_READ_BUTTON_CONFIG_RSP:
                        mw_read_button_config_response(mwdevice, msgdata, msgdatalen);
                        break;
+#endif
                case MW_BUTTON_EVENT_MESSAGE:
                case MW_BUTTON_EVENT_MESSAGE:
-                       fprintf(stderr, "Button event message\n");
                        mw_button_event_message(mwdevice, msgdata, msgdatalen, msgopt);
                        break;
                case MW_LOW_BATTERY_WARNING_MSG:
                        mw_button_event_message(mwdevice, msgdata, msgdatalen, msgopt);
                        break;
                case MW_LOW_BATTERY_WARNING_MSG:
-                       fprintf(stderr, "Watch battery low, please connect charger\n");
+                       mw_low_battery_warning_message(mwdevice);
                        break;
                case MW_LOW_BATTERY_BT_OFF_MSG:
                        break;
                case MW_LOW_BATTERY_BT_OFF_MSG:
-                       fprintf(stderr, "Watch battery extremely low - radio will turn off\n");
+                       mw_low_battery_bt_off_message(mwdevice);
                        break;
                case MW_NVAL_OPERATION_RSP:
                        fprintf(stderr, "NVAL operation response - ");
                        break;
                case MW_NVAL_OPERATION_RSP:
                        fprintf(stderr, "NVAL operation response - ");
@@ -641,7 +650,9 @@ int mw_decode_frame(mwdevice_t *mwdevice, unsigned char *buf, int len)
                        mw_status_change_event(mwdevice, msgopt, msgdata, msgdatalen);
                        break;
                default:
                        mw_status_change_event(mwdevice, msgopt, msgdata, msgdatalen);
                        break;
                default:
+#ifdef DEBUG
                        fprintf(stderr, "Unkown msgtype 0x%02x\n", msgtype);
                        fprintf(stderr, "Unkown msgtype 0x%02x\n", msgtype);
+#endif
                        break;
        };
 
                        break;
        };
 
index 2c50571..2244940 100644 (file)
@@ -89,10 +89,10 @@ void mw_set_read_light_sensor_response_cb(mwdevice_t *mwdevice, void (*mw_read_l
 int mw_status_change_event(mwdevice_t *mwdevice, unsigned char option, unsigned char *statrsp, int len);
 void mw_set_status_change_event_cb(mwdevice_t *mwdevice, void (*mw_status_change_event_cb) (mwdevice_t *mwdevice, unsigned char *scrmode, unsigned char *status, void *user_data), void *user_data);
 
 int mw_status_change_event(mwdevice_t *mwdevice, unsigned char option, unsigned char *statrsp, int len);
 void mw_set_status_change_event_cb(mwdevice_t *mwdevice, void (*mw_status_change_event_cb) (mwdevice_t *mwdevice, unsigned char *scrmode, unsigned char *status, void *user_data), void *user_data);
 
-int mw_low_battery_warning_message(mwdevice_t *mwdevice, unsigned char option, unsigned char *statrsp, int len);
+int mw_low_battery_warning_message(mwdevice_t *mwdevice);
 void mw_set_low_battery_warning_message_cb(mwdevice_t *mwdevice, void (*mw_low_battery_warning_message_cb) (mwdevice_t *mwdevice, void *user_data), void *user_data);
 
 void mw_set_low_battery_warning_message_cb(mwdevice_t *mwdevice, void (*mw_low_battery_warning_message_cb) (mwdevice_t *mwdevice, void *user_data), void *user_data);
 
-int mw_low_battery_bt_off_message(mwdevice_t *mwdevice, unsigned char option, unsigned char *statrsp, int len);
+int mw_low_battery_bt_off_message(mwdevice_t *mwdevice);
 void mw_set_low_battery_bt_off_message_cb(mwdevice_t *mwdevice, void (*mw_low_battery_bt_off_message_cb) (mwdevice_t *mwdevice, void *user_data), void *user_data);
 
 int mw_enable_button(mwdevice_t *mwdevice, unsigned char mode, unsigned char button_index, unsigned char press_type, unsigned char callback_type, unsigned char callback_option);
 void mw_set_low_battery_bt_off_message_cb(mwdevice_t *mwdevice, void (*mw_low_battery_bt_off_message_cb) (mwdevice_t *mwdevice, void *user_data), void *user_data);
 
 int mw_enable_button(mwdevice_t *mwdevice, unsigned char mode, unsigned char button_index, unsigned char press_type, unsigned char callback_type, unsigned char callback_option);
index ca61057..a26950f 100644 (file)
@@ -75,6 +75,7 @@
 #define MW_RESERVED2                   0x45
 #define MW_ENABLE_BUTTON               0x46
 #define MW_DISABLE_BUTTON              0x47
 #define MW_RESERVED2                   0x45
 #define MW_ENABLE_BUTTON               0x46
 #define MW_DISABLE_BUTTON              0x47
+/* READ_BUTTON_* have been removed from the spec */
 #define MW_READ_BUTTON_CONFIG          0x48
 #define MW_READ_BUTTON_CONFIG_RSP      0x49
 #define MW_RESERVED3                   0x4a
 #define MW_READ_BUTTON_CONFIG          0x48
 #define MW_READ_BUTTON_CONFIG_RSP      0x49
 #define MW_RESERVED3                   0x4a
index fbe0ec8..b9a547c 100644 (file)
--- a/mw_main.c
+++ b/mw_main.c
@@ -533,6 +533,7 @@ void process_cmd(char *cmdline, int clinep, mwdata_t *mwdata)
                mw_configure_watch_mode(&mwdata->mwdevice, MW_SCREEN_MODE_IDLE, 0, 4, 1);
                mw_update_display(&mwdata->mwdevice, MW_SCREEN_MODE_IDLE, 0);
        }
                mw_configure_watch_mode(&mwdata->mwdevice, MW_SCREEN_MODE_IDLE, 0, 4, 1);
                mw_update_display(&mwdata->mwdevice, MW_SCREEN_MODE_IDLE, 0);
        }
+#if 0
        if (strncmp(cmdline, "rbtcfg", 6) == 0) {
                intopt = cmdline[7]-0x30;
                mdata[0] = 0; /* idle screen */
        if (strncmp(cmdline, "rbtcfg", 6) == 0) {
                intopt = cmdline[7]-0x30;
                mdata[0] = 0; /* idle screen */
@@ -543,6 +544,7 @@ void process_cmd(char *cmdline, int clinep, mwdata_t *mwdata)
                mdata[4] = 0; /* callback message option */
                mw_send_frame(&mwdata->mwdevice, MW_READ_BUTTON_CONFIG, 0, mdata, 5);
        }
                mdata[4] = 0; /* callback message option */
                mw_send_frame(&mwdata->mwdevice, MW_READ_BUTTON_CONFIG, 0, mdata, 5);
        }
+#endif
        if (strncmp(cmdline, "svib", 4) == 0) {
                mw_set_vibrate_mode(&mwdata->mwdevice, 1, 300, 300, 5);
        }
        if (strncmp(cmdline, "svib", 4) == 0) {
                mw_set_vibrate_mode(&mwdata->mwdevice, 1, 300, 300, 5);
        }