-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.html
2837 lines (2281 loc) · 168 KB
/
README.html
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Monkey C Release Notes</title>
<meta name="author" content="Garmin International"/>
<meta name="date" content="January 4, 2017"/>
<link type="text/css" rel="stylesheet" href="resources/readme/style.css"/>
</head>
<body>
<script language="JavaScript">
<!-- Begin
var h_img_src = "resources/readme/hide.jpg";
var s_img_src = "resources/readme/show.jpg";
function toggle(id, img_name) {
var e = document.getElementById(id);
if(e.style.display == 'none') {
e.style.display = 'block';
document[img_name].src = s_img_src;
} else {
e.style.display = 'none';
document[img_name].src = h_img_src;
}
}
// End -->
</script>
<div id="title">MONKEY C</div>
<div id="tagline">Release 2.2.3 (Biker Monkey)</div>
<div class="clear"></div>
<h1 id="tableofcontents">Table of Contents</h1>
<div id="toc">
<ul>
<li><a href="#tableofcontents">Table of Contents</a></li>
<li><a href="#intro">Intro</a></li>
<li><a href="#gettingstarted">Getting Started</a>
<ul>
<li><a href="#osxinstallation">OS X Installation</a></li>
<li><a href="#windowsinstallation">Windows Installation</a></li>
<li><a href="#basiccommands">Basic Commands</a></li>
</ul></li>
<li><a href="#theeclipseplug-in">The Eclipse Plug-in</a>
<ul>
<li><a href="#installingtheeclipsexmleditor">Installing the Eclipse XML Editor</a></li>
<li><a href="#installingtheeclipseplug-in">Installing the Eclipse Plug-in</a></li>
<li><a href="#configuringtheeclipseplug-in">Configuring the Eclipse Plug-in</a></li>
<li><a href="#generatingadeveloperkey">Generating a Developer Key</a></li>
</ul></li>
<li><a href="#errormessages">Error Messages</a></li>
<li><a href="#usingthesamples">Using the Samples</a>
<ul>
<li><a href="#fundamentals">Fundamentals</a>
<ul>
<li><a href="#objectstore">ObjectStore</a></li>
<li><a href="#timer">Timer</a></li>
<li><a href="#userprofile">UserProfile</a></li>
</ul></li>
<li><a href="#userinterface">User Interface</a>
<ul>
<li><a href="#activitytracker">ActivityTracker</a></li>
<li><a href="#analog">Analog</a></li>
<li><a href="#attention">Attention</a></li>
<li><a href="#confirmationdialog">ConfirmationDialog</a></li>
<li><a href="#input">Input</a></li>
<li><a href="#keyboard">Keyboard</a></li>
<li><a href="#picker">Picker</a></li>
<li><a href="#menutest">MenuTest</a></li>
<li><a href="#numberpicker">NumberPicker</a></li>
<li><a href="#primates">Primates</a></li>
<li><a href="#progressbar">ProgressBar</a></li>
<li><a href="#selectable">Selectable</a></li>
</ul></li>
<li><a href="#mobilewebcommunication">Mobile/Web Communication</a>
<ul>
<li><a href="#comm">Comm</a></li>
<li><a href="#webrequest">WebRequest</a></li>
</ul></li>
<li><a href="#sensorandfitrecording">Sensor and FIT Recording</a>
<ul>
<li><a href="#accelmag">AccelMag</a></li>
<li><a href="#fieldtimerevents">FieldTimerEvents</a></li>
<li><a href="#positionsample">PositionSample</a></li>
<li><a href="#recordsample">RecordSample</a></li>
<li><a href="#sensor">Sensor</a></li>
<li><a href="#sensorhistory">SensorHistory</a></li>
<li><a href="#simpledatafield">SimpleDataField</a></li>
</ul></li>
<li><a href="#ant">ANT</a>
<ul>
<li><a href="#genericchannelburst">GenericChannelBurst</a></li>
<li><a href="#mo2display">MO2Display</a></li>
<li><a href="#moxydatafield">MoxyDataField</a></li>
</ul></li>
<li><a href="#resources">Resources</a>
<ul>
<li><a href="#drawable">Drawable</a></li>
<li><a href="#strings">Strings</a></li>
</ul></li>
</ul></li>
<li><a href="#releasenotes">Release Notes</a>
<ul>
<li><a href="#v2.2.3">v2.2.3</a></li>
</ul></li>
<li><a href="#additionalnotes">Additional Notes</a></li>
</ul>
</div>
<h1 id="intro">Intro</h1>
<p>Thank you for trying Monkey C!</p>
<p>Monkey C is a dynamically typed scripting language designed for publishing applications for Garmin devices that support Connect IQ. To find out more about Monkey C and Connect IQ, please visit <a href="http://developer.garmin.com/connect-iq/overview/">http://developer.garmin.com/connect-iq/overview/</a>. You can also join the Connect IQ developer community on the <a href="https://forums.garmin.com/forumdisplay.php?479-Connect-IQ">Garmin Forums</a> to find Monkey C tips & tricks and answers to many questions about Connect IQ.</p>
<h1 id="gettingstarted">Getting Started</h1>
<p>Before getting started with the installation on Mac or Windows, you’ll need <a href="JavaJRE">Oracle Java™ Runtime Environment 8</a> (version 1.8.0 or higher) installed. Once that’s done, continue on to your platform’s installation instructions.</p>
<h2 id="osxinstallation">OS X Installation</h2>
<ol>
<li>Visit the <a href="http://developer.garmin.com/connect-iq/sdk/">Connect IQ SDK</a> download page</li>
<li>After reviewing the SDK license agreement, click the <em>Accept & Download for Mac</em> button to download the SDK</li>
<li>When the download has finished, locate the Connect IQ SDK disk image file in your Downloads folder and open it (a Finder window containing the SDK may open automatically)</li>
<li>Create a new folder in a convenient location</li>
<li>Drag the contents of the Connect IQ SDK disk image into this new folder</li>
<li>Once complete, you may eject the disk image and delete the Connect IQ SDK disk image file</li>
<li>Next, point your <code>PATH</code> to the Connect IQ bin directory in the Terminal. To temporarily add it to a single local shell instance:</li>
</ol>
<pre><code class="bash">$ export PATH=$PATH:path/to/connectiq-sdk/bin
</code></pre>
<p>For a more persistent addition, open <code>.bash_profile</code> in a text editor:</p>
<pre><code class="bash">$ touch ~/.bash_profile
$ open ~/.bash_profile
</code></pre>
<p>Then add the line below to the file and save the changes:</p>
<pre><code class="bash">$ export PATH=$PATH:path/to/connectiq-sdk/bin
</code></pre>
<h2 id="windowsinstallation">Windows Installation</h2>
<ol>
<li>Visit the <a href="http://developer.garmin.com/connect-iq/sdk/">Connect IQ SDK</a> download page</li>
<li>After reviewing the SDK license agreement, click the <em>Accept & Download for Windows</em> button to download the SDK</li>
<li>Create a new folder in a convenient location</li>
<li>When the download has finished, locate the Connect IQ SDK zip file and extract it to this new folder</li>
<li>Once complete, you may delete the Connect IQ SDK zip file</li>
<li>Next, point your <code>PATH</code> to the Connect IQ bin directory in the command prompt:</li>
</ol>
<pre><code>> set PATH=%PATH%;path\to\connectiq-sdk\bin
</code></pre>
<h2 id="basiccommands">Basic Commands</h2>
<p>After installation, three new shell commands are available: <code>connectiq</code>, <code>monkeyc</code>, and <code>monkeydo</code>.</p>
<ul>
<li><p><code>connectiq</code> launches the Connect IQ simulator, which can be used to run and test apps on your computer before running them on your device. In the simulator, your app will only have access to those APIs that are available on the currently simulated device. For example, an API only available in Connect IQ v2.2.x or higher, such as <code>PersistedContent</code>, will not be available on devices that run earlier versions of Connect IQ.</p></li>
<li><p><code>monkeyc</code> calls the Monkey C compiler. The compiler can take code from multiple files and link them together into a single Connect IQ executable (a PRG file). The optional <code>-z</code> argument allows resource files to be passed in. If your project uses multiple resource files separate them with the system path separator (‘<code>;</code>’ in Windows and ‘<code>:</code>’ in OSX). This allows the addition of bitmaps, drawables, fonts, strings, and menus to your executable. See the samples directory for a sample resource file. The usage is:</p></li>
</ul>
<pre><code>> monkeyc -o <output.prg> -m <manifest.xml> [-z resource.xml;resource2.xml] <file1.mc> [file2.mc]...
</code></pre>
<ul>
<li><code>monkeydo</code> runs a Connect IQ executable in the simulator. You must have previously started the simulator with <code>connectiq</code>. The usage is:</li>
</ul>
<pre><code>> monkeydo myApp.prg
</code></pre>
<p>Here is an example of a basic build and run cycle from the command line:</p>
<pre><code>> connectiq
> monkeyc -o myApp.prg -m manifest.xml myApp.mc
> monkeydo myApp.prg
</code></pre>
<h1 id="theeclipseplug-in">The Eclipse Plug-in</h1>
<p>The Connect IQ Eclipse plug-in turns Eclipse into a Connect IQ development environment. Its features include:</p>
<ul>
<li>Syntax highlighting editor</li>
<li>Build integration</li>
<li>Integrated execution of applications in the Connect IQ simulator</li>
</ul>
<p>The Connect IQ plug-in requires either the Standard Edition or IDE for Java Developers (either 32 or 64 bit) of <a href="http://www.eclipse.org/" title="Eclipse">Eclipse Mars</a> or newer and <a href="JavaJRE">Oracle Java™ Runtime Environment 8</a> (version 1.8.0 or higher).</p>
<h2 id="installingtheeclipsexmleditor">Installing the Eclipse XML Editor</h2>
<p>Before you can install the Connect IQ plug-in you must make sure you have the Eclipse XML editor and tools installed.</p>
<ol>
<li>In the top menu, go to <em>Help > Install New Software</em>:</li>
<li>Select your Eclipse distribution (Mars, Neon, etc.) from the available update sites.</li>
<li>Check the box next to <em>Web, XML, Java EE and OSGi Enterprise Development > Eclipse XML Editor and Tools</em>.</li>
</ol>
<h2 id="installingtheeclipseplug-in">Installing the Eclipse Plug-in</h2>
<ol>
<li>In the top menu, go to <em>Help > Install New Software</em></li>
<li>Use the <em>Add…</em> button to add <em>http://developer.garmin.com/downloads/connect-iq/eclipse/</em></li>
<li>Mark the check box next to Connect IQ in the list and hit <em>Next</em></li>
<li>Dependent plug-in modules may need to be downloaded and installed. When this is complete, restart Eclipse to complete the installation.</li>
</ol>
<h2 id="configuringtheeclipseplug-in">Configuring the Eclipse Plug-in</h2>
<ol>
<li>Next, the plug-in will need to know where to find the Connect IQ SDK. To set this, go to the <em>Window > Preferences</em> menu (Windows), or to <em>Eclipse > Preferences</em> (Mac).</li>
<li>Click the <em>Browse</em> button and add the path to your Connect IQ SDK directory. Make sure it is referencing the root directory of the SDK and not the <code>bin</code> subdirectory.</li>
<li>Add the Connect IQ perspective to Eclipse by selecting <em>Window > Open Perspective > Other…</em> and then select <em>Connect IQ</em></li>
</ol>
<h2 id="generatingadeveloperkey">Generating a Developer Key</h2>
<p>Before starting on your first project, you’ll need to create a developer key, which the Connect IQ compiler requires to sign apps when they’re compiled and packaged.</p>
<ol>
<li>In the top menu, go to <em>Preferences > Connect IQ > Compiler</em></li>
<li>Click the <em>Generate</em> button to open the wizard</li>
<li>Set the output location for your developer key</li>
<li>Click <em>Finish</em> to create the key</li>
</ol>
<p>The developer key specified in the Connect IQ compiler preferences will automatically be passed to the compiler when a project is compiled.</p>
<p>For more information about Eclipse plug-in setup and use, please refer to <a href="http://developer.garmin.com/connect-iq/getting-started/" title="Getting started with Connect IQ">Getting Started</a> or the Programmers Guide PDF included in the SDK download package.</p>
<h1 id="errormessages">Error Messages</h1>
<p>If your program terminates abruptly, you should get a stack trace from <code>monkeydo</code> with an error. The errors are as follows:</p>
<dl>
<dt>Array Out Of Bounds</dt>
<dd>An attempt is being made to reference an array outside of its allocated bounds</dd>
<dt>Circular Dependency</dt>
<dd>There is a loop in the dependency graph of a module or object that prevents a module or object from being constructed</dd>
<dt>Communications Error</dt>
<dd>An error has occurred in <a href="https://en.wikipedia.org/wiki/Bluetooth_low_energy" title="Bluetooth low energy">BLE</a> communications</dd>
<dt>File Not Found</dt>
<dd>The app file could not be found, which is usually caused when trying to load a resource from the app file</dd>
<dt>Illegal Frame</dt>
<dd>The return address on the stack is corrupted</dd>
<dt>Initializer Error</dt>
<dd>An error occured in an initializer</dd>
<dt>Invalid Value</dt>
<dd>An argument passed to a function or method is invalid</dd>
<dt>Null Reference</dt>
<dd>A value is being requested from a null value</dd>
<dt>Out of Memory</dt>
<dd>Indicates no more system memory is available for allocation</dd>
<dt>Permission Required</dt>
<dd>An attempt was made to use a restricted API without permission</dd>
<dt>Stack Underflow</dt>
<dd>The stack pointer went past the bottom of the stack memory limit</dd>
<dt>Stack Overflow</dt>
<dd>The stack pointer went past the top of the stack memory limit</dd>
<dt>Symbol Not Found</dt>
<dd>An attempt was made to access a variable or method that does not exist in the specified object or method</dd>
<dt>System Error</dt>
<dd>A generic error used by the Toybox APIs for fatal errors</dd>
<dt>Too Many Arguments</dt>
<dd>Too many arguments used by a method, which are currently limited to 10 arguments</dd>
<dt>Too Many Objects</dt>
<dd>The program has allocated too many objects, pushing the object count above the maximum. The maximum varies among devices, but a count of 256 can be assumed at least.</dd>
<dt>Too Many Timers</dt>
<dd>Too many <code>Timer::Timer</code> objects for the target device were started</dd>
<dt>Unexpected Type</dt>
<dd>Indicates an operation being done on a variable that is unsupported by the type; for example, trying to perform a bitwise OR on two string</dd>
<dt>Unhandled Exception</dt>
<dd>An <code>Exception</code> was thrown but was not caught by an exception handler</dd>
<dt>Watchdog Tripped</dt>
<dd>A Monkey C function has executed for too long; watchdogs prevent a Monkey C program from hanging the system via an infinite loop</dd>
</dl>
<h1 id="usingthesamples">Using the Samples</h1>
<p>Sample applications are included with every SDK release in the ‘samples’ directory, and are meant give a small demonstration of the different parts of the Connect IQ API. Samples can be loaded through in regular fashion. They can also be viewed via the Eclipse Plugin by clicking Connect IQ> Samples.</p>
<h2 id="fundamentals">Fundamentals</h2>
<h3 id="objectstore">ObjectStore</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/ObjectStore.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Application.html" title="Application API documentation">Application</a></li>
</ul>
<p>Demonstrates saving and retrieving data in the <a href="https://developer.garmin.com/connect-iq/programmers-guide/resource-compiler/" title="Resource Compiler Programmer's Guide documentation">Object Store and App Settings</a> on the device.</p>
<p><strong>How It Works</strong></p>
<p><strong>Object Store:</strong></p>
<p>The first page displays values from the ObjectStore. Tap the screen six times, pausing between each tap to check for changed values on the screen:</p>
<ul>
<li>“Int” is assigned a value of 3</li>
<li>“Float” is assigned a value of 3.141590</li>
<li>“String” is assigned a value of “pie”</li>
<li>“Boolean” is assigned a value of “true”</li>
<li>“Array” is assigned a value of “[1,2,3,null]”</li>
<li>“Dictionary” is assigned a value of “{two=>2, 1=>one, null=>null}”</li>
</ul>
<p>Tapping the screen another six times will result in all values indicating “Not set”.</p>
<p><strong>App Settings:</strong></p>
<p>The second page will display the settings. To modify these values when the sample running in the Simulator:</p>
<ol>
<li>Select the “App Settings Editor” item from the Connect IQ Eclipse Plugin</li>
<li>Select the ObjectStore item from the “Project” drop down</li>
<li>Edit any of the values present and click “Send Settings”</li>
<li>The values will change in the Connect IQ simulator display</li>
</ol>
<h3 id="timer">Timer</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/Timer.png" />
</figure>
<ul>
<li><p>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Timer.html" title="Timer API documentation">Timer</a></p></li>
<li><p>Type: Application
Demonstrates the implementation of a Timer.</p></li>
</ul>
<p><strong>How It Works</strong></p>
<p>Three timers will start counting with different frequencies, and will update the screen with the count. The timer on the top should be the fastest, and the bottom the slowest.</p>
<h3 id="userprofile">UserProfile</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/UserProfile.png" />
</figure>
<ul>
<li>Type: Widget</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/UserProfile.html" title="UserProfile API documentation">UserProfile</a></li>
</ul>
<p>Demonstrates how to access user profile data from a device.</p>
<p><strong>How It Works</strong></p>
<ol>
<li>Press the menu to cycle through each of three screens of user profile data</li>
<li>The values should match the user profile configured if used on a device, or show preset values in the Connect IQ simulator</li>
</ol>
<h2 id="userinterface">User Interface</h2>
<h3 id="activitytracker">ActivityTracker</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/ActivityTracker.png" />
</figure>
<ul>
<li>Type: Widget</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/ActivityMonitor.html" title="ActivityMonitor API documentation">ActivityMonitor</a>, <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Timer.html" title="Timer API documentation">Timer</a></li>
</ul>
<p>Demonstrates an application of the activity tracking features.</p>
<p><strong>How It Works</strong></p>
<p>Three bars are displayed; a steps bar, a floors climbed bar, and an active minutes bar. Note: Bars are only display if data is available.</p>
<ol>
<li>Swipe to the widget</li>
<li>Walk around with the device for a short period of time</li>
<li>Press Enter or tap the screen - Three values are displayed; current steps, your step goal, and goal pace (the number of steps you should have taken by the current time of day.)</li>
<li>Press Enter or tap the screen - An Activity History Screen is displayed, showing step, goal, and floors climbed history.</li>
</ol>
<h3 id="analog">Analog</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/Analog.png" />
</figure>
<ul>
<li>Type: Watch Face</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Math.html" title="Math API documentation">Math</a>, <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Time.html" title="Time API documentation">Time</a></li>
</ul>
<p>Demonstrates a basic analog watch face with support for onEnterSleep(), onExitSleep, and DeviceSettings.doNotDistrub</p>
<h3 id="attention">Attention</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/Attention.png" />
</figure>
<ul>
<li>Type: Widget</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Attention.html" title="Attention API documentation">Attention</a>, <a href="https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/InputDelegate.html" title="InputDelegate API documentation">InputDelegate</a></li>
</ul>
<p>Demonstrates tones, vibration alerts and use of the back light. (Tones not supported in vivoactive or vivoactive HR. Vibration is not supported on Edge 520).</p>
<p><strong>How It Works</strong></p>
<ol>
<li>Select “Toggle backlight” - Backlight activates or deactivates respectively (not seen in simulator)</li>
<li>Select “Play a tone” - Tone will play. Pressing repeatedly will demonstrate the different tones available with their names</li>
<li>Select “Vibration” - Device vibrates (simulator shakes)</li>
</ol>
<p><strong>How It Works</strong></p>
<ol>
<li>Were on your wrist normally</li>
<li>Lower arm to normal resting position for about 15 seconds (Demostrates OnSleep() - seconds hand disapears)</li>
<li>Raise arm to look at watch (Demonstrates onWake() - Seconds hand will appear for 15 seconds)</li>
<li>Turn on Do Not Disturb - (Demonstrates DeviceSettings.doNotDistrub - when device updates Do Not Disturb symbol appears)</li>
</ol>
<p>OnSleep(), onWake(), and DoNotDistrub can be simulated in the simulator under Settings.</p>
<h3 id="confirmationdialog">ConfirmationDialog</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/ConfirmationDialog.png" />
</figure>
<ul>
<li>Type: Widget</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/BehaviorDelegate.html" title="BehaviorDelegate API documentation">BehaviorDelegate</a>, <a href="https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/ConfirmationDelegate.html" title="ConfirmationDelegate API documentation">ConfirmationDelegate</a></li>
</ul>
<p>Demonstrates how to handle behaviours (e.g. button presses) and present confirmation dialogues.</p>
<p><strong>How It Works</strong></p>
<ol>
<li>Press Menu:
<ul>
<li>Tap Confirm</li>
<li>“Test the confirm Confirm/Yes” should be displayed</li>
</ul></li>
<li>Press Menu
<ul>
<li>Tap Cancel</li>
<li>“Test the confirm Cancel/No” should be displayed</li>
</ul></li>
<li>Press Menu to return to dismiss the response.</li>
</ol>
<h3 id="input">Input</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/Input.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/InputDelegate.html" title="InputDelegate API documentation">InputDelegate</a>, <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/BehaviorDelegate.html" title="BehaviorDelegate API documentation">BehaviorDelegate</a></li>
</ul>
<p>Demonstrates handling all input types including page swipes, holds, and button presses</p>
<p><strong>How It Works</strong></p>
<p>For each input event supported by a device, the application will display:</p>
<ul>
<li>The event that was detected (i.e. key/swipe/touch)</li>
<li>The behaviour that is mapped to the input event (if any)</li>
</ul>
<p>Not all devices support every touch/key/swipe event. To exit the sample, press the back button twice in a row.</p>
<h3 id="keyboard">Keyboard</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/Keyboard.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/InputDelegate.html" title="InputDelegate API documentation">InputDelegate</a>, <a href="https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/TextPicker.html" title="TextPicker API documentation">TextPicker</a>, <a href="https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/TextPickerDelegate.html" title="TextPickerDelegate API documentation">TextPickerDelegate</a></li>
</ul>
<p>Demonstrates use of the text picker.</p>
<p><strong>How It Works</strong></p>
<p>Select characters one-by-one to create a string. When “OK” is selected, the final string will be returned with a “Changed=true” status.</p>
<h3 id="picker">Picker</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/Picker.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="#picker">Picker</a></li>
</ul>
<p>Demonstrates the generic Picker features via several different implementations.</p>
<p><strong>How It Works</strong></p>
<p>Select a color:</p>
<ol>
<li>Tap Menu</li>
<li>Arrow up or down to select the color picker</li>
<li>Tap the check mark to activate the color picker</li>
<li>Tap the selection arrows to choose a color</li>
<li>Tap the paint brush to confirm color selection</li>
<li>Tap Back</li>
<li>The color of the text is drawn in the selected color</li>
</ol>
<p>Select a date:</p>
<ol>
<li>Tap Menu</li>
<li>Arrow up or down to select the date picker</li>
<li>Tap the check mark to activate the date picker</li>
<li>Arrow up or down to select a month</li>
<li>Tap the ‘-’ on the right side of the screen</li>
<li>Arrow up or down to choose a day</li>
<li>Tap the ‘-’ on the right side of the screen</li>
<li>Arrow up or down to choose a year</li>
<li>Tap the check mark to confirm date selection</li>
<li>Tap Back</li>
<li>The top string shows the selected date</li>
</ol>
<p>Select a string:</p>
<ol>
<li>Tap Menu</li>
<li>Arrow up or down to select the string picker</li>
<li>Tap the check mark to activate the string picker</li>
<li>Arrow up or down to select a letter</li>
<li>Tap the check mark to confirm the letter</li>
<li>Repeat steps 4 and 5 until you have completed your chosen string</li>
<li>Arrow up or down to select ‘OK’</li>
<li>Tap the check mark to confirm the string</li>
<li>Tap Back</li>
<li>The bottom string shows the selected string</li>
</ol>
<p>Select a time:</p>
<ol>
<li>Tap Menu</li>
<li>Arrow up or down to select the time picker</li>
<li>Tap the check mark to activate the time picker</li>
<li>Arrow up or down to select an hour</li>
<li>Tap the ‘:’ on the right side of the screen</li>
<li>Arrow up or down to choose a minute</li>
<li>Tap the ‘AM’ or ‘PM’ on the right side of the screen</li>
<li>Arrow up or down to choose a period</li>
<li>Tap the check mark to confirm period selection</li>
<li>Tap Back</li>
<li>The middle string shows the selected time</li>
</ol>
<p>Layout Picker:</p>
<p>This is included to show you the layout of the picker in a given device. It currently serves no other function in the sample.</p>
<h3 id="menutest">MenuTest</h3>
<p><strong>About the Sample</strong></p>
<figure>
<img src="resources/readme/MenuTest.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/Menu.html" title="Menu API Documentation">Menu</a>, <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/MenuInputDelegate.html" title="MenuInputDelegate API documentation">MenuInputDelegate</a></li>
</ul>
<p>Demonstrates how to define menus using resources and the use of nested menus.</p>
<p><strong>How It Works</strong></p>
<p>Press the Menu button to display an on-screen menu, which has options to return to the home screen or display an auxiliary, nested menu.</p>
<h3 id="numberpicker">NumberPicker</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/NumberPicker.png" />
</figure>
<ul>
<li>Type: Widget</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/BehaviorDelegate.html" title="BehaviorDelegate API documentation">BehaviorDelegate</a>, <a href="https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/NumberPicker.html" title="NumberPicker API documentation">NumberPicker</a>, <a href="https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/NumberPickerDelegate.html" title="NumberPickerDelegate API documentation">NumberPickerDelegate</a></li>
</ul>
<p>An example of how to use the number picker in an application.</p>
<p><strong>How It Works</strong></p>
<p>The number picker sample takes inputs with specific units and converts them to system units. Press “Menu” to cycle through each input:</p>
<ol>
<li>Enter 5 miles - Top value changes to 8046.735840 (Meters)</li>
<li>Enter “05:00:00” - Bottom value changes to 18000 (Seconds)</li>
<li>Enter “30:00” - Bottom value changes to 1800 (Seconds)</li>
<li>Enter “05:00:00 PM” - Bottom value changes to 61200 (Seconds)</li>
<li>Enter 250 pounds - Top value changes to 113.398087 (Kilograms)</li>
<li>Enter 72.00 inches - Top value changes to 1.828800 (Meters)</li>
<li>Enter 200 calories - Middle value changes to 200 (Calories)</li>
<li>Enter 1975 - Middle value changes to 1975 (Years)</li>
</ol>
<h3 id="primates">Primates</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/Primates.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Graphics.html" title="Graphics API documentation">Graphics</a>, <a href="https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/InputDelegate.html" title="InputDelegate API documentation">InputDelegate</a></li>
</ul>
<p>Demonstrates the use of multiple pages within a single application and of different types of graphics resources.</p>
<p><strong>How It Works</strong></p>
<ol>
<li>Issue next/previous page behaviours (i.e. swipes) to cycle through different primate pictures</li>
<li>Each picture shows a different primate species and resource type:
<ul>
<li>Closest-mapping</li>
<li>Floyd-Steinberg dithering</li>
<li>Alpha channel (Edge only)</li>
</ul></li>
<li>Tapping a page will push a new view which displays information about the primate species</li>
</ol>
<h3 id="progressbar">ProgressBar</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/ProgressBar.png" />
</figure>
<ul>
<li>Type: Widget</li>
<li>Modules/Classes: <a href="#progressbar">ProgressBar</a></li>
</ul>
<p>Demonstrates the use of the WatchUi ProgressBar.</p>
<p><strong>How It Works</strong></p>
<ol>
<li>Tap the screen or hit Start/Enter</li>
<li>Displays “Processing” with a “busy” progress bar for five seconds
<ul>
<li>After five seconds, displays “Processing” with an updating progress bar for ten seconds</li>
<li>After ten seconds, displays “Complete”</li>
</ul></li>
<li>Displays “Tap or hit start/enter to test progress bar” message</li>
</ol>
<h3 id="selectable">Selectable</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/selectable.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi.html" title="WatchUi API documentation">WatchUi</a></li>
</ul>
<p>Demonstrates the use of Selectables and Buttons on a touch-screen / hard-key device</p>
<p><strong>How It Works</strong></p>
<p>Touch Screen Devices:</p>
<ol>
<li>Press and hold one of the white boxes - The box outline should turn red with now check displayed</li>
<li>Release the click - The box should now display a white outline witha green check</li>
<li>These steps can be repeated on each box</li>
<li>Start/Enter and Menu buttons should respond in a similar manner</li>
</ol>
<p>Non-Touch Screen Devices:</p>
<ol>
<li>Press Menu - The left outline box should turn red</li>
<li>Press Up or Down -The red outline should move to the next or previous box</li>
<li>Press Start/Enter - The current box should be selected and display a green check</li>
<li>Press Menu - No check boxes should be outline in red/selected</li>
<li>Press Start/Enter - No response (no selections to check)</li>
</ol>
<h2 id="mobilewebcommunication">Mobile/Web Communication</h2>
<h3 id="comm">Comm</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/Comm.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Communications.html" title="Communications API documentation">Communications</a></li>
</ul>
<p>Demonstrates communication between a device and Garmin Connect Mobile (Android and iOS).</p>
<p><strong>How It Works</strong></p>
<p>Loading the Mobile Comm sample to a Android/iOS phone:</p>
<ol>
<li>Download the appropriate <a href="http://developer.garmin.com/connect-iq/sdk/" title="Mobile SDK Download Link">Mobile SDK</a> for the phone</li>
<li>Follow the included instructions for building/installing the sample application</li>
</ol>
<p>Connecting the Connect IQ simulator and Android phone:</p>
<ol>
<li>Run the Connect IQ Comm sample application on the Connect IQ simulator</li>
<li>Connect your Android phone to your computer, ensuring Android Debug Bridge (ADB) is installed</li>
<li>Using a console, run “adb devices” - your device should appear in this list (if not, install the drivers for your phone)</li>
<li>Using the same console, run “adb forward tcp:7381 tcp:7381” to forward ADB traffic to the Connect IQ simulator</li>
<li>Select “Connection->Start” from the simulator drop down menu</li>
</ol>
<p>Connecting a device and Android/iOS phone:</p>
<ol>
<li>Connect the test device to your computer</li>
<li>Install the Connect IQ Comm sample widget to the test device by side-loading it directly to the device’s file system</li>
<li>Disconnect the test device from the computer</li>
<li>Pair the test device to the phone via GCM/BLE</li>
<li>Run the sample application on the phone</li>
<li>Launch the Comm sample widget on the test device</li>
<li>Touch the test device in the device list on the phone (if presented)</li>
</ol>
<p>Using the sample:</p>
<ol>
<li>Touch any of the available strings on the phone (e.g. “Hello World”)</li>
<li>Watch for a response on the Connect IQ Comm sample with the string you selected</li>
<li>Touch the menu button on the Connect IQ Comm sample</li>
<li>Swipe to select and touch any available string on the Connect IQ Comm sample</li>
<li>Watch for a response on the phone with the string you selected</li>
</ol>
<h3 id="webrequest">WebRequest</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/WebRequest.png" />
</figure>
<ul>
<li>Type: Widget</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Communications.html" title="Communications API documentation">Communications</a></li>
</ul>
<p>Demonstrates making web requests through GCM to get mirrored data from httpbin.org</p>
<p><strong>How It Works</strong></p>
<p>The CIQ simulator will start the web request when the menu button is pushed. The response may either be the hard coded arguments the app sends as URL encoded paramaters or a BLE/HTTP response code. To run on a device:</p>
<ol>
<li>Side-load the sample directly to the device’s file system</li>
<li>Disconnect the test device from the computer</li>
<li>Pair the test device to the mobile device via GCM/BLE</li>
<li>Launch the WebRequest widget on the test device</li>
<li>Press the device menu button</li>
<li>Watch for a response from the widget</li>
</ol>
<h2 id="sensorandfitrecording">Sensor and FIT Recording</h2>
<h3 id="accelmag">AccelMag</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/AccelMag.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/WatchUi/BehaviorDelegate.html" title="BehaviorDelegate API documentation">BehaviorDelegate</a>, <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Sensor.html" title="Sensor API documentation">Sensor</a></li>
</ul>
<p>Demonstrates Accelerometer and Magnetometer support.</p>
<p><strong>How It Works</strong></p>
<ul>
<li>Accelerometer:
<ol>
<li>Tilt device in various directions - The ball on the screen moves in the direction of the tilt</li>
</ol></li>
<li>Magnetometer:
<ol>
<li>Turn the device in place - An arrow on the edge of the screen should point north</li>
<li>Press the start button - The ball will get “kicked” in the direction the arrow is pointing</li>
</ol></li>
</ul>
<h3 id="fieldtimerevents">FieldTimerEvents</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/FieldTimerEvents.png" />
</figure>
<ul>
<li>Type: Data Field</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Activity.html" title="Activity API documentation">Activity</a></li>
</ul>
<p>Demonstrates use timer events within a data field.</p>
<p><strong>How It Works</strong></p>
<p>Displays a number with a color and value that changes depending on timer events:</p>
<ul>
<li>The lap number should be red if the timer is stopped</li>
<li>The lap number should be green if the timer is running</li>
<li>The lap number should be yellow if the timer has been auto-paused (make sure this feature is enabled in your device settings)</li>
<li>The lap number should increment with each lap key press</li>
</ul>
<h3 id="positionsample">PositionSample</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/PositionSample.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Position.html" title="Position API documentation">Position</a></li>
</ul>
<p>Demonstrates how to get device position.</p>
<p><strong>How It Works</strong></p>
<ul>
<li>Allow the GPS to acquire a position (device) or simulate FIT data (CIQ simulator)</li>
<li>A screen showing simulated values (or values reasonable for your current position) will display</li>
</ul>
<h3 id="recordsample">RecordSample</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/RecordSample.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/ActivityRecording.html" title="ActivityRecording API documentation">ActivityRecording</a>, <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Position.html" title="Position API documentation">Position</a></li>
</ul>
<p>Demonstrates how to record an activity session.</p>
<p><strong>How It Works</strong></p>
<ol>
<li>Launch the app - Displays “Press Menu to Start Recording”’</li>
<li>Press Menu to start recording and activity:
<ul>
<li>Displays “Recording…”</li>
<li>Press Menu again to Stop and Save the Recording"</li>
</ul></li>
<li>Note the duration of the activity</li>
<li>View activity history: “Main Menu” > “History” (Device Only)</li>
<li>A Walking activity is saved for the duration of the activity (Device Only)</li>
</ol>
<h3 id="sensor">Sensor</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/Sensor.png" />
</figure>
<ul>
<li>Type: Application</li>
<li>Modules/Classes: <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Sensor.html" title="Sensor API documentation">Sensor</a>, <a href="http://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Position.html" title="Position API documentation">Position</a></li>
</ul>
<p>Demonstrates access to sensors (in this case, the HRM), and is a good sample of a live-updating graph.</p>
<p><strong>How It Works</strong></p>
<p>Displays current heart rate, along with a time series graph of the heart rate from the last 20 seconds. Requires paired heart rate monitor or wrist heart rate monitor for full function (on device). Can also use simulated data (in simulator).</p>
<h3 id="sensorhistory">SensorHistory</h3>
<p><strong>About The Sample</strong></p>
<figure>
<img src="resources/readme/SensorHistory.png" />
</figure>
<ul>
<li>Type: Widget</li>
<li>Modules/Classes: <a href="#sensorhistory">SensorHistory</a></li>
</ul>
<p>Demonstrates using and displaying various sensor history information. This is only available on 2.x VM devices.</p>
<p><strong>How It Works</strong></p>
<p>This shows four pages of Sensor History graphs accessed by pressing Up or Down in the widget:</p>
<ol>
<li>Heart Rate History</li>
<li>Temperature History</li>
<li>Pressure History</li>
<li>Elevation History</li>
</ol>