Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rockodi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CeRiAl
rockodi
Commits
0c2cbc50
Commit
0c2cbc50
authored
Apr 01, 2015
by
Douglas6
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add username and password
parent
28b77933
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
209 additions
and
92 deletions
+209
-92
appinfo.json
appinfo.json
+57
-57
addons.c
src/addons.c
+0
-1
basic_menu_layer.c
src/basic_menu_layer.c
+10
-1
common.c
src/common.c
+3
-3
common.h
src/common.h
+2
-2
config.c
src/config.c
+54
-0
config.h
src/config.h
+23
-0
pebble-js-app.js
src/pebble-js-app.js
+60
-23
player.c
src/player.c
+0
-4
playlists.c
src/playlists.c
+0
-1
No files found.
appinfo.json
View file @
0c2cbc50
{
"appKeys"
:
{
"MSG_KEY_ARTIST"
:
102
,
"MSG_KEY_CMD"
:
0
,
"MSG_KEY_CMD_DATA"
:
1
,
"MSG_KEY_VOLUME"
:
100
,
"MSG_KEY_TITLE"
:
101
,
"MSG_KEY_ARTIST"
:
102
,
"MSG_KEY_MUTED"
:
104
,
"MSG_KEY_PLAY_STATE"
:
103
,
"MSG_KEY_MUTED"
:
104
"MSG_KEY_TITLE"
:
101
,
"MSG_KEY_VOLUME"
:
100
},
"capabilities"
:
[
"configurable"
...
...
@@ -17,134 +17,134 @@
"resources"
:
{
"media"
:
[
{
"file"
:
"images/
pics
.png"
,
"name"
:
"ICON_
PICS
"
,
"file"
:
"images/
ff
.png"
,
"name"
:
"ICON_
FF
"
,
"type"
:
"png"
},
{
"file"
:
"images/
info
.png"
,
"name"
:
"ICON_
INFO
"
,
"file"
:
"images/
rev
.png"
,
"name"
:
"ICON_
REV
"
,
"type"
:
"png"
},
{
"file"
:
"images/weather.png"
,
"name"
:
"ICON_WEATHER"
,
"file"
:
"images/rockodi.png"
,
"menuIcon"
:
true
,
"name"
:
"ICON_ROCKODI"
,
"type"
:
"png"
},
{
"file"
:
"images/
video
.png"
,
"name"
:
"ICON_
VIDEO
"
,
"file"
:
"images/
play
.png"
,
"name"
:
"ICON_
PLAY
"
,
"type"
:
"png"
},
{
"file"
:
"images/
home
.png"
,
"name"
:
"ICON_
HOME
"
,
"file"
:
"images/
down
.png"
,
"name"
:
"ICON_
DOWN
"
,
"type"
:
"png"
},
{
"file"
:
"images/
full
.png"
,
"name"
:
"ICON_
FULL
"
,
"file"
:
"images/
up
.png"
,
"name"
:
"ICON_
UP
"
,
"type"
:
"png"
},
{
"file"
:
"images/
goto
.png"
,
"name"
:
"ICON_
GOTO
"
,
"file"
:
"images/
check
.png"
,
"name"
:
"ICON_
CHECK
"
,
"type"
:
"png"
},
{
"file"
:
"images/
list
.png"
,
"name"
:
"ICON_
LIST
"
,
"file"
:
"images/
cursor_down
.png"
,
"name"
:
"ICON_
CURSOR_DOWN
"
,
"type"
:
"png"
},
{
"file"
:
"images/
button
.png"
,
"name"
:
"ICON_
BUTTON
"
,
"file"
:
"images/
cursor_up
.png"
,
"name"
:
"ICON_
CURSOR_UP
"
,
"type"
:
"png"
},
{
"file"
:
"images/
vol_up
.png"
,
"name"
:
"ICON_
VOL_UP
"
,
"file"
:
"images/
pause
.png"
,
"name"
:
"ICON_
PAUSE
"
,
"type"
:
"png"
},
{
"file"
:
"images/
vol_dn
.png"
,
"name"
:
"ICON_
VOL_DN
"
,
"file"
:
"images/
speaker
.png"
,
"name"
:
"ICON_
SPEAKER
"
,
"type"
:
"png"
},
{
"file"
:
"images/
power
.png"
,
"name"
:
"ICON_
POWER
"
,
"file"
:
"images/
addons
.png"
,
"name"
:
"ICON_
ADDONS
"
,
"type"
:
"png"
},
{
"file"
:
"images/
player
.png"
,
"name"
:
"ICON_
PLAYER
"
,
"file"
:
"images/
remote
.png"
,
"name"
:
"ICON_
REMOTE
"
,
"type"
:
"png"
},
{
"file"
:
"images/
remote
.png"
,
"name"
:
"ICON_
REMOTE
"
,
"file"
:
"images/
player
.png"
,
"name"
:
"ICON_
PLAYER
"
,
"type"
:
"png"
},
{
"file"
:
"images/
addons
.png"
,
"name"
:
"ICON_
ADDONS
"
,
"file"
:
"images/
power
.png"
,
"name"
:
"ICON_
POWER
"
,
"type"
:
"png"
},
{
"file"
:
"images/
speaker
.png"
,
"name"
:
"ICON_
SPEAKER
"
,
"file"
:
"images/
vol_dn
.png"
,
"name"
:
"ICON_
VOL_DN
"
,
"type"
:
"png"
},
{
"file"
:
"images/
pause
.png"
,
"name"
:
"ICON_
PAUSE
"
,
"file"
:
"images/
vol_up
.png"
,
"name"
:
"ICON_
VOL_UP
"
,
"type"
:
"png"
},
{
"file"
:
"images/
cursor_up
.png"
,
"name"
:
"ICON_
CURSOR_UP
"
,
"file"
:
"images/
button
.png"
,
"name"
:
"ICON_
BUTTON
"
,
"type"
:
"png"
},
{
"file"
:
"images/
cursor_down
.png"
,
"name"
:
"ICON_
CURSOR_DOWN
"
,
"file"
:
"images/
list
.png"
,
"name"
:
"ICON_
LIST
"
,
"type"
:
"png"
},
{
"file"
:
"images/
check
.png"
,
"name"
:
"ICON_
CHECK
"
,
"file"
:
"images/
goto
.png"
,
"name"
:
"ICON_
GOTO
"
,
"type"
:
"png"
},
{
"file"
:
"images/
up
.png"
,
"name"
:
"ICON_
UP
"
,
"file"
:
"images/
full
.png"
,
"name"
:
"ICON_
FULL
"
,
"type"
:
"png"
},
{
"file"
:
"images/
down
.png"
,
"name"
:
"ICON_
DOWN
"
,
"file"
:
"images/
home
.png"
,
"name"
:
"ICON_
HOME
"
,
"type"
:
"png"
},
{
"file"
:
"images/
play
.png"
,
"name"
:
"ICON_
PLAY
"
,
"file"
:
"images/
video
.png"
,
"name"
:
"ICON_
VIDEO
"
,
"type"
:
"png"
},
{
"file"
:
"images/rockodi.png"
,
"menuIcon"
:
true
,
"name"
:
"ICON_ROCKODI"
,
"file"
:
"images/weather.png"
,
"name"
:
"ICON_WEATHER"
,
"type"
:
"png"
},
{
"file"
:
"images/
rev
.png"
,
"name"
:
"ICON_
REV
"
,
"file"
:
"images/
info
.png"
,
"name"
:
"ICON_
INFO
"
,
"type"
:
"png"
},
{
"file"
:
"images/
ff
.png"
,
"name"
:
"ICON_
FF
"
,
"file"
:
"images/
pics
.png"
,
"name"
:
"ICON_
PICS
"
,
"type"
:
"png"
}
]
...
...
src/addons.c
View file @
0c2cbc50
...
...
@@ -61,7 +61,6 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context)
t
=
dict_read_next
(
iterator
);
}
int
items_size
=
dict_write_end
(
&
items_iter
);
DEBUG
(
"Size of the written buffer is %d bytes."
,
items_size
);
load_menu
();
}
...
...
src/basic_menu_layer.c
View file @
0c2cbc50
...
...
@@ -70,12 +70,20 @@ static int16_t menu_get_header_height_cb(MenuLayer *menu_layer, uint16_t section
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
)
{
// graphics_context_set_fill_color(ctx, GColorBlack);
BasicMenuModel
*
model
=
(
BasicMenuModel
*
)
data
;
GRect
bounds
=
layer_get_frame
(
cell_layer
);
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
;
if
(
icon
!=
NULL
)
{
offset
=
44
;
...
...
@@ -100,6 +108,7 @@ BasicMenuLayer* basic_menu_layer_create(GRect rect, BasicMenuModel* model) {
.
draw_header
=
menu_draw_header_cb
,
.
draw_row
=
menu_draw_row_cb
,
.
select_click
=
menu_select_cb
,
.
get_separator_height
=
menu_get_separator_height_cb
,
});
return
layer
;
...
...
src/common.c
View file @
0c2cbc50
...
...
@@ -26,7 +26,7 @@ void outbox_send(char* send_cmd){
DictionaryIterator
*
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_end
(
iter
);
...
...
@@ -37,9 +37,9 @@ void outbox_send_with_data(char* send_cmd, char* send_data){
DictionaryIterator
*
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
);
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_end
(
iter
);
...
...
src/common.h
View file @
0c2cbc50
...
...
@@ -19,8 +19,8 @@
// THE SOFTWARE.
//
#pragma once
#define MSG_KEY_
BUTTON_CODE
0
#define MSG_KEY_
BUTTON
_DATA 1
#define MSG_KEY_
CMD
0
#define MSG_KEY_
CMD
_DATA 1
#define MSG_KEY_VOLUME 100
#define MSG_KEY_TITLE 101
#define MSG_KEY_ARTIST 102
...
...
src/config.c
0 → 100644
View file @
0c2cbc50
// 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
);
}
src/config.h
0 → 100644
View file @
0c2cbc50
// 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
);
src/pebble-js-app.js
View file @
0c2cbc50
...
...
@@ -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
()},
1
e3
);
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
()},
1
e3
);
if
(
message
.
ack
){
message
.
ack
.
apply
(
null
,
arguments
)}}}}();
// global variables
var
ISDEBUG
=
true
;
var
g_server_url
=
"http://192.168.1.76"
;
var
g_user
;
var
g_password
;
var
storage_keys
=
{
"IP_ADDRESS"
:
0
,
"USERNAME"
:
1
,
"PASSWORD"
:
2
}
var
ISDEBUG
=
false
;
var
g_ip_address
=
""
;
var
g_username
=
""
;
var
g_password
=
""
;
var
g_player_id
;
var
g_player_type
;
var
g_volume
;
...
...
@@ -41,11 +47,14 @@ var JsonRpcRequest = function (method, params) {
};
function
sendJsonRequest
(
requests
,
callback
)
{
var
username
=
null
;
var
password
=
null
;
var
response
=
null
;
var
req
=
new
XMLHttpRequest
();
req
.
onload
=
function
(
e
)
{
if
(
req
.
readyState
==
4
&&
req
.
status
==
200
)
{
req
.
onreadystatechange
=
function
(
e
)
{
if
(
req
.
readyState
==
4
)
{
if
(
req
.
status
==
200
)
{
if
(
ISDEBUG
)
console
.
log
(
"Response text: "
+
req
.
responseText
);
response
=
JSON
.
parse
(
req
.
responseText
);
if
(
response
.
result
==
null
)
{
...
...
@@ -55,16 +64,25 @@ function sendJsonRequest(requests, callback) {
callback
(
response
.
result
);
}
}
}
else
{
if
(
req
.
status
!==
0
)
{
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
)
{
console
.
log
(
"Error connecting to Kodi"
);
};
var
url_string
=
g_server_url
+
"/jsonrpc?request="
;
req
.
open
(
'GET'
,
url_string
+
encodeURI
(
JSON
.
stringify
(
requests
)),
true
);
req
.
timeout
=
2000
;
if
(
g_username
!==
""
)
{
username
=
g_username
;
if
(
g_password
!==
""
)
{
password
=
g_password
;
}
}
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
);
if
(
ISDEBUG
)
console
.
log
(
"Sent request: "
+
url_string
);
if
(
ISDEBUG
)
console
.
log
(
"Sent request: "
+
url_string
+
encodeURI
(
JSON
.
stringify
(
requests
))
);
}
function
handleJsonRpcError
(
response
)
{
...
...
@@ -123,7 +141,6 @@ function getItemCb(result) {
}
else
{
artist
=
(
result
.
item
.
artist
.
length
<
1
)
?
""
:
result
.
item
.
artist
[
0
];
}
console
.
log
(
"Artist:"
+
artist
);
MessageQueue
.
sendAppMessage
({
"MSG_KEY_TITLE"
:
title
,
"MSG_KEY_ARTIST"
:
artist
});
}
function
playPause
()
{
...
...
@@ -226,7 +243,7 @@ function getMusicPlaylistsCb(result) {
MessageQueue
.
sendAppMessage
(
dict
);
}
function
playMusicPlaylist
(
payload
)
{
var
filename
=
payload
.
MSG_KEY_
BUTTON
_DATA
;
var
filename
=
payload
.
MSG_KEY_
CMD
_DATA
;
var
requests
=
[];
requests
.
push
(
new
JsonRpcRequest
(
"PlayList.Clear"
,
{
"playlistid"
:
0
}));
requests
.
push
(
new
JsonRpcRequest
(
"PlayList.Add"
,
{
"playlistid"
:
0
,
"item"
:{
"directory"
:
filename
,
"recursive"
:
true
}}));
...
...
@@ -249,7 +266,7 @@ function getAddonsCb(result) {
MessageQueue
.
sendAppMessage
(
dict
);
}
function
executeAddon
(
payload
)
{
var
addonid
=
payload
.
MSG_KEY_
BUTTON
_DATA
;
var
addonid
=
payload
.
MSG_KEY_
CMD
_DATA
;
sendJsonRequest
(
new
JsonRpcRequest
(
"Addons.ExecuteAddon"
,
{
"addonid"
:
addonid
}));
}
// Power methods
...
...
@@ -269,11 +286,31 @@ function systemSuspend() {
Pebble
.
addEventListener
(
'ready'
,
function
(
e
)
{
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"
,
function
(
e
)
{
var
cmd
=
e
.
payload
.
MSG_KEY_
BUTTON_CODE
;
var
cmd
=
e
.
payload
.
MSG_KEY_
CMD
;
switch
(
cmd
)
{
// Player messages
case
"GET_STATUS"
:
getStatus
();
break
;
...
...
src/player.c
View file @
0c2cbc50
...
...
@@ -79,23 +79,19 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context)
while
(
t
!=
NULL
)
{
switch
(
t
->
key
)
{
case
MSG_KEY_TITLE
:
DEBUG
(
"Adjusting title: %s"
,
t
->
value
->
cstring
);
strncpy
(
s_title
,
t
->
value
->
cstring
,
sizeof
(
s_title
));
text_layer_set_text
(
s_txt_title
,
s_title
);
break
;
case
MSG_KEY_ARTIST
:
DEBUG
(
"Adjusting artist: %s"
,
t
->
value
->
cstring
);
strncpy
(
s_artist
,
t
->
value
->
cstring
,
sizeof
(
s_artist
));
text_layer_set_text
(
s_txt_artist
,
s_artist
);
break
;
case
MSG_KEY_VOLUME
:
DEBUG
(
"Adjusting volume: %d"
,
(
int
)
t
->
value
->
int32
);
layer_data
=
(
uint32_t
*
)
layer_get_data
(
s_lyr_volume
);
*
layer_data
=
t
->
value
->
int32
;
layer_mark_dirty
(
s_lyr_volume
);
break
;
case
MSG_KEY_PLAY_STATE
:
DEBUG
(
"Adjusting play state: %d"
,
(
int
)
t
->
value
->
int32
);
if
(
t
->
value
->
int32
>
0
)
{
action_bar_layer_set_icon
(
s_action_bar
,
BUTTON_ID_SELECT
,
s_icon_pause
);
}
else
{
...
...
src/playlists.c
View file @
0c2cbc50
...
...
@@ -60,7 +60,6 @@ static void inbox_received_callback(DictionaryIterator *iterator, void *context)
t
=
dict_read_next
(
iterator
);
}
int
items_size
=
dict_write_end
(
&
items_iter
);
DEBUG
(
"Size of the written buffer is %d bytes."
,
items_size
);
load_menu
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment