-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathprotocol.txt
227 lines (189 loc) · 9.34 KB
/
protocol.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
First byte (dictionary entry 0) is always uint8 representing destination module on the phone
Second byte (dictionary entry 1) is always uint8 representing packet id for that module
Pebble --> Phone
MODULE 0 - SYSTEM
Packet 0 - Init packet
Sent from Pebble when app is opened. Phone should respond to that by sending config.
Additional data:
2 = Watchapp version - uint16
3 = Watch capabilities - uint32
Bit 0 (0x01) - Does watch have microphone
Bit 1 (0x02) - Does watch have color screen
Bit 2 (0x04) - Does watch have round screen
Bit 3 (0x08) - Does watch support smartstraps
Bit 4 (0x10) - Does watch support Pebble Health
Bits 15-31 - Unsigned 16-bit integer representing number of maximum bytes that can fit into one appmessage
Packet 1 - Menu picked
Sent when user picks entry in main menu
Additional data:
2 = Picked entry (0 = Current, 1 = History) - uint8
Packet 2 - Config change
Send when Pebble wants to change config on the phone
Additional data:
2 = ID of the setting - uint8. Possible settings:
0: Disable notifications - value is 1 or 0
1: Disable vibration - value is 1 or 0
2: Clear history - value is gnored
3 = Value of the setting - uint8
Packet 3 - Close app
Informs android app that it should close watchapp or switch to previous app depending on settings.
Additional data:
2 = Whether NC app rejected the notifications because of the Quiet Time mode (uint8, 1 = yes, 0 = no)
MODULE 1 - NOTIFICATION SENDING
Packet 0 - Confirm notification received
Sent when Pebble has received new notification packet and wants text and other notification data.
2 = Unique notification id (int32)
MODULE 2 - NOTIFICATION LIST
Packet 0 - Request notification data at list index
Additional data:
2 = list position of entry - uint16
3 = Is this first request after the list was displayed (0 = No, 1 = Yes) - uint8
Packet 1 - Send notification at
Used when user double presses UP/DOWN on list notification
Additional data:
2 = list entry to send - uint16
Packet 2 - Send next notification
Used when user double presses UP/DOWN on list notification
Additional data:
2 = Next or previous (1 = Next, -1 = Previous) - int8
MODULE 4 - ACTIONS
Packet 0 - SELECT or SHAKE action
Sent when user presses SELECT button on notification
Additional data:
2 = Unique notification id (int32)
3 = Action type
0 - SELECT press
1 - SELECT hold
2 - SHAKE
Packet 2 - Action list item picked
Additional data:
2 = index of picked item - uint8
Packet 3 - Reply text
Additional data:
2 = text (string)
MODULE 5 - IMAGE (ONLY ON BASALT)
Packet 0 - Start sending image
2 = Unique notification id (int32)
Phone --> Pebble
If dictionary entry 999 is present, pebble will automatically switch to destination module (for example automatically switch to list when receiving entries).
This is used on both new notification packet and first notification list data packet
MODULE 0 - SYSTEM
Packet 0 - Pebble settings (Invalid Version)
Sent instead of the regular settings packet if watchapp protocol version mismatches phone protocol version
Additional data:
2 = Config (byte array)
[8] = Compatible watchapp version (first byte)
[9] = Compatible watchapp version (second byte)
Packet 0 - Pebble settings
Sends all settings to Pebble
Additional data:
2 = Config (byte array)
[3] = Timeout in seconds (first byte)
[4] = Timeout in seconds (second byte)
[5] = Light timeout in seconds
[7] = Flags
First bit (0x01) = Vibration enabled
Second bit (0x02) = Display closing screen (needed for "switch to last app" feature)
Third bit (0x04) = Is active notifications menu supported?
Fourth bit (0x08) = Is there notification waiting
Fifth bit (0x10) = Enable LCD light when notification arrives
Sixth bit (0x20) = Don't vibrate when charging
Seventh bit (0x40) = Inverse mode
Eight bit (0x80) = Enable notifications
[8] = Compatible watchapp version (first byte)
[9] = Compatible watchapp version (second byte)
[11] = Periodic vibration timeout in seconds (first byte)
[12] = Periodic vibration timeout in seconds (second byte)
[13] = Second flags byte
First bit (0x01) = Display scroll shadow
Second bit (0x02) = Scroll page-by-page
Third bit (0x04) = Display disconnected notification
Fourth bit (0x08) = Enable gestures
Fifth bit (0x10) = Skew background image colors
Sixth bit (0x20) = Close yourself when quiet time is enabled
[14] = Number of bytes in vibration pattern
[15,16,...] = Vibration pattern (up to 40 bytes, two bytes make uint16)
Packet 1 - Hide hourglass
Hides hourglass from Notifications window (when action was performed successfully but there is nothing else to tell Pebble)
No additional data
MODULE 1 - NOTIFICATION SENDING
Packet 0 - New notification packet
Phone sends it to display notification.
Additional data:
2 = Unique notification id (int32) - must be >= 10 (ids 0-9 are reserved)
3 = Config/meta bytes - byte array
[0] = Flags
Second bit (0x02) = Notification type (1 = from history, 0 = live)
Third bit (0x04) = Switch to most recent notification
Fouth bit (0x08) = Scroll to the end automatically
Fifth bit (0x10) = Does pressing SELECT opens action menu?
Sixth bit (0x20) = Does holding SELECT opens action menu?
[1] = Periodic vibration interval (first byte)
[2] = Periodic vibration interval (second byte)
[3] = Number of items in action menu (uint8)
[4] = Length of the full text string (first byte) - See Packet 1 below
[5] = Length of the full text string (second byte)
[6] = Shake action
[7] = Title font (0-17)
[8] = Subtitle font (0-17)
[9] = Body font (0-17)
[10] = Statusbar color (in GColor8 format - byte with aarrggbb bits, only on Basalt)
[11] = Image size (first byte, only on basalt)
[12] = Image size (second byte, only on basalt)
[13] = Array index of the first subtitle char (first byte)
[14] = Array index of the first subtitle char (second byte)
[15] = Array index of the first text char (first byte)
[16] = Array index of the first text char (second byte)
[17] = Number of bytes in vibration pattern
[18,19,...] = Vibration pattern (up to 40 bytes, two bytes make uint16)
4 = Previous notification id (int32)
ID of the previous notification that was updated by this notification. If this ID is displayed on the watch, this notification will not vibrate.
Value 0 means it will always vibrate.
5 = Size of notification icon in bytes (uint16)
0 means no image.
Packet 1 - Notification text packet
Send notification text (after above packet from Pebble).
Full string (title + subtitle + body, all separated with null character) is separated into 100 byte chunks and sent to pebble sequentially.
Additional data:
2 = Unique notification id (int32)
3 = Text (up to 100 utf-8 bytes) - byte array
Packet 2 - Notification icon packet
Sent immediatelly after new notification packet, before notification text packet.
Only one packet, it is not send if AppMessage buffer could not fit whole image
Additional data:
2 = Unique notification id (int32)
3 = Notification icon PNG data (byte array)
MODULE 2 - NOTIFICATION LIST
Packet 0 - Notification list data
Send when option is picked in main menu or when populating list.
Additional data:
2 = Offset of this list entry - uint16
3 = Number of all entries in this menu - uint16
4 - Type of this notification (1 = ongoing, 0 = normal) - uint8
5 - Title of this noification (up to 20 bytes) - cstring
6 - Subtitle of this notification (up to 20 bytes) - cstring
7 - Date string (up to 20 bytes) - cstring
8 - Size of the entry icon in bytes - uint16
0 means no icon (ongoing/normal icon is used instead)
9 - Icon of this notification - byte array
Only present on devices with AppMessage buffer >= 2048 bytes (devices that cannot afford that big buffer are considered too low memory for this feature)
MODULE 3 - DISMISS UPWARDS
Packet 0 - Dismiss notification
Removes notification from Pebble
Additional data:
2 = Unique notification id (int32)
3 = Are there notifications waiting to be sent (1 or 0 - uint8). If this is 1, app won't close after all notifications are dismissed.
MODULE 4 - ACTIONS
Packet 0 - Action list names - Names of items in action list
Additional data:
2 = array of uint8
[0] = Index of the first canned reponse in this packet
[1] = Amount of all actions in the list
[2] = Should I display tertiary text window instead of menu (1 or 0)
3 = Names (up to 4) - multiple null-terminated strings (up to 19 chars each) in one byte array
Packet 1 - Display voice action (Only on basalt)
MODULE 5 - IMAGE (ONLY ON BASALT)
Packet 0 - Image data
2 = array of uint8
[0] = Index of the first byte mod 256
[1-116] = Data of the image (part of the PNG image format)