Global Lender
A Pebble app for finding new and interesting loans on kiva.org
comm.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "data/KivaModel.h"
4 
5 typedef enum MsgKey {
10 
15 
17 
30 
32 } MsgKey;
33 
34 
35 
36 // UpdateViewClockHandler is a pointer to a function that takes a single
37 // parameter (struct tm pointer) and returns nothing.
38 typedef void (*UpdateViewClockHandler)(struct tm*);
39 
40 // UpdateViewDataHandler is a pointer to a function that takes a single
41 // parameter (const KivaModel pointer) and returns nothing.
42 typedef void (*UpdateViewDataHandler)(const KivaModel*);
43 
44 // CommHandlers is a struct that contains the values of the handlers.
45 typedef struct CommHandlers {
48 } CommHandlers;
49 
50 
51 bool comm_pebkitReady();
52 void comm_open();
53 void comm_close();
54 
55 void comm_sendMsgCstr(const MsgKey, const char* payload);
56 void comm_tickHandler(struct tm *tick_time, TimeUnits units_changed);
57 void comm_setHandlers(const CommHandlers);
58 
60 
61 
void comm_sendMsgCstr(const MsgKey, const char *payload)
Send data to PebbleKit.
Definition: comm.c:402
Definition: comm.h:11
Definition: comm.h:27
void comm_getPreferredLoans()
Requests PebbleKit to send a list of preferred loans for the lender.
Definition: comm.c:431
struct CommHandlers CommHandlers
void comm_close()
Closes communication and frees memory.
Definition: comm.c:508
Definition: comm.h:24
void comm_open()
Opens communication to PebbleKit and allocates memory.
Definition: comm.c:489
Definition: comm.h:9
Definition: comm.h:14
Definition: comm.h:25
Definition: comm.h:7
void(* UpdateViewDataHandler)(const KivaModel *)
Definition: comm.h:42
Definition: comm.h:6
Definition: comm.h:29
Definition: comm.h:18
void comm_setHandlers(const CommHandlers)
Set our callback handlers.
Definition: comm.c:481
void comm_tickHandler(struct tm *tick_time, TimeUnits units_changed)
Callback for TickTimerService.
Definition: comm.c:453
Definition: comm.h:31
Definition: comm.h:23
MsgKey
Definition: comm.h:5
Definition: comm.h:13
Definition: comm.h:45
Definition: comm.h:28
Definition: comm.h:12
Definition: comm.h:8
Definition: comm.h:16
Definition: comm.h:19
UpdateViewDataHandler updateViewData
Function that Comm calls to notify the View of a data model update.
Definition: comm.h:47
Definition: comm.h:22
Definition: comm.h:21
Definition: comm.h:26
Definition: comm.h:20
bool comm_pebkitReady()
Returns whether the communication channel is ready for sending.
Definition: comm.c:394
void(* UpdateViewClockHandler)(struct tm *)
Definition: comm.h:38
Definition: KivaModel_Internal.h:31
UpdateViewClockHandler updateViewClock
Function that Comm calls to notify the View of a clock update.
Definition: comm.h:46