Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit 4a79af2

Browse files
committed
v1 Complete
wow much rough such amaze
1 parent 9ebb763 commit 4a79af2

File tree

3 files changed

+50
-5
lines changed

3 files changed

+50
-5
lines changed

appinfo.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
{
22
"versionLabel": "1.0",
33
"uuid": "015f546b-4f84-4648-a956-cb846df7a820",
4-
"appKeys": {},
4+
"appKeys": {
5+
"value": 0
6+
},
57
"longName": "DogeWatch",
68
"versionCode": 1,
79
"capabilities": [
810
""
911
],
1012
"shortName": "DogeWatch",
11-
"companyName": "geekmaster",
13+
"companyName": "Ryan Morash",
1214
"watchapp": {
1315
"watchface": false
1416
},

src/js/pebble-js-app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ function getPrice() {
1616
if (req.readyState == 4) {
1717
if(req.status == 200) {
1818
var value;
19+
var output;
1920
rates = response = JSON.parse(req.responseText);
2021
value = response.value;
22+
output = "1 DOGE = " + value + " BTC";
2123
console.log("Asking price is " + value + ".");
24+
console.log(output);
2225
var message = {
23-
"value": value.toString()
26+
"value": output.toString()
2427
};
2528

2629
console.log("Sending...");

src/main.c

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,54 @@
33
Window *my_window;
44
TextLayer *text_layer;
55

6+
enum {
7+
value = 0
8+
};
9+
10+
void out_sent_handler(DictionaryIterator *sent, void *context) {
11+
// outgoing message was delivered
12+
}
13+
14+
15+
void out_failed_handler(DictionaryIterator *failed, AppMessageResult reason, void *context) {
16+
// outgoing message failed
17+
}
18+
19+
20+
void in_received_handler(DictionaryIterator *received, void *context) {
21+
// incoming message received
22+
23+
// Check for fields you expect to receive
24+
Tuple *text_tuple = dict_find(received, value);
25+
26+
// Act on the found fields received
27+
if (text_tuple) {
28+
text_layer_set_text(text_layer, text_tuple->value->cstring);
29+
}
30+
}
31+
32+
33+
void in_dropped_handler(AppMessageResult reason, void *context) {
34+
// incoming message dropped
35+
}
36+
637
void handle_init(void) {
38+
// Create window
739
my_window = window_create();
840
window_stack_push(my_window, true /* Animated */);
941
Layer *window_layer = window_get_root_layer(my_window);
1042
GRect bounds = layer_get_frame(window_layer);
11-
43+
// Initiate AppMessage
44+
app_message_register_inbox_received(in_received_handler);
45+
app_message_register_inbox_dropped(in_dropped_handler);
46+
app_message_register_outbox_sent(out_sent_handler);
47+
app_message_register_outbox_failed(out_failed_handler);
48+
const uint32_t inbound_size = 64;
49+
const uint32_t outbound_size = 64;
50+
app_message_open(inbound_size, outbound_size);
51+
//Create Text
1252
text_layer = text_layer_create((GRect){ .origin = { 0, 30 }, .size = bounds.size });
13-
text_layer_set_text(text_layer, "1 DOGE = 0.00000048 BTC");
53+
text_layer_set_text(text_layer, "1 DOGE = 0.00000000 BTC");
1454
text_layer_set_font(text_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_COMIC_SANS_25)));
1555
layer_add_child(window_layer, text_layer_get_layer(text_layer));
1656
}

0 commit comments

Comments
 (0)