-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.sx
325 lines (298 loc) · 11.4 KB
/
main.sx
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
#|
lnHealth - Health related apps for the LambdaNative framework
Copyright (c) 2009-2020, University of British Columbia
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of the University of British Columbia nor
the names of its contributors may be used to endorse or
promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|#
`(
(background-image "background.png")
(background-color ,Red)
(oncreate ,(lambda () (begin
(uiset 'hasip (host-ipaddr))
(uiset 'pleth (list 3.1 3.0 2.9 2.8 2.8 2.7 2.6 2.6 2.5 2.5
2.5 2.4 2.4 2.3 2.3 2.3 2.3 2.2 2.2 2.2
2.2 2.2 2.2 2.2 2.2 2.2 2.2 2.2 2.2 2.2
2.3 2.4 2.5 2.7 2.9 3.3 3.6 3.9 4.4 4.7
4.9 5.2 5.4 5.7 5.8 5.8 5.9 6.0 6.0 6.0
5.9 5.9 5.8 5.7 5.5 5.4 5.2 5.1 4.8 4.6
4.4 4.2 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2
3.2 3.1 3.1 3.0 3.0 2.9 2.9 2.9 2.8 2.7
2.7 2.7 2.6 2.6 2.5 2.5 2.5 2.4 2.4 2.3
2.3 2.2))
#t)))
(onscheduler ,(lambda () #t))
(onsuspend ,(lambda () #t))
(onresume ,(lambda () #t))
(ondestroy ,(lambda () #t))
(about
"About"
("Done" main)
#f
(spacer)
(label align left wrap #t text "lnHealth is a free and open framework for developing and deploying advanced data collection forms and applications. It is being developed by the Pediatric Anesthesia Research Team at the University of British Columbia for use in global health applications.")
(spacer)
(label align left wrap #t text "For more information please visit:")
(spacer)
,(lambda () (if (uiget 'hasip #f)
`(button text "http://lambdanative.org" action ,(lambda () (launch-url "http://lambdanative.org") #f))
`(label text "http://lambdanative.org")))
(spacer)
(label size small align left wrap #t text "Copyright 2009-2018, University of British Columbia\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n * Neither the name of the University of British Columbia nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. "
)
(spacer)
)
(main
"LambdaNative"
("About" about)
("Next" ex_buttons #f)
(spacer)
(label wrap #t text "This an example of the elements that can be used to construct data collection applications in LambdaNative")
(spacer)
(label wrap #t text "Click a button below or choose Next")
(spacer)
(button text "Buttons" action ex_buttons)
(spacer height 10)
(button text "Text Entry Elements" action ex_textentry)
(spacer height 10)
(button text "Labels" action ex_labels)
(spacer height 10)
(button text "Radio/Check Boxes" action ex_boxes)
(spacer height 10)
(button text "Checklists" action ex_checklists)
(spacer height 10)
(button text "Dropdown Lists" action ex_dropdowns)
(spacer height 10)
(button text "Images" action ex_images)
(spacer height 10)
(button text "Progress Bar" action ex_progress)
(spacer height 10)
(button text "Modal Dialogs" action ex_modal)
(spacer height 10)
(button text "Camera" action ex_camera)
(spacer height 10)
(button text "Barcodes" action ex_barcodes)
(spacer height 10)
(button text "Sensors" action ex_sensors)
(spacer height 10)
(button text "Sliders" action ex_sliders)
(spacer height 10)
(button text "Graph" action ex_graph)
(spacer)
)
(ex_buttons
"Buttons"
("Prev" main)
("Next" ex_textentry)
(spacer)
(button text "This is a normal button")
(spacer)
(button text "This button has a very long label on it, too long to fit on one line")
(spacer)
(button color ,Black size big text "Custom Button")
(spacer)
)
(ex_textentry
"Text Entry"
("Prev" ex_buttons #f)
("Next" ex_labels #f)
(spacer)
(textentry text "Plain text:" id dummy_pt)
(spacer)
(textentry text "Password:" id dummy_pw password #t)
(spacer)
(textentry text "Integer:" id dummy_it keypad numint)
(spacer)
(textentry text "Time:" id dummy_tm keypad numcolon default "HH:MM")
(spacer)
)
(ex_labels
"Labels"
("Prev" ex_textentry #f)
("Next" ex_boxes #f)
(spacer)
(label text "Default text")
(spacer)
(label text "Left aligned text" align left)
(spacer)
(label text "Right aligned text" align right)
(spacer)
(label align left color ,Black size small wrap #t text "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
(spacer)
(label text "BIG TEXT" size big)
(spacer)
)
(ex_boxes
"Radio/Check Boxes"
("Prev" ex_labels #f)
("Next" ex_checklists #f)
(spacer)
(label text "Choose one:" align center)
(spacer)
(radiobox id dummy_radio location ui left ("Yes" 1 #f) right ("No" 2 #f))
(spacer)
(spacer)
,(lambda ()
(let ((value (uiget 'dummy_radio 0)))
`(label text ,(cond ((= value 0) "No choice made")
((= value 1) "You chose: Yes")
((= value 2) "You chose: No")) align center)))
(spacer)
(spacer)
(checkbox id dummy_check location ui text "This is a checkbox")
(spacer)
)
(ex_checklists
"Checklists"
("Prev" ex_boxes #f)
("Next" ex_dropdowns #f)
(spacer)
(label text "Multiple choice:" align center)
(spacer)
(checklist id dummy_lst1 default ("element 1" "element 2" "element 3"))
(spacer)
(label text "Single choice:" align center)
(spacer)
(checklist id dummy_lst2 default ("element 4" "element 5" "element 6") radio #t)
)
(ex_dropdowns
"Dropdown Lists"
("Prev" ex_checklists #f)
("Next" ex_images #f)
(spacer)
(label text "Click to select:" align center)
(spacer)
(dropdown text "No selection made" id dummy_dd entries ("Element 1" "Element 2" "Element 3"))
)
(ex_images
"Images"
("Prev" ex_dropdowns)
("Next" ex_progress)
(spacer)
(image file "LambdaNative_logo.png")
(spacer)
)
(ex_progress
"ProgressBar"
("Prev" ex_images)
("Next" ex_modal)
(spacer)
(label text "Making some progress..")
(spacer)
(progress value ,(lambda ()
(let ((val (uiget 'progressval 0.)))
(uiset 'progressval (if (> val 1.) 0. (+ val 0.01)))
val)))
(spacer)
)
(ex_modal
"Modal Dialogs"
("Prev" ("Are you sure?" ("Yes" ex_progress) ("No" #f)))
("Next" ("This will take you\nto the next page" ("OK" ex_camera)))
(spacer)
(label wrap #t align left text "Modal dialogs will appear when clicking Prev and Done. Notice the two different types.")
(spacer)
)
(ex_camera
"Camera"
("Prev" ex_modal)
("Next" ex_barcodes)
(spacer)
(label text "Touch below to take photo:")
(spacer)
(camera filename "test.png" default "photo here")
(spacer)
)
(ex_barcodes
"Barcodes"
("Prev" ex_camera)
("Next" ex_sensors)
(spacer)
(label text "Data Matrix Barcode:")
(spacer)
(dmencode text "http://lambdanative.org")
(spacer)
(label text "Touch button to take photo and\nscan it for DM barcode:" wrap #t)
(spacer)
(dmdecode id dmtest default "<no code>")
(spacer)
)
(ex_sensors
"Sensors"
("Prev" ex_barcodes)
("Next" ex_sliders)
(spacer)
(label text "GPS:")
(label text ,(lambda () (string-append
(float->choppedstring (gps-latitude) 8) ":"
(float->choppedstring (gps-longitude) 8))))
(spacer)
(label text "Accelerometer:")
(label text ,(lambda () (string-append
(float->choppedstring (accel-x) 6) ":"
(float->choppedstring (accel-y) 6) ":"
(float->choppedstring (accel-z) 6))))
(spacer)
(label text "Gyro:")
(label text ,(lambda () (string-append
(float->choppedstring (gyro-yaw) 6) ":"
(float->choppedstring (gyro-pitch) 6) ":"
(float->choppedstring (gyro-roll) 6))))
(spacer)
)
(ex_sliders
"Sliders"
("Prev" ex_sensors)
("Next" ex_graph)
(spacer height 70)
(label text "Simple small blank slider")
(slider id dummy_slide1 number #f location ui h 48)
(spacer height 5)
,(lambda ()
(let ((value (uiget 'dummy_slide1 50)))
`(label text ,(string-append "Value is " (number->string value)))))
(spacer height 70)
(label text "Labelled slider")
(spacer height 5)
(slider id dummy_slide2 labels ("Left" "Middle" "Right") min 0 max 10)
)
(ex_graph
"Graph"
("Prev" ex_sliders)
#f
(spacer)
(graph height 200 id pleth location ui color ,Yellow linewidth 4)
(spacer height 10)
)
(example6
"graph example"
("Prev" example5 #f)
("Next" example7 #f)
(spacer)
)
)