Commit 0c2cbc50 authored by Douglas6's avatar Douglas6

add username and password

parent 28b77933
{ {
"appKeys": { "appKeys": {
"MSG_KEY_ARTIST": 102,
"MSG_KEY_CMD": 0, "MSG_KEY_CMD": 0,
"MSG_KEY_CMD_DATA": 1, "MSG_KEY_CMD_DATA": 1,
"MSG_KEY_VOLUME": 100, "MSG_KEY_MUTED": 104,
"MSG_KEY_TITLE": 101,
"MSG_KEY_ARTIST": 102,
"MSG_KEY_PLAY_STATE": 103, "MSG_KEY_PLAY_STATE": 103,
"MSG_KEY_MUTED": 104 "MSG_KEY_TITLE": 101,
"MSG_KEY_VOLUME": 100
}, },
"capabilities": [ "capabilities": [
"configurable" "configurable"
...@@ -17,134 +17,134 @@ ...@@ -17,134 +17,134 @@
"resources": { "resources": {
"media": [ "media": [
{ {
"file": "images/pics.png", "file": "images/ff.png",
"name": "ICON_PICS", "name": "ICON_FF",
"type": "png" "type": "png"
}, },
{ {
"file": "images/info.png", "file": "images/rev.png",
"name": "ICON_INFO", "name": "ICON_REV",
"type": "png" "type": "png"
}, },
{ {
"file": "images/weather.png", "file": "images/rockodi.png",
"name": "ICON_WEATHER", "menuIcon": true,
"name": "ICON_ROCKODI",
"type": "png" "type": "png"
}, },
{ {
"file": "images/video.png", "file": "images/play.png",
"name": "ICON_VIDEO", "name": "ICON_PLAY",
"type": "png" "type": "png"
}, },
{ {
"file": "images/home.png", "file": "images/down.png",
"name": "ICON_HOME", "name": "ICON_DOWN",
"type": "png" "type": "png"
}, },
{ {
"file": "images/full.png", "file": "images/up.png",
"name": "ICON_FULL", "name": "ICON_UP",
"type": "png" "type": "png"
}, },
{ {
"file": "images/goto.png", "file": "images/check.png",
"name": "ICON_GOTO", "name": "ICON_CHECK",
"type": "png" "type": "png"
}, },
{ {
"file": "images/list.png", "file": "images/cursor_down.png",
"name": "ICON_LIST", "name": "ICON_CURSOR_DOWN",
"type": "png" "type": "png"
}, },
{ {
"file": "images/button.png", "file": "images/cursor_up.png",
"name": "ICON_BUTTON", "name": "ICON_CURSOR_UP",
"type": "png" "type": "png"
}, },
{ {
"file": "images/vol_up.png", "file": "images/pause.png",
"name": "ICON_VOL_UP", "name": "ICON_PAUSE",
"type": "png" "type": "png"
}, },
{ {
"file": "images/vol_dn.png", "file": "images/speaker.png",
"name": "ICON_VOL_DN", "name": "ICON_SPEAKER",
"type": "png" "type": "png"
}, },
{ {
"file": "images/power.png", "file": "images/addons.png",
"name": "ICON_POWER", "name": "ICON_ADDONS",
"type": "png" "type": "png"
}, },
{ {
"file": "images/player.png", "file": "images/remote.png",
"name": "ICON_PLAYER", "name": "ICON_REMOTE",
"type": "png" "type": "png"
}, },
{ {
"file": "images/remote.png", "file": "images/player.png",
"name": "ICON_REMOTE", "name": "ICON_PLAYER",
"type": "png" "type": "png"
}, },
{ {
"file": "images/addons.png", "file": "images/power.png",
"name": "ICON_ADDONS", "name": "ICON_POWER",
"type": "png" "type": "png"
}, },
{ {
"file": "images/speaker.png", "file": "images/vol_dn.png",
"name": "ICON_SPEAKER", "name": "ICON_VOL_DN",
"type": "png" "type": "png"
}, },
{ {
"file": "images/pause.png", "file": "images/vol_up.png",
"name": "ICON_PAUSE", "name": "ICON_VOL_UP",
"type": "png" "type": "png"
}, },
{ {
"file": "images/cursor_up.png", "file": "images/button.png",
"name": "ICON_CURSOR_UP", "name": "ICON_BUTTON",
"type": "png" "type": "png"
}, },
{ {
"file": "images/cursor_down.png", "file": "images/list.png",
"name": "ICON_CURSOR_DOWN", "name": "ICON_LIST",
"type": "png" "type": "png"
}, },
{ {
"file": "images/check.png", "file": "images/goto.png",
"name": "ICON_CHECK", "name": "ICON_GOTO",
"type": "png" "type": "png"
}, },
{ {
"file": "images/up.png", "file": "images/full.png",
"name": "ICON_UP", "name": "ICON_FULL",
"type": "png" "type": "png"
}, },
{ {
"file": "images/down.png", "file": "images/home.png",
"name": "ICON_DOWN", "name": "ICON_HOME",
"type": "png" "type": "png"
}, },
{ {
"file": "images/play.png", "file": "images/video.png",
"name": "ICON_PLAY", "name": "ICON_VIDEO",
"type": "png" "type": "png"
}, },
{ {
"file": "images/rockodi.png", "file": "images/weather.png",
"menuIcon": true, "name": "ICON_WEATHER",
"name": "ICON_ROCKODI",
"type": "png" "type": "png"
}, },
{ {
"file": "images/rev.png", "file": "images/info.png",
"name": "ICON_REV", "name": "ICON_INFO",
"type": "png" "type": "png"
}, },
{ {
"file": "images/ff.png", "file": "images/pics.png",
"name": "ICON_FF", "name": "ICON_PICS",
"type": "png" "type": "png"
} }
] ]
......
...@@ -61,7 +61,6 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context) ...@@ -61,7 +61,6 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context)
t = dict_read_next(iterator); t = dict_read_next(iterator);
} }
int items_size = dict_write_end(&items_iter); int items_size = dict_write_end(&items_iter);
DEBUG("Size of the written buffer is %d bytes.", items_size);
load_menu(); load_menu();
} }
......
...@@ -70,11 +70,19 @@ static int16_t menu_get_header_height_cb(MenuLayer *menu_layer, uint16_t section ...@@ -70,11 +70,19 @@ static int16_t menu_get_header_height_cb(MenuLayer *menu_layer, uint16_t section
return 0; return 0;
} }
static int16_t menu_get_separator_height_cb(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) {
return 0;
}
static void menu_draw_row_cb(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) { static void menu_draw_row_cb(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) {
// graphics_context_set_fill_color(ctx, GColorBlack);
BasicMenuModel *model = (BasicMenuModel*) data; BasicMenuModel *model = (BasicMenuModel*) data;
GRect bounds = layer_get_frame(cell_layer); GRect bounds = layer_get_frame(cell_layer);
GBitmap *icon = model->items[cell_index->row]->icon; GBitmap *icon = model->items[cell_index->row]->icon;
graphics_context_set_fill_color(ctx, GColorWhite);
graphics_fill_rect(ctx, GRect(0, 0, bounds.size.w, bounds.size.h), 12, GCornersAll);
graphics_context_set_fill_color(ctx, GColorBlack);
graphics_fill_rect(ctx, GRect(1, 1, bounds.size.w - 2, bounds.size.h - 2), 12, GCornersAll);
int offset = 4; int offset = 4;
if (icon != NULL) { if (icon != NULL) {
...@@ -100,6 +108,7 @@ BasicMenuLayer* basic_menu_layer_create(GRect rect, BasicMenuModel* model) { ...@@ -100,6 +108,7 @@ BasicMenuLayer* basic_menu_layer_create(GRect rect, BasicMenuModel* model) {
.draw_header = menu_draw_header_cb, .draw_header = menu_draw_header_cb,
.draw_row = menu_draw_row_cb, .draw_row = menu_draw_row_cb,
.select_click = menu_select_cb, .select_click = menu_select_cb,
.get_separator_height = menu_get_separator_height_cb,
}); });
return layer; return layer;
......
...@@ -26,7 +26,7 @@ void outbox_send(char* send_cmd){ ...@@ -26,7 +26,7 @@ void outbox_send(char* send_cmd){
DictionaryIterator *iter; DictionaryIterator *iter;
app_message_outbox_begin(&iter); app_message_outbox_begin(&iter);
Tuplet value = TupletCString(MSG_KEY_BUTTON_CODE, send_cmd); Tuplet value = TupletCString(MSG_KEY_CMD, send_cmd);
dict_write_tuplet(iter, &value); dict_write_tuplet(iter, &value);
dict_write_end(iter); dict_write_end(iter);
...@@ -37,9 +37,9 @@ void outbox_send_with_data(char* send_cmd, char* send_data){ ...@@ -37,9 +37,9 @@ void outbox_send_with_data(char* send_cmd, char* send_data){
DictionaryIterator *iter; DictionaryIterator *iter;
app_message_outbox_begin(&iter); app_message_outbox_begin(&iter);
Tuplet code = TupletCString(MSG_KEY_BUTTON_CODE, send_cmd); Tuplet code = TupletCString(MSG_KEY_CMD, send_cmd);
dict_write_tuplet(iter, &code); dict_write_tuplet(iter, &code);
Tuplet data = TupletCString(MSG_KEY_BUTTON_DATA, send_data); Tuplet data = TupletCString(MSG_KEY_CMD_DATA, send_data);
dict_write_tuplet(iter, &data); dict_write_tuplet(iter, &data);
dict_write_end(iter); dict_write_end(iter);
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
// THE SOFTWARE. // THE SOFTWARE.
// //
#pragma once #pragma once
#define MSG_KEY_BUTTON_CODE 0 #define MSG_KEY_CMD 0
#define MSG_KEY_BUTTON_DATA 1 #define MSG_KEY_CMD_DATA 1
#define MSG_KEY_VOLUME 100 #define MSG_KEY_VOLUME 100
#define MSG_KEY_TITLE 101 #define MSG_KEY_TITLE 101
#define MSG_KEY_ARTIST 102 #define MSG_KEY_ARTIST 102
......
// Copyright (c) 2015 Douglas Otwell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#include <pebble.h>
#include "config.h"
#include "common.h"
static Window *s_window;
static void initialize_ui(void) {
s_window = window_create();
window_set_fullscreen(s_window, false);
window_set_background_color(s_window, GColorBlack);
Layer *window_layer = window_get_root_layer(s_window);
GRect bounds = layer_get_frame(window_layer);
}
static void destroy_ui() {
window_destroy(s_window);
}
static void handle_window_unload(Window* window) {
destroy_ui();
}
void show_config(void) {
initialize_ui();
window_set_window_handlers(s_window, (WindowHandlers) {
.unload = handle_window_unload,
});
window_stack_push(s_window, true);
}
void hide_config(void) {
window_stack_remove(s_window, true);
}
// Copyright (c) 2015 Douglas Otwell
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#pragma once
void show_config(void);
void hide_config(void);
...@@ -23,10 +23,16 @@ ...@@ -23,10 +23,16 @@
// //
var MessageQueue=function(){var RETRY_MAX=5;var queue=[];var sending=false;var timer=null;return{reset:reset,sendAppMessage:sendAppMessage,size:size};function reset(){queue=[];sending=false}function sendAppMessage(message,ack,nack){if(!isValidMessage(message)){return false}queue.push({message:message,ack:ack||null,nack:nack||null,attempts:0});setTimeout(function(){sendNextMessage()},1);return true}function size(){return queue.length}function isValidMessage(message){if(message!==Object(message)){return false}var keys=Object.keys(message);if(!keys.length){return false}for(var k=0;k<keys.length;k+=1){var validKey=/^[0-9a-zA-Z-_]*$/.test(keys[k]);if(!validKey){return false}var value=message[keys[k]];if(!validValue(value)){return false}}return true;function validValue(value){switch(typeof value){case"string":return true;case"number":return true;case"object":if(toString.call(value)=="[object Array]"){return true}}return false}}function sendNextMessage(){if(sending){return}var message=queue.shift();if(!message){return}message.attempts+=1;sending=true;Pebble.sendAppMessage(message.message,ack,nack);timer=setTimeout(function(){timeout()},1e3);function ack(){clearTimeout(timer);setTimeout(function(){sending=false;sendNextMessage()},200);if(message.ack){message.ack.apply(null,arguments)}}function nack(){clearTimeout(timer);if(message.attempts<RETRY_MAX){queue.unshift(message);setTimeout(function(){sending=false;sendNextMessage()},200*message.attempts)}else{if(message.nack){message.nack.apply(null,arguments)}}}function timeout(){setTimeout(function(){sending=false;sendNextMessage()},1e3);if(message.ack){message.ack.apply(null,arguments)}}}}(); var MessageQueue=function(){var RETRY_MAX=5;var queue=[];var sending=false;var timer=null;return{reset:reset,sendAppMessage:sendAppMessage,size:size};function reset(){queue=[];sending=false}function sendAppMessage(message,ack,nack){if(!isValidMessage(message)){return false}queue.push({message:message,ack:ack||null,nack:nack||null,attempts:0});setTimeout(function(){sendNextMessage()},1);return true}function size(){return queue.length}function isValidMessage(message){if(message!==Object(message)){return false}var keys=Object.keys(message);if(!keys.length){return false}for(var k=0;k<keys.length;k+=1){var validKey=/^[0-9a-zA-Z-_]*$/.test(keys[k]);if(!validKey){return false}var value=message[keys[k]];if(!validValue(value)){return false}}return true;function validValue(value){switch(typeof value){case"string":return true;case"number":return true;case"object":if(toString.call(value)=="[object Array]"){return true}}return false}}function sendNextMessage(){if(sending){return}var message=queue.shift();if(!message){return}message.attempts+=1;sending=true;Pebble.sendAppMessage(message.message,ack,nack);timer=setTimeout(function(){timeout()},1e3);function ack(){clearTimeout(timer);setTimeout(function(){sending=false;sendNextMessage()},200);if(message.ack){message.ack.apply(null,arguments)}}function nack(){clearTimeout(timer);if(message.attempts<RETRY_MAX){queue.unshift(message);setTimeout(function(){sending=false;sendNextMessage()},200*message.attempts)}else{if(message.nack){message.nack.apply(null,arguments)}}}function timeout(){setTimeout(function(){sending=false;sendNextMessage()},1e3);if(message.ack){message.ack.apply(null,arguments)}}}}();
// global variables // global variables
var ISDEBUG = true;
var g_server_url = "http://192.168.1.76"; var storage_keys = {
var g_user; "IP_ADDRESS": 0,
var g_password; "USERNAME": 1,
"PASSWORD": 2
}
var ISDEBUG = false;
var g_ip_address = "";
var g_username = "";
var g_password = "";
var g_player_id; var g_player_id;
var g_player_type; var g_player_type;
var g_volume; var g_volume;
...@@ -41,30 +47,42 @@ var JsonRpcRequest = function (method, params) { ...@@ -41,30 +47,42 @@ var JsonRpcRequest = function (method, params) {
}; };
function sendJsonRequest(requests, callback) { function sendJsonRequest(requests, callback) {
var username = null;
var password = null;
var response = null; var response = null;
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();
req.onload = function(e) { req.onreadystatechange = function(e) {
if (req.readyState == 4 && req.status == 200) { if (req.readyState == 4) {
if (ISDEBUG) console.log("Response text: "+req.responseText); if (req.status == 200) {
response = JSON.parse(req.responseText); if (ISDEBUG) console.log("Response text: "+req.responseText);
if (response.result == null) { response = JSON.parse(req.responseText);
handleJsonRpcError(response); if (response.result == null) {
handleJsonRpcError(response);
} else {
if (callback != null) {
callback(response.result);
}
}
} else { } else {
if (callback != null) { if (req.status !== 0) {
callback(response.result); console.log("Error connecting ["+req.status+"]: "+req.statusText);
Pebble.showSimpleNotificationOnPebble("Could not connect ["+req.status+"]", "Please check your Rockodi settings in the Pebble app.");
} }
} }
} }
}; };
req.onerror = function(e) { if (g_username !== "") {
console.log("Error connecting to Kodi"); username = g_username;
}; if (g_password !== "") {
var url_string = g_server_url+"/jsonrpc?request="; password = g_password;
req.open('GET', url_string+encodeURI(JSON.stringify(requests)), true); }
req.timeout = 2000; }
var url_string = "http://"+g_ip_address+"/jsonrpc?request=";
req.open('GET', url_string+encodeURI(JSON.stringify(requests)), true, username, password);
req.timeout = 4000;
req.send(null); req.send(null);
if (ISDEBUG) console.log("Sent request: "+url_string); if (ISDEBUG) console.log("Sent request: "+url_string+encodeURI(JSON.stringify(requests)));
} }
function handleJsonRpcError(response) { function handleJsonRpcError(response) {
...@@ -123,7 +141,6 @@ function getItemCb(result) { ...@@ -123,7 +141,6 @@ function getItemCb(result) {
} else { } else {
artist = (result.item.artist.length < 1) ? "" : result.item.artist[0]; artist = (result.item.artist.length < 1) ? "" : result.item.artist[0];
} }
console.log("Artist:"+artist);
MessageQueue.sendAppMessage({"MSG_KEY_TITLE":title,"MSG_KEY_ARTIST":artist}); MessageQueue.sendAppMessage({"MSG_KEY_TITLE":title,"MSG_KEY_ARTIST":artist});
} }
function playPause() { function playPause() {
...@@ -226,7 +243,7 @@ function getMusicPlaylistsCb(result) { ...@@ -226,7 +243,7 @@ function getMusicPlaylistsCb(result) {
MessageQueue.sendAppMessage(dict); MessageQueue.sendAppMessage(dict);
} }
function playMusicPlaylist(payload) { function playMusicPlaylist(payload) {
var filename = payload.MSG_KEY_BUTTON_DATA; var filename = payload.MSG_KEY_CMD_DATA;
var requests = []; var requests = [];
requests.push(new JsonRpcRequest("PlayList.Clear", {"playlistid": 0})); requests.push(new JsonRpcRequest("PlayList.Clear", {"playlistid": 0}));
requests.push(new JsonRpcRequest("PlayList.Add", {"playlistid":0, "item":{"directory":filename,"recursive":true}})); requests.push(new JsonRpcRequest("PlayList.Add", {"playlistid":0, "item":{"directory":filename,"recursive":true}}));
...@@ -249,7 +266,7 @@ function getAddonsCb(result) { ...@@ -249,7 +266,7 @@ function getAddonsCb(result) {
MessageQueue.sendAppMessage(dict); MessageQueue.sendAppMessage(dict);
} }
function executeAddon(payload) { function executeAddon(payload) {
var addonid = payload.MSG_KEY_BUTTON_DATA; var addonid = payload.MSG_KEY_CMD_DATA;
sendJsonRequest(new JsonRpcRequest("Addons.ExecuteAddon", {"addonid": addonid})); sendJsonRequest(new JsonRpcRequest("Addons.ExecuteAddon", {"addonid": addonid}));
} }
// Power methods // Power methods
...@@ -269,11 +286,31 @@ function systemSuspend() { ...@@ -269,11 +286,31 @@ function systemSuspend() {
Pebble.addEventListener('ready', Pebble.addEventListener('ready',
function(e) { function(e) {
console.log('Rockodi copyright (c) 2015, Douglas Otwell'); console.log('Rockodi copyright (c) 2015, Douglas Otwell');
g_ip_address = localStorage.getItem(storage_keys.IP_ADDRESS);
g_username = localStorage.getItem(storage_keys.USERNAME);
g_password = localStorage.getItem(storage_keys.PASSWORD);
}
);
Pebble.addEventListener('showConfiguration', function(e) {
var query_string = encodeURI("?ip_address="+g_ip_address+"&username="+g_username+"&password="+g_password);
Pebble.openURL('http://www.dkographicdetails.com/rockodi/config/config-page.html'+query_string);
});
Pebble.addEventListener('webviewclosed',
function(e) {
var configuration = JSON.parse(decodeURIComponent(e.response));
if (typeof configuration.ip_address !== "undefined") {
localStorage.setItem(storage_keys.IP_ADDRESS, configuration.ip_address);
localStorage.setItem(storage_keys.USERNAME, configuration.username);
localStorage.setItem(storage_keys.PASSWORD, configuration.password);
g_ip_address = localStorage.getItem(storage_keys.IP_ADDRESS);
g_username = localStorage.getItem(storage_keys.USERNAME);
g_password = localStorage.getItem(storage_keys.PASSWORD);
}
} }
); );
Pebble.addEventListener("appmessage", Pebble.addEventListener("appmessage",
function(e) { function(e) {
var cmd = e.payload.MSG_KEY_BUTTON_CODE; var cmd = e.payload.MSG_KEY_CMD;
switch(cmd) { switch(cmd) {
// Player messages // Player messages
case "GET_STATUS": getStatus(); break; case "GET_STATUS": getStatus(); break;
......
...@@ -79,23 +79,19 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context) ...@@ -79,23 +79,19 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context)
while(t != NULL) { while(t != NULL) {
switch(t->key) { switch(t->key) {
case MSG_KEY_TITLE: case MSG_KEY_TITLE:
DEBUG("Adjusting title: %s", t->value->cstring);
strncpy(s_title, t->value->cstring, sizeof(s_title)); strncpy(s_title, t->value->cstring, sizeof(s_title));
text_layer_set_text(s_txt_title, s_title); text_layer_set_text(s_txt_title, s_title);
break; break;
case MSG_KEY_ARTIST: case MSG_KEY_ARTIST:
DEBUG("Adjusting artist: %s", t->value->cstring);
strncpy(s_artist, t->value->cstring, sizeof(s_artist)); strncpy(s_artist, t->value->cstring, sizeof(s_artist));
text_layer_set_text(s_txt_artist, s_artist); text_layer_set_text(s_txt_artist, s_artist);
break; break;
case MSG_KEY_VOLUME: case MSG_KEY_VOLUME:
DEBUG("Adjusting volume: %d", (int) t->value->int32);
layer_data = (uint32_t *)layer_get_data(s_lyr_volume); layer_data = (uint32_t *)layer_get_data(s_lyr_volume);
*layer_data = t->value->int32; *layer_data = t->value->int32;
layer_mark_dirty(s_lyr_volume); layer_mark_dirty(s_lyr_volume);
break; break;
case MSG_KEY_PLAY_STATE: case MSG_KEY_PLAY_STATE:
DEBUG("Adjusting play state: %d", (int) t->value->int32);
if (t->value->int32 > 0) { if (t->value->int32 > 0) {
action_bar_layer_set_icon(s_action_bar, BUTTON_ID_SELECT, s_icon_pause); action_bar_layer_set_icon(s_action_bar, BUTTON_ID_SELECT, s_icon_pause);
} else { } else {
......
...@@ -60,7 +60,6 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context) ...@@ -60,7 +60,6 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context)
t = dict_read_next(iterator); t = dict_read_next(iterator);
} }
int items_size = dict_write_end(&items_iter); int items_size = dict_write_end(&items_iter);
DEBUG("Size of the written buffer is %d bytes.", items_size);
load_menu(); load_menu();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment