Removed dead code

This commit is contained in:
ml
2026-06-01 16:31:29 +02:00
parent d7adb56197
commit 724157aca3
8 changed files with 1 additions and 209 deletions
@@ -20,16 +20,9 @@ static void send_key_to_phone(const char *key_str) {
}
static void inbox_received_callback(DictionaryIterator *iterator, void *context) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "inbox_received_callback fired");
Tuple *time_tuple = dict_find(iterator, KEY_TIME);
if (time_tuple) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "KEY_TIME found, type=%d", (int)time_tuple->type);
} else {
APP_LOG(APP_LOG_LEVEL_WARNING, "KEY_TIME not found in message");
}
if (time_tuple && time_tuple->type == TUPLE_CSTRING) {
snprintf(s_time_buffer, sizeof(s_time_buffer), "%s", time_tuple->value->cstring);
APP_LOG(APP_LOG_LEVEL_DEBUG, "Setting time: %s", s_time_buffer);
text_layer_set_text(s_time_layer, s_time_buffer);
layer_mark_dirty(text_layer_get_layer(s_time_layer));
}
@@ -1,17 +1,11 @@
var SERVER = 'http://127.0.0.1:8888';
// Numeric keys matching the C enum: KEY_TIME=0, KEY_COMMAND=1
var KEY_TIME = 0;
var KEY_COMMAND = 1;
function httpGet(url) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.onload = function() {
if (xhr.status !== 200) {
console.log('[SuM] HTTP ' + xhr.status + ' for ' + url);
}
};
xhr.onerror = function() {
console.log('[SuM] request failed: ' + url);
};
@@ -22,16 +16,14 @@ function sendTimeToWatch() {
var xhr = new XMLHttpRequest();
xhr.open('GET', SERVER + '/time', true);
xhr.onload = function() {
console.log('[SuM] /time response: ' + xhr.status + ' ' + xhr.responseText);
if (xhr.status === 200) {
try {
var data = JSON.parse(xhr.responseText);
var msg = {};
msg[KEY_TIME] = data.time;
console.log('[SuM] sendAppMessage key=' + KEY_TIME + ' value=' + data.time);
Pebble.sendAppMessage(
msg,
function() { console.log('[SuM] sendAppMessage ok'); },
function() {},
function(e) { console.log('[SuM] sendAppMessage failed: ' + JSON.stringify(e)); }
);
} catch (err) {
@@ -46,13 +38,11 @@ function sendTimeToWatch() {
}
Pebble.addEventListener('ready', function() {
console.log('[SuM] PebbleKit JS ready');
setInterval(sendTimeToWatch, 1000);
});
Pebble.addEventListener('appmessage', function(e) {
var command = e.payload[KEY_COMMAND];
if (!command) { return; }
console.log('[SuM] key: ' + command);
httpGet(SERVER + '/key?cmd=' + encodeURIComponent(command));
});