Guest User

Connect IQ API 1.2.9

a guest
May 22nd, 2016
3,187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 142.62 KB | None | 0 0
  1. // This is generated Connect IQ API stub, do not edit this!
  2.  
  3. module Toybox {
  4. //! The Activity module contains the interface to use to retrieve Activity data.
  5. //! @since 1.0.0
  6. module Activity {
  7. //! The SWIM_STROKE enum is used to evaluate the results of the activity swim stroke
  8. //! info.
  9. //!
  10. //! Freestyle stroke
  11. //! @since 1.2.2
  12. const SWIM_STROKE_FREESTYLE = 0;
  13.  
  14. //! Backstroke
  15. //! @since 1.2.2
  16. const SWIM_STROKE_BACKSTROKE = 1;
  17.  
  18. //! Breaststroke
  19. //! @since 1.2.2
  20. const SWIM_STROKE_BREASTSTROKE = 2;
  21.  
  22. //! Butterfly stroke
  23. //! @since 1.2.2
  24. const SWIM_STORKE_BUTTERFLY = 3;
  25.  
  26. //! Drill mode
  27. //! @since 1.2.2
  28. const SWIM_STROKE_DRILL = 4;
  29.  
  30. //! Mixed stroke mode
  31. //! @since 1.2.2
  32. const SWIM_STROKE_MIXED = 5;
  33.  
  34. //! Mixed interval with equal number of butterfly, backstroke, breaststroke, and
  35. //! freestyle in that order.
  36. //! @since 1.2.2
  37. const SWIM_STROKE_IM = 6;
  38.  
  39. //! A class containing information about the current activity. The fields in this
  40. //! class may return null so you should null check a value before using it.
  41. //! @since 1.0.0
  42. class Info {
  43. //! The altitude in meters
  44. //! @since 1.0.0
  45. //! @return [Float]
  46. var altitude;
  47.  
  48. //! The average cadence in revolutions per minute
  49. //! @since 1.0.0
  50. //! @return [Number]
  51. var averageCadence;
  52.  
  53. //! The swim stroke average distance in meters from the previous interval
  54. //! @since 1.2.2
  55. //! @return [Float]
  56. var averageDistance;
  57.  
  58. //! The average heart rate in beats per minute
  59. //! @since 1.0.0
  60. //! @return [Number]
  61. var averageHeartRate;
  62.  
  63. //! The average power in watts
  64. //! @since 1.0.0
  65. //! @device Forerunner 920XT
  66. //! @device fenix 3
  67. //! @device epix
  68. //! @device All Edges
  69. //! @return [Number]
  70. var averagePower;
  71.  
  72. //! The average speed in meters per second. The average is computed as the elapsed
  73. //! 3-D accumulated distance divided by the elapsed time.
  74. //! @since 1.0.0
  75. //! @return [Float]
  76. var averageSpeed;
  77.  
  78. //! The current calories burned during the current activity being recorded in kcal
  79. //! @since 1.0.0
  80. //! @return [Number]
  81. var calories;
  82.  
  83. //! The current cadence in revolutions per minute
  84. //! @since 1.0.0
  85. //! @return [Number]
  86. var currentCadence;
  87.  
  88. //! The current true north referenced heading in radians. This value matches heading
  89. //! from the Positioning module. It will provide the direction of travel when
  90. //! moving. When stopped, it will provide compass orientation, if supported by the
  91. //! device.
  92. //! @since 1.0.0
  93. //! @return [Float]
  94. var currentHeading;
  95.  
  96. //! The current heart rate in beats per minute
  97. //! @since 1.0.0
  98. //! @return [Number]
  99. var currentHeartRate;
  100.  
  101. //! The current location
  102. //! @since 1.0.0
  103. //! @return [Location]
  104. var currentLocation;
  105.  
  106. //! GPS Accuracy (See the accuracy member of the Info object in the Position module
  107. //! for more information)
  108. //! @since 1.0.0
  109. //! @return [Number]
  110. var currentLocationAccuracy;
  111.  
  112. //! The current power in watts
  113. //! @since 1.0.0
  114. //! @device Forerunner 920XT
  115. //! @device fenix 3
  116. //! @device epix
  117. //! @device All Edges
  118. //! @return [Number]
  119. var currentPower;
  120.  
  121. //! The current speed in meters per second. (See the speed member of the Info object
  122. //! in the Position module for more information)
  123. //! @since 1.0.0
  124. //! @return [Float]
  125. var currentSpeed;
  126.  
  127. //! Distance in meters
  128. //! @since 1.0.0
  129. //! @return [Float]
  130. var elapsedDistance;
  131.  
  132. //! Elapsed time of the activity in milliseconds
  133. //! @since 1.0.0
  134. //! @return [Number]
  135. var elapsedTime;
  136.  
  137. //! Momentary energy expenditure in kcals/min
  138. //! (www.firstbeat.com/consumers/analyzed-by-firstbeat-features#4)
  139. //! @since 1.2.0
  140. //! @return [Float]
  141. var energyExpenditure;
  142.  
  143. //! The maximum cadence in revolutions per minute
  144. //! @since 1.0.0
  145. //! @return [Number]
  146. var maxCadence;
  147.  
  148. //! The maximum heart rate in beats per minute
  149. //! @since 1.0.0
  150. //! @return [Number]
  151. var maxHeartRate;
  152.  
  153. //! The maximum power in watts
  154. //! @since 1.0.0
  155. //! @device Forerunner 920XT
  156. //! @device fenix 3
  157. //! @device epix
  158. //! @device All Edges
  159. //! @return [Number]
  160. var maxPower;
  161.  
  162. //! The maximum speed recorded during the timed activity, in meters per second
  163. //! @since 1.0.0
  164. //! @return [Float]
  165. var maxSpeed;
  166.  
  167. //! The starting location of the activity
  168. //! @since 1.0.0
  169. //! @return [Location]
  170. var startLocation;
  171.  
  172. //! The starting time of the activity
  173. //! @since 1.0.0
  174. //! @return [Moment]
  175. var startTime;
  176.  
  177. //! The swim stroke type from the previous length
  178. //! @since 1.2.2
  179. //! @return [Number]
  180. var swimStrokeType;
  181.  
  182. //! The swimming SWOLF score from the previous length
  183. //! @since 1.2.2
  184. //! @return [Number]
  185. var swimSwolf;
  186.  
  187. //! Timer time in milliseconds
  188. //! @since 1.0.0
  189. //! @return [Number]
  190. var timerTime;
  191.  
  192. //! The total ascent in meters
  193. //! @since 1.0.0
  194. //! @return [Float]
  195. var totalAscent;
  196.  
  197. //! The total descent in meters
  198. //! @since 1.0.0
  199. //! @return [Float]
  200. var totalDescent;
  201.  
  202. //! Training Effect: The activity's level of effect on aerobic fitness.
  203. //! (www.firstbeat.com/consumers/analyzed-by-firstbeat-features#3)
  204. //! @since 1.2.0
  205. //! @return [Float]
  206. var trainingEffect;
  207.  
  208. }
  209.  
  210. //! To retrieve the current Activity.Info, call getActivityInfo()
  211. //! @since 1.0.0
  212. //! @return [Activity.Info] The current Activity.Info or null if there is no activity running.
  213. function getActivityInfo() {}
  214.  
  215. }
  216.  
  217. //! The ActivityMonitor module contains the interface for Activity Monitoring data.
  218. //! @since 1.0.0
  219. module ActivityMonitor {
  220. //! @since 1.0.0
  221. const MOVE_BAR_LEVEL_MAX = 5;
  222.  
  223. //! @since 1.0.0
  224. const MOVE_BAR_LEVEL_MIN = 0;
  225.  
  226. //! Indicates that the given heart rate sample is invalid.
  227. //! @since 1.2.2
  228. //! @device fr235
  229. //! @device fenix 3 HR
  230. const INVALID_HR_SAMPLE = 255;
  231.  
  232. //! A class containing heart rate data for a given period of time.
  233. //! @since 1.2.2
  234. //! @device fr235
  235. //! @device fenix 3 HR
  236. class HeartRateIterator {
  237. //! Get the maximium heart rate contained in this iterator.
  238. //! @since 1.2.2
  239. //! @return [Number] the maximum heart rate (bpm)
  240. function getMax() {}
  241.  
  242. //! Get the minimium heart rate contained in this iterator.
  243. //! @since 1.2.2
  244. //! @return [Number] the minimum heart rate (bpm)
  245. function getMin() {}
  246.  
  247. //! Get the next entry in the iterator. This must be called to get the initial data
  248. //! from the iterator.
  249. //! @since 1.2.2
  250. //! @return [HeartRateSample] returns the next HeartRateSample, or null if there are no more samples
  251. function next() {}
  252.  
  253. }
  254.  
  255. //! A class containing heart rate data at a given time.
  256. //! @since 1.2.2
  257. //! @device fr235
  258. //! @device fenix 3 HR
  259. class HeartRateSample {
  260. //! Heart rate in bpm. Make sure to check for INVALID_HR_SAMPLE.
  261. //! @since 1.2.2
  262. //! @return [Number]
  263. var heartRate;
  264.  
  265. //! @since 1.2.2
  266. //! @return [Moment]
  267. var when;
  268.  
  269. }
  270.  
  271. //! A class containing information about the user's activity history. The fields in
  272. //! this class may return null so you should null check a value before using it.
  273. //! @since 1.0.0
  274. class History {
  275. //! Calories in kCal
  276. //! @since 1.0.0
  277. //! @return [Number]
  278. var calories;
  279.  
  280. //! Distance in cm
  281. //! @since 1.0.0
  282. //! @return [Number]
  283. var distance;
  284.  
  285. //! Start of Day, Moment object with the start time of the day
  286. //! @since 1.0.0
  287. //! @return [Moment]
  288. var startOfDay;
  289.  
  290. //! Step goal for the day
  291. //! @since 1.0.0
  292. //! @return [Number]
  293. var stepGoal;
  294.  
  295. //! Steps in number of steps
  296. //! @since 1.0.0
  297. //! @return [Number]
  298. var steps;
  299.  
  300. }
  301.  
  302. //! A class containing information about the user's current activity status. The
  303. //! fields in this class may return null so you should null check a value before
  304. //! using it.
  305. //! @since 1.0.0
  306. class Info {
  307. //! Calories burned so far for the day in kCal
  308. //! @since 1.0.0
  309. //! @return [Number]
  310. var calories;
  311.  
  312. //! Distance in cm
  313. //! @since 1.0.0
  314. //! @return [Number]
  315. var distance;
  316.  
  317. //! Is the user in sleep mode?
  318. //! @since 1.0.0
  319. //! @return [Boolean]
  320. var isSleepMode;
  321.  
  322. //! Current level of the move bar. Between MOVE_BAR_LEVEL_MIN and
  323. //! MOVE_BAR_LEVEL_MAX.
  324. //! @since 1.0.0
  325. //! @return [Number]
  326. var moveBarLevel;
  327.  
  328. //! Step goal for the day
  329. //! @since 1.0.0
  330. //! @return [Number]
  331. var stepGoal;
  332.  
  333. //! Steps in number of steps
  334. //! @since 1.0.0
  335. //! @return [Number]
  336. var steps;
  337.  
  338. }
  339.  
  340. //! Retrieve the heart rate history for the given period, up to the last power
  341. //! cycle. This function always returns the most recent heart rate samples. The time
  342. //! between each HeartRateSample in the iterator may be device dependent.
  343. //! @since 1.2.1
  344. //! @device fr235
  345. //! @device fenix 3 HR
  346. //! @param period If period is null, the entire available history is retrieved. If period is a Duration, then the history for the given Duration is retrieved. If period is a Number, then the last Number entries are retrieved.
  347. //! @param newestFirst true to get the samples newest first, false to get them oldest first
  348. //! @return [ActivityMonitor.HeartRateIterator] an iterator for the heart rate history for the given period
  349. function getHeartRateHistory(period, newestFirst) {}
  350.  
  351. //! Use getHistory() to retrieve an array of ActivityMonitor.History objects
  352. //! @since 1.0.0
  353. //! @return [Array] of ActivityMonitor.History objects.
  354. function getHistory() {}
  355.  
  356. //! Use getInfo() to retrieve the current ActivityMonitor.Info
  357. //! @since 1.0.0
  358. //! @return [ActivityMonitor.Info] object with current information.
  359. function getInfo() {}
  360.  
  361. }
  362.  
  363. //! The Activity Recording module will allow Apps to access the FIT file recording
  364. //! capabilities of the device. Apps can use this module to allow the user to start
  365. //! and stop recordings, create laps, and save recorded data.
  366. //! @since 1.0.0
  367. //! @permission Fit
  368. //! @apptype App
  369. module ActivityRecording {
  370. //! The SPORT enum allows definition of what kind of sport is being recorded. Use
  371. //! SPORT_GENERIC for sports not on the list.
  372. //! @since 1.0.0
  373. const SPORT_GENERIC = 0;
  374.  
  375. //! @since 1.0.0
  376. const SPORT_RUNNING = 1;
  377.  
  378. //! @since 1.0.0
  379. const SPORT_CYCLING = 2;
  380.  
  381. //! Sport used for mulitsport transitions
  382. //! @since 1.0.0
  383. const SPORT_TRANSITION = 3;
  384.  
  385. //! Sport used for ANT enabled excercise equipment
  386. //! @since 1.0.0
  387. const SPORT_FITNESS_EQUIPMENT = 4;
  388.  
  389. //! @since 1.0.0
  390. const SPORT_SWIMMING = 5;
  391.  
  392. //! @since 1.0.0
  393. const SPORT_BASKETBALL = 6;
  394.  
  395. //! @since 1.0.0
  396. const SPORT_SOCCER = 7;
  397.  
  398. //! @since 1.0.0
  399. const SPORT_TENNIS = 8;
  400.  
  401. //! @since 1.0.0
  402. const SPORT_AMERICAN_FOOTBALL = 9;
  403.  
  404. //! Sport used for activities such as strength training, cardio, etc
  405. //! @since 1.0.0
  406. const SPORT_TRAINING = 10;
  407.  
  408. //! @since 1.0.0
  409. const SPORT_WALKING = 11;
  410.  
  411. //! @since 1.0.0
  412. const SPORT_CROSS_COUNTRY_SKIING = 12;
  413.  
  414. //! @since 1.0.0
  415. const SPORT_ALPINE_SKIING = 13;
  416.  
  417. //! @since 1.0.0
  418. const SPORT_SNOWBOARDING = 14;
  419.  
  420. //! @since 1.0.0
  421. const SPORT_ROWING = 15;
  422.  
  423. //! @since 1.0.0
  424. const SPORT_MOUNTAINEERING = 16;
  425.  
  426. //! @since 1.0.0
  427. const SPORT_HIKING = 17;
  428.  
  429. //! @since 1.0.0
  430. const SPORT_MULTISPORT = 18;
  431.  
  432. //! @since 1.0.0
  433. const SPORT_PADDLING = 19;
  434.  
  435. //! Sub-sports allow for clarification of sport when recording. Use
  436. //! SUB_SPORT_GENERIC if no other sub-sport is applicable.
  437. //! @since 1.0.0
  438. const SUB_SPORT_GENERIC = 0;
  439.  
  440. //! Sub-sport for Running and Fitness Equipment
  441. //! @since 1.0.0
  442. const SUB_SPORT_TREADMILL = 1;
  443.  
  444. //! Sub-sport for Running
  445. //! @since 1.0.0
  446. const SUB_SPORT_STREET = 2;
  447.  
  448. //! Sub-sport for Running
  449. //! @since 1.0.0
  450. const SUB_SPORT_TRAIL = 3;
  451.  
  452. //! Sub-sport for Running
  453. //! @since 1.0.0
  454. const SUB_SPORT_TRACK = 4;
  455.  
  456. //! Sub-sport for Cycling
  457. //! @since 1.0.0
  458. const SUB_SPORT_SPIN = 5;
  459.  
  460. //! Sub-sport for Cycling and Fitness Equipment
  461. //! @since 1.0.0
  462. const SUB_SPORT_INDOOR_CYCLING = 6;
  463.  
  464. //! Sub-sport for Cycling
  465. //! @since 1.0.0
  466. const SUB_SPORT_ROAD = 7;
  467.  
  468. //! Sub-sport for Cycling
  469. //! @since 1.0.0
  470. const SUB_SPORT_MOUNTAIN = 8;
  471.  
  472. //! Sub-sport for Cycling
  473. //! @since 1.0.0
  474. const SUB_SPORT_DOWNHILL = 9;
  475.  
  476. //! Sub-sport for Cycling
  477. //! @since 1.0.0
  478. const SUB_SPORT_RECUMBENT = 10;
  479.  
  480. //! Sub-sport for Cycling
  481. //! @since 1.0.0
  482. const SUB_SPORT_CYCLOCROSS = 11;
  483.  
  484. //! Sub-sport for Cycling
  485. //! @since 1.0.0
  486. const SUB_SPORT_HAND_CYCLING = 12;
  487.  
  488. //! Sub-sport for Cycling
  489. //! @since 1.0.0
  490. const SUB_SPORT_TRACK_CYCLING = 13;
  491.  
  492. //! Sub-sport for Rowing and Fitness Equipment
  493. //! @since 1.0.0
  494. const SUB_SPORT_INDOOR_ROWING = 14;
  495.  
  496. //! Sub-sport for Fitness Equipment
  497. //! @since 1.0.0
  498. const SUB_SPORT_ELLIPTICAL = 15;
  499.  
  500. //! Sub-sport for Fitness Equipment
  501. //! @since 1.0.0
  502. const SUB_SPORT_STAIR_CLIMBING = 16;
  503.  
  504. //! Sub-sport for Swimming
  505. //! @since 1.0.0
  506. const SUB_SPORT_LAP_SWIMMING = 17;
  507.  
  508. //! Sub-sport for Swimming
  509. //! @since 1.0.0
  510. const SUB_SPORT_OPEN_WATER = 18;
  511.  
  512. //! Sub-sport for Training
  513. //! @since 1.0.0
  514. const SUB_SPORT_FLEXIBILITY_TRAINING = 19;
  515.  
  516. //! Sub-sport for Training
  517. //! @since 1.0.0
  518. const SUB_SPORT_STRENGTH_TRAINING = 20;
  519.  
  520. //! Sub-sport for Activity Warm-up
  521. //! @since 1.0.0
  522. const SUB_SPORT_WARM_UP = 21;
  523.  
  524. //! Sub-sport for Sports with Matches (e.g. Tennis)
  525. //! @since 1.0.0
  526. const SUB_SPORT_MATCH = 22;
  527.  
  528. //! Sub-sport for Excercise
  529. //! @since 1.0.0
  530. const SUB_SPORT_EXERCISE = 23;
  531.  
  532. //! Sub-sport for a Sport Challenge
  533. //! @since 1.0.0
  534. const SUB_SPORT_CHALLENGE = 24;
  535.  
  536. //! Sub-sport for Fitness Equipment
  537. //! @since 1.0.0
  538. const SUB_SPORT_INDOOR_SKIING = 25;
  539.  
  540. //! Sub-sport for Training
  541. //! @since 1.0.0
  542. const SUB_SPORT_CARDIO_TRAINING = 26;
  543.  
  544. //! Session objects control the FIT recording state machine.
  545. //! @since 1.0.0
  546. class Session {
  547. //! Add a lap to the current recording by calling addLap().
  548. //! @since 1.0.0
  549. //! @return [Boolean] true if a lap was successfully created, or false if a lap could not be created
  550. function addLap() {}
  551.  
  552. //! After recording is complete, the discard() method will complete the session by
  553. //! discarding the recorded data.
  554. //! @since 1.0.0
  555. //! @return [Boolean] true if the session was succesfully discarded, else false
  556. function discard() {}
  557.  
  558. //! @deprecated The GeometryIterator class will be dropped in Connect IQ 3.x
  559. //! The GeometryIterator class will be dropped in Connect IQ 3.x
  560. //!
  561. //! Get a
  562. //! GeometryIterator for the session. Call get() to retrieve the Location. Use
  563. //! next() to iterate to the next point. It is important that the geometryIterator
  564. //! doesn't persist as this locks down the ActivityRecording. Use it to iterate the
  565. //! points and then let it go. If there are no points, null is returned.
  566. //! @since 1.0.0
  567. //! @return [GeometryIterator] A geometry iterator for the session or null
  568. function getGeometry() {}
  569.  
  570. //! Use isRecording() to check if recording is active for this session.
  571. //! @since 1.0.0
  572. //! @return [Boolean] true if recording is active, false otherwise
  573. function isRecording() {}
  574.  
  575. //! After recording is complete, the save() method will complete the session by
  576. //! storing the FIT file on the file system.
  577. //! @since 1.0.0
  578. //! @return [Boolean] true if the session was succesfully saved, or false if it was unable to save
  579. function save() {}
  580.  
  581. //! To begin recording a FIT file on the system, start() should be called.
  582. //! @since 1.0.0
  583. //! @return [Boolean] true if recording was successfully started, or false if it could not be started
  584. function start() {}
  585.  
  586. //! To stop recording a FIT file on the system, stop() should be called.
  587. //! @since 1.0.0
  588. //! @return [Boolean] true if recording was successfully stopped, or false if it could not be stopped
  589. function stop() {}
  590.  
  591. }
  592.  
  593. //! Use createSession() to create a session object with options determined by the
  594. //! caller. Only one session object is allowed to exist at a time. If there is an
  595. //! existing object that has not been closed using the save() or discard() methods,
  596. //! this method will return that object instead of creating a new one.
  597. //! @since 1.0.0
  598. //! @param [Dictionary] options A Dictionary containing session creation options
  599. //! @option [Object] :sport The primary sport being recorded (SPORT_GENERIC by default)
  600. //! @option [Object] :subSport The sport subcategory being recorded (SUB_SPORT_GENERIC by default)
  601. //! @option [String] :name Required. This is the name that will be associated with the sport being recorded. The suggested maximum length of the name is 15 characters (some devices support longer names).
  602. //! @return [Session] A new session object, or the existing session object if a session is active and has not been saved or discarded
  603. function createSession(options) {}
  604.  
  605. }
  606.  
  607. //! @since 1.0.0
  608. //! @device All devices
  609. //! @permission Ant
  610. //! @apptype Data Field
  611. //! @apptype Widget
  612. //! @apptype App
  613. module Ant {
  614. //! Message ID's
  615. //! @since 1.0.0
  616. const MSG_ID_RF_EVENT = 0x01;
  617.  
  618. //! @since 1.0.0
  619. const MSG_ID_UNASSIGN_CHANNEL = 0x41;
  620.  
  621. //! @since 1.0.0
  622. const MSG_ID_ASSIGN_CHANNEL = 0x42;
  623.  
  624. //! @since 1.0.0
  625. const MSG_ID_CHANNEL_ID = 0x51;
  626.  
  627. //! @since 1.0.0
  628. const MSG_ID_CHANNEL_PERIOD = 0x43;
  629.  
  630. //! @since 1.0.0
  631. const MSG_ID_SEARCH_TIMEOUT = 0x44;
  632.  
  633. //! @since 1.0.0
  634. const MSG_ID_CHANNEL_RF_FREQUENCY = 0x45;
  635.  
  636. //! @since 1.0.0
  637. const MSG_ID_NETWORK_KEY = 0x46;
  638.  
  639. //! @since 1.0.0
  640. const MSG_ID_TRANSMIT_POWER = 0x47;
  641.  
  642. //! @since 1.0.0
  643. const MSG_ID_CHANNEL_TRANSMIT_POWER = 0x60;
  644.  
  645. //! @since 1.0.0
  646. const MSG_ID_LOW_PRIORITY_SEARCH_TIMEOUT = 0x63;
  647.  
  648. //! @since 1.0.0
  649. const MSG_ID_LIB_CONFIG = 0x6E;
  650.  
  651. //! @since 1.0.0
  652. const MSG_ID_PROXIMITY_SEARCH = 0x71;
  653.  
  654. //! @since 1.0.0
  655. const MSG_ID_RESET_SYSTEM = 0x4A;
  656.  
  657. //! @since 1.0.0
  658. const MSG_ID_OPEN_CHANNEL = 0x4B;
  659.  
  660. //! @since 1.0.0
  661. const MSG_ID_CLOSE_CHANNEL = 0x4C;
  662.  
  663. //! @since 1.0.0
  664. const MSG_ID_BROADCAST_DATA = 0x4E;
  665.  
  666. //! @since 1.0.0
  667. const MSG_ID_ACKNOWLEDGED_DATA = 0x4F;
  668.  
  669. //! @since 1.0.0
  670. const MSG_ID_CHANNEL_RESPONSE_EVENT = 0x40;
  671.  
  672. //! Message Code's for the response event
  673. //! @since 1.0.0
  674. const MSG_CODE_RESPONSE_NO_ERROR = 0x00;
  675.  
  676. //! @since 1.0.0
  677. const MSG_CODE_EVENT_RX_SEARCH_TIMEOUT = 0x01;
  678.  
  679. //! @since 1.0.0
  680. const MSG_CODE_EVENT_RX_FAIL = 0x02;
  681.  
  682. //! @since 1.0.0
  683. const MSG_CODE_EVENT_TX = 0x03;
  684.  
  685. //! @since 1.0.0
  686. const MSG_CODE_EVENT_TRANSFER_RX_FAILED = 0x04;
  687.  
  688. //! @since 1.0.0
  689. const MSG_CODE_EVENT_TRANSFER_TX_COMPLETED = 0x05;
  690.  
  691. //! @since 1.0.0
  692. const MSG_CODE_EVENT_TRANSFER_TX_FAILED = 0x06;
  693.  
  694. //! @since 1.0.0
  695. const MSG_CODE_EVENT_CHANNEL_CLOSED = 0x07;
  696.  
  697. //! @since 1.0.0
  698. const MSG_CODE_EVENT_RX_FAIL_GO_TO_SEARCH = 0x08;
  699.  
  700. //! @since 1.0.0
  701. const MSG_CODE_CHANNEL_IN_WRONG_STATE = 0x15;
  702.  
  703. //! @since 1.0.0
  704. const MSG_CODE_CHANNEL_ID_NOT_SET = 0x18;
  705.  
  706. //! @since 1.0.0
  707. const MSG_CODE_TRANSFER_IN_PROGRESS = 0x1F;
  708.  
  709. //! @since 1.0.0
  710. const MSG_CODE_INVALID_MESSAGE = 0x28;
  711.  
  712. //! @since 1.0.0
  713. const MSG_CODE_EVENT_QUE_OVERFLOW = 0x35;
  714.  
  715. //! Ant Network Type
  716. //! @since 1.0.0
  717. const NETWORK_PUBLIC = 0;
  718.  
  719. //! @since 1.0.0
  720. const NETWORK_PLUS = 1;
  721.  
  722. //! @since 1.2.0
  723. const NETWORK_PRIVATE = 2;
  724.  
  725. //! Channel Type
  726. //!
  727. //! Bidirectional Transmit (Master)
  728. //! @since 1.0.0
  729. const CHANNEL_TYPE_TX_NOT_RX = 0x10;
  730.  
  731. //! Bidirectional Receive (Slave)
  732. //! @since 1.0.0
  733. const CHANNEL_TYPE_RX_NOT_TX = 0x00;
  734.  
  735. //! Receive Only (Slave)
  736. //! @since 1.2.0
  737. const CHANNEL_TYPE_RX_ONLY = 0x40;
  738.  
  739. //! @since 1.0.0
  740. class ChannelAssignment {
  741. //! Whether the channel is to be primarily sending data (master) or receiving
  742. //! data(slave)
  743. //! @since 1.0.0
  744. var channelType;
  745.  
  746. //! The network the channel should operate under.
  747. //! @since 1.0.0
  748. var network;
  749.  
  750. //! Constructor for the channel object. By default disables background scanning.
  751. //! @since 1.0.0
  752. //! @param [enum] c Channel type specifier
  753. //! @param n Network
  754. //! @option [Hash] [CHANNEL_TYPE_TX_NOT_RX] a customizable set of options
  755. //! @option [Hash] [CHANNEL_TYPE_RX_NOT_TX] a customizable set of options
  756. //! @option [Hash] [CHANNEL_TYPE_RX_ONLY] a customizable set of options
  757. //! @option [Hash] [NETWORK_PUBLIC] a customizable set of options
  758. //! @option [Hash] [NETWORK_PLUS] a customizable set of options
  759. //! @option [Hash] [NETWORK_PRIVATE] a customizable set of options
  760. function initialize(c, n) {}
  761.  
  762. //! See if background scanning is enabled for the channel assignment.
  763. //! @since 1.2.0
  764. //! @return [Boolean] true - If background scan is enabled.
  765. function isBackgroundScanEnabled() {}
  766.  
  767. //! Set background scan to be enabled or disabled. Enabling background scan can only
  768. //! be done on Receive Only channels.
  769. //! @since 1.2.0
  770. //! @param [Boolean] isBackgroundScanEnabled true to enable background scan, false otherwise.
  771. //! @return [Boolean] true - If the background scan property was successfully set.
  772. function setBackgroundScan(isBackgroundScanEnabled) {}
  773.  
  774. }
  775.  
  776. //! @since 1.0.0
  777. class DeviceConfig {
  778. //! Default values for a device configuration
  779. //! @since 1.0.0
  780. const DEFAULT_DEVICE_NUMBER = 123;
  781.  
  782. //! @since 1.0.0
  783. const DEFAULT_DEVICE_TYPE = 1;
  784.  
  785. //! @since 1.0.0
  786. const DEFAULT_TRANSMISSION_TYPE = 0;
  787.  
  788. //! @since 1.0.0
  789. const DEFAULT_MESSAGE_PERIOD = 8192;
  790.  
  791. //! @since 1.0.0
  792. const DEFAULT_RADIO_FREQUENCY = 10;
  793.  
  794. //! @since 1.0.0
  795. const DEFAULT_SEARCH_TIMEOUT_LOW = 6;
  796.  
  797. //! @since 1.0.0
  798. const DEFAULT_SEARCH_TIMEOUT_HIGH = 0;
  799.  
  800. //! @since 1.0.0
  801. const DEFAULT_THRESHOLD = 0;
  802.  
  803. //! @since 1.2.0
  804. const DEFAULT_NETWORK_KEY = 0;
  805.  
  806. //! Network key lengths
  807. //! @since 1.2.0
  808. const NETWORK_KEY_LENGTH_64BIT = 8;
  809.  
  810. //! @since 1.2.0
  811. const NETWORK_KEY_LENGTH_128BIT = 16;
  812.  
  813. //! Unique device number (ANT-id)
  814. //! @since 1.0.0
  815. var deviceNumber;
  816.  
  817. //! 1-Byte device type identifier (See ANT Protocol for pre-defined Device Types)
  818. //! @since 1.0.0
  819. var deviceType;
  820.  
  821. //! Message period that the sensor uses
  822. //! @since 1.0.0
  823. var messagePeriod;
  824.  
  825. //! 128 bit network key
  826. //! @since 1.2.0
  827. var networkKey128Bit;
  828.  
  829. //! 64 bit network key
  830. //! @since 1.2.0
  831. var networkKey64Bit;
  832.  
  833. //! Radio frequency that the sensor operates on
  834. //! @since 1.0.0
  835. var radioFrequency;
  836.  
  837. //! Proximity threshold bin
  838. //! @since 1.0.0
  839. var searchThreshold;
  840.  
  841. //! High Priority search timeout (2.5s increments) that a receiving channel will
  842. //! wait for in order to start tracking a master. Limited to a maximum of 5 seconds
  843. //! (Range of 0 to 2).
  844. //! @since 1.0.0
  845. var searchTimeoutHighPriority;
  846.  
  847. //! Low Priority search timeout (2.5s increments) that a receiving channel will wait
  848. //! for in order to start tracking a master. Limited to a maximum of 30 seconds
  849. //! (Range of 0 to 12).
  850. //! @since 1.0.0
  851. var searchTimeoutLowPriority;
  852.  
  853. //! Manufacturer-specific transport type and extended device number
  854. //! @since 1.0.0
  855. var transmissionType;
  856.  
  857. //! Constructor for the device config object
  858. //! @since 1.2.0
  859. //! @param [Dictionary] options initialization options
  860. //! @option [Hash] [:deviceNumber] a customizable set of options
  861. //! @option [Hash] [:deviceType] a customizable set of options
  862. //! @option [Hash] [:transmissionType] a customizable set of options
  863. //! @option [Hash] [:messagePeriod] a customizable set of options
  864. //! @option [Hash] [:radioFrequency] a customizable set of options
  865. //! @option [Hash] [:searchTimeoutLowPriority] a customizable set of options
  866. //! @option [Hash] [:searchTimeoutHighPriority] a customizable set of options
  867. //! @option [Hash] [:searchThreshold] a customizable set of options
  868. //! @option [Hash] [:networkKey64Bit] a customizable set of options
  869. //! @option [Hash] [:networkKey128Bit] a customizable set of options
  870. function initialize(options) {}
  871.  
  872. }
  873.  
  874. //! @since 1.0.0
  875. class GenericChannel {
  876. //! Constructor for the generic channel throws UnableToAcquireChannelException if
  877. //! the the system does not have a channel available.
  878. //! @since 1.0.0
  879. //! @param [Method] listener Method object to call with sensor updates.
  880. //! @param [ChannelAssignment] ca ChannelAssignment object for the channel
  881. function initialize(listener, ca) {}
  882.  
  883. //! Close a generic ANT Channel
  884. //! @since 1.0.0
  885. function close() {}
  886.  
  887. //! Get the current ANT channel configuration
  888. //! @since 1.0.0
  889. //! @return [DeviceConfig] DeviceConfig object with current channel device configuration.
  890. function getDeviceConfig() {}
  891.  
  892. //! Open a generic ANT Channel
  893. //! @since 1.0.0
  894. //! @return [Boolean] true - If successfully opened the channel
  895. function open() {}
  896.  
  897. //! Release the generic ANT Channel back to the system. If it is open it will be
  898. //! automatically closed.
  899. //! @since 1.0.0
  900. function release() {}
  901.  
  902. //! Sends an acknowledge message
  903. //! @since 1.0.0
  904. //! @param [Integer] data 8 byte data packet
  905. function sendAcknowledge(data) {}
  906.  
  907. //! Sends a broadcast message
  908. //! @since 1.0.0
  909. //! @param [Integer] data 8 byte data packet
  910. function sendBroadcast(data) {}
  911.  
  912. //! Set the current ANT channel configuration
  913. //! @since 1.0.0
  914. //! @param [DeviceConfig] config DeviceConfig object to set
  915. function setDeviceConfig(config) {}
  916.  
  917. }
  918.  
  919. //! @since 1.0.0
  920. class Message {
  921. //! @since 1.0.0
  922. const DATA_PAYLOAD_LENGTH = 8;
  923.  
  924. //! Unique device number (ANT-id)
  925. //! @since 1.2.0
  926. var deviceNumber;
  927.  
  928. //! 1-Byte device type identifier (See ANT Protocol for pre-defined Device Types)
  929. //! @since 1.2.0
  930. var deviceType;
  931.  
  932. //! Number of data bytes in the data payload ( not including any extended data if
  933. //! applicable )
  934. //! @since 1.0.0
  935. var length;
  936.  
  937. //! Data Type Identifier
  938. //! @since 1.0.0
  939. var messageId;
  940.  
  941. //! Received Signal Strength Indication
  942. //! @since 1.0.0
  943. var rssi;
  944.  
  945. //! Timestamp of received message generated off of a 32.768 kHz clock. Rolls over
  946. //! every 2 seconds.
  947. //! @since 1.2.0
  948. var timestamp;
  949.  
  950. //! Manufacturer-specific transport type and extended device number
  951. //! @since 1.2.0
  952. var transmissionType;
  953.  
  954. //! Get the ANT data packet
  955. //! @since 1.0.0
  956. //! @return [Array] Array of integers representing the bytes of the data payload
  957. function getPayload() {}
  958.  
  959. //! Set the ANT data packet.
  960. //! @since 1.0.0
  961. //! @param [Array] data Array of integers representing the bytes of the data payload
  962. function setPayload(data) {}
  963.  
  964. }
  965.  
  966. //! UnableToAcquireChannelException is thrown if the Generic Channel initializer is
  967. //! unable to acquire an ANT channel from the system. This indicates that all
  968. //! available ANT channels are in use.
  969. //! @since 1.2.0
  970. module toplevel {
  971. //! Constructor
  972. //! @since 1.2.0
  973. function initialize() {}
  974.  
  975. }
  976.  
  977. }
  978.  
  979. //! The Application module contains the base class for every Connect IQ app.
  980. //! @since 1.0.0
  981. module Application {
  982. //! AppBase is the base class for an app. All apps shall inherit from this class. It
  983. //! is used to manage the lifecycle of an app. For widgets and watch-apps, the
  984. //! functions are called in the following order: onStart(), getInitialView() and
  985. //! onStop(). For watchfaces and datafields, only getInitialView() is called. Every
  986. //! AppBase object has access to an object store to persist data.
  987. //! @since 1.0.0
  988. class AppBase {
  989. //! Clears the object store for the application.
  990. //! @since 1.0.0
  991. function clearProperties() {}
  992.  
  993. //! Deletes the given key from the object store.
  994. //! @since 1.0.0
  995. //! @param key The key to delete
  996. function deleteProperty(key) {}
  997.  
  998. //! To retrieve the initial WatchUi.View and WatchUi.InputDelegate of the
  999. //! application, call getInitialView(). Providing a WatchUi.InputDelegate is
  1000. //! optional for widgets and watch-apps. For watchfaces and datafields, an array
  1001. //! containing just a WatchUi.View should be returned as input is not available for
  1002. //! these app types.
  1003. //! @since 1.0.0
  1004. //! @return [Array] An array containing [ WatchUi.View, WatchUi.InputDelegate (optional) ]
  1005. function getInitialView() {}
  1006.  
  1007. //! To get the data associated with the given key from the object store, use
  1008. //! getProperty().
  1009. //! @since 1.0.0
  1010. //! @param key Key of the value to retrieve from the object store (cannot be a Symbol)
  1011. //! @return [Object] Content associated with the key, or null if the key is not in the object store
  1012. function getProperty(key) {}
  1013.  
  1014. //! @deprecated loadProperties() will be removed in Connect IQ 3.0.0
  1015. //! loadProperties() will be removed in Connect IQ 3.0.0
  1016. //!
  1017. //! Load the properties for
  1018. //! this app
  1019. //! @since 1.0.0
  1020. function loadProperties() {}
  1021.  
  1022. //! When an application is started as a result of a system Event, the the onEvent
  1023. //! method is called after onStart.
  1024. //! @since 1.2.0
  1025. //! @param [Dictionary] properties The properties provided when the Event was scheduled
  1026. function onEvent(properties) {}
  1027.  
  1028. //! Called when the application settings have been changed by Garmin Connect Mobile
  1029. //! while while the app is running.
  1030. //! @since 1.2.0
  1031. function onSettingsChanged() {}
  1032.  
  1033. //! Before the initial WatchUi.View is retrieved, onStart() is called. This is where
  1034. //! app level settings can be initialized or retrieved from the object store before
  1035. //! the initial View is created.
  1036. //! @since 1.0.0
  1037. //! @param [Dictionary] state Unused
  1038. function onStart(state) {}
  1039.  
  1040. //! When the system is going to terminate an application, onStop() is called. If the
  1041. //! application needs to save state to the object store it should be done in this
  1042. //! function.
  1043. //! @since 1.0.0
  1044. //! @param [Dictionary] state Unused
  1045. function onStop(state) {}
  1046.  
  1047. //! @deprecated saveProperties() will be removed in Connect IQ 3.0.0
  1048. //! saveProperties() will be removed in Connect IQ 3.0.0
  1049. //!
  1050. //! Save the properties for
  1051. //! this app
  1052. //! @since 1.0.0
  1053. function saveProperties() {}
  1054.  
  1055. //! Using a key, store the given data in the object by calling setProperty(). Keys
  1056. //! can be of type String, Number, Float, and Boolean. Values can be of type String,
  1057. //! Number, Float, Boolean, null, and Arrays or Dictionaries containing those types.
  1058. //! There is a limit on the size of the Properties of 8KB. If you reach this limit,
  1059. //! the properties will not be saved or reloaded.
  1060. //! @since 1.0.0
  1061. //! @param key The key used to store and retrieve the value from the object store (cannot be a Symbol)
  1062. //! @param value The value to put into the object store
  1063. function setProperty(key, value) {}
  1064.  
  1065. //! Validate a property being stored
  1066. //! @since 1.0.0
  1067. function validateProperty() {}
  1068.  
  1069. }
  1070.  
  1071. //! Call getApp() to retrieve the AppBase object that is currently running.
  1072. //! @since 1.0.0
  1073. //! @return [AppBase] The currently running AppBase object
  1074. function getApp() {}
  1075.  
  1076. }
  1077.  
  1078. //! The Tone module allows for making pre-defined sounds. Not all devices support
  1079. //! this API.
  1080. //! @since 1.0.0
  1081. //! @apptype Widget
  1082. //! @apptype App
  1083. module Attention {
  1084. //! Indicates that a key was pressed
  1085. //! @since 1.0.0
  1086. //! @device All except vivoactive
  1087. const TONE_KEY = 0;
  1088.  
  1089. //! Indicates that an activity has started
  1090. //! @since 1.0.0
  1091. //! @device All except vivoactive
  1092. const TONE_START = 1;
  1093.  
  1094. //! Indicates that an acitivty has stopped
  1095. //! @since 1.0.0
  1096. //! @device All except vivoactive
  1097. const TONE_STOP = 2;
  1098.  
  1099. //! Indicates that a message is available
  1100. //! @since 1.0.0
  1101. //! @device All except vivoactive
  1102. const TONE_MSG = 3;
  1103.  
  1104. //! An alert ending with a high note
  1105. //! @since 1.0.0
  1106. //! @device All except vivoactive
  1107. const TONE_ALERT_HI = 4;
  1108.  
  1109. //! An alert ending with a low note
  1110. //! @since 1.0.0
  1111. //! @device All except vivoactive
  1112. const TONE_ALERT_LO = 5;
  1113.  
  1114. //! A loud beep
  1115. //! @since 1.0.0
  1116. //! @device All except vivoactive
  1117. const TONE_LOUD_BEEP = 6;
  1118.  
  1119. //! Indicates a change in interval
  1120. //! @since 1.0.0
  1121. //! @device All except vivoactive
  1122. const TONE_INTERVAL_ALERT = 7;
  1123.  
  1124. //! Indicates an alarm has triggered
  1125. //! @since 1.0.0
  1126. //! @device All except vivoactive
  1127. const TONE_ALARM = 8;
  1128.  
  1129. //! Indicates that the activity was reset
  1130. //! @since 1.0.0
  1131. //! @device All except vivoactive
  1132. const TONE_RESET = 9;
  1133.  
  1134. //! Indicates that the user has completed a lap
  1135. //! @since 1.0.0
  1136. //! @device All except vivoactive
  1137. const TONE_LAP = 10;
  1138.  
  1139. //! An annoying sound to get the users attention
  1140. //! @since 1.0.0
  1141. //! @device All except vivoactive
  1142. const TONE_CANARY = 11;
  1143.  
  1144. //! An alert that a time threshold has been met
  1145. //! @since 1.0.0
  1146. //! @device All except vivoactive
  1147. const TONE_TIME_ALERT = 12;
  1148.  
  1149. //! An alert that a distance threshold has been met
  1150. //! @since 1.0.0
  1151. //! @device All except vivoactive
  1152. const TONE_DISTANCE_ALERT = 13;
  1153.  
  1154. //! Indicates that the activity was a failure
  1155. //! @since 1.0.0
  1156. //! @device All except vivoactive
  1157. const TONE_FAILURE = 14;
  1158.  
  1159. //! Indicates that the activity was a success
  1160. //! @since 1.0.0
  1161. //! @device All except vivoactive
  1162. const TONE_SUCCESS = 15;
  1163.  
  1164. //! The power on tone
  1165. //! @since 1.0.0
  1166. //! @device All except vivoactive
  1167. const TONE_POWER = 16;
  1168.  
  1169. //! Indicates that the device has low battery power
  1170. //! @since 1.0.0
  1171. //! @device All except vivoactive
  1172. const TONE_LOW_BATTERY = 17;
  1173.  
  1174. //! Indicates an error occurred
  1175. //! @since 1.0.0
  1176. //! @device All except vivoactive
  1177. const TONE_ERROR = 18;
  1178.  
  1179. //! @since 1.0.0
  1180. //! @device All non-Edge devices
  1181. class VibeProfile {
  1182. //! Duty Cycle of the vibration, has a range of [0, 100]
  1183. //! @since 1.0.0
  1184. var dutyCycle;
  1185.  
  1186. //! Length of the vibration, in milliseconds
  1187. //! @since 1.0.0
  1188. var length;
  1189.  
  1190. //! Returns a new instance of VibeProfile
  1191. //! @since 1.0.0
  1192. function initialize() {}
  1193.  
  1194. }
  1195.  
  1196. //! Turn on or off the backlight.
  1197. //! @since 1.0.0
  1198. //! @device All devices
  1199. //! @param [Boolean] onOff true to turn on backlight, false otherwise.
  1200. function backlight(onOff) {}
  1201.  
  1202. //! Play a tone.
  1203. //! @since 1.0.0
  1204. //! @device All except vivoactive
  1205. //! @param tone TONE_XXX value to play
  1206. function playTone(tone) {}
  1207.  
  1208. //! Use the vibe motor
  1209. //! @since 1.0.0
  1210. //! @device All non-Edge devices
  1211. //! @param [Array] vibe Array of VibeProfile objects to play in sequence. Maximum of 8 supported.
  1212. function vibrate(vibe) {}
  1213.  
  1214. }
  1215.  
  1216. //! Widgets and apps will be able to communicate with a mobile phone via Bluetooth
  1217. //! Low Energy (BLE). The mobile phone may be sharing data with the device, or it
  1218. //! may act as a bridge between the app and the Internet. This allows the mobile
  1219. //! phone to become part of the wearable web.
  1220. //! @since 1.0.0
  1221. //! @device All devices
  1222. //! @permission Communications
  1223. //! @apptype Widget
  1224. //! @apptype App
  1225. module Communications {
  1226. //! Additional Resonse codes that can occur from JSON requests
  1227. //! @since 1.0.0
  1228. const UNKNOWN_ERROR = 0;
  1229.  
  1230. //! @since 1.0.0
  1231. const BLE_ERROR = -1;
  1232.  
  1233. //! @since 1.0.0
  1234. const BLE_HOST_TIMEOUT = -2;
  1235.  
  1236. //! @since 1.0.0
  1237. const BLE_SERVER_TIMEOUT = -3;
  1238.  
  1239. //! @since 1.0.0
  1240. const BLE_NO_DATA = -4;
  1241.  
  1242. //! @since 1.0.0
  1243. const BLE_REQUEST_CANCELLED = -5;
  1244.  
  1245. //! @since 1.0.0
  1246. const BLE_QUEUE_FULL = -101;
  1247.  
  1248. //! @since 1.0.0
  1249. const BLE_REQUEST_TOO_LARGE = -102;
  1250.  
  1251. //! @since 1.0.0
  1252. const BLE_UNKNOWN_SEND_ERROR = -103;
  1253.  
  1254. //! @since 1.0.0
  1255. const BLE_CONNECTION_UNAVAILABLE = -104;
  1256.  
  1257. //! @since 1.0.0
  1258. const INVALID_HTTP_HEADER_FIELDS_IN_REQUEST = -200;
  1259.  
  1260. //! @since 1.0.0
  1261. const INVALID_HTTP_BODY_IN_REQUEST = -201;
  1262.  
  1263. //! @since 1.0.0
  1264. const INVALID_HTTP_METHOD_IN_REQUEST = -202;
  1265.  
  1266. //! @since 1.0.0
  1267. const NETWORK_REQUEST_TIMED_OUT = -300;
  1268.  
  1269. //! @since 1.0.0
  1270. const INVALID_HTTP_BODY_IN_NETWORK_RESPONSE = -400;
  1271.  
  1272. //! @since 1.0.0
  1273. const INVALID_HTTP_HEADER_FIELDS_IN_NETWORK_RESPONSE = -401;
  1274.  
  1275. //! @since 1.0.0
  1276. const NETWORK_RESPONSE_TOO_LARGE = -402;
  1277.  
  1278. //! @since 1.2.0
  1279. const HTTP_REQUEST_METHOD_GET = 1;
  1280.  
  1281. //! @since 1.2.0
  1282. const HTTP_REQUEST_METHOD_PUT = 2;
  1283.  
  1284. //! @since 1.2.0
  1285. const HTTP_REQUEST_METHOD_POST = 3;
  1286.  
  1287. //! @since 1.2.0
  1288. const HTTP_REQUEST_METHOD_DELETE = 4;
  1289.  
  1290. //! These values are used in conjunction with the “Content-Type” header
  1291. //! key.
  1292. //!
  1293. //! Specifies a content type of application/x-www-form-urlencoded
  1294. //! @since 1.2.0
  1295. const REQUEST_CONTENT_TYPE_URL_ENCODED = 0;
  1296.  
  1297. //! Specifies a content type of application/json
  1298. //! @since 1.2.0
  1299. const REQUEST_CONTENT_TYPE_JSON = 1;
  1300.  
  1301. //! @since 1.2.0
  1302. const IMAGE_DITHERING_NONE = 1;
  1303.  
  1304. //! @since 1.2.0
  1305. const IMAGE_DITHERING_FLOYD_STEINBERG = 2;
  1306.  
  1307. //! @since 1.0.0
  1308. class ConnectionListener {
  1309. //! Callback when a communications operation completes.
  1310. //! @since 1.0.0
  1311. function onComplete() {}
  1312.  
  1313. //! Callback when a communications operation error occurs.
  1314. //! @since 1.0.0
  1315. function onError() {}
  1316.  
  1317. }
  1318.  
  1319. //! The MailboxIterator is used to get the messages out of the Mailbox.
  1320. //! @since 1.0.0
  1321. class MailboxIterator {
  1322. //! Call next() to get the next message from the mailbox.
  1323. //! @since 1.0.0
  1324. //! @return Message content, or null if no messages
  1325. function next() {}
  1326.  
  1327. }
  1328.  
  1329. //! To cancel all pending JSON and Image requests use cancelAllRequests()
  1330. //! @since 1.2.0
  1331. function cancelAllRequests() {}
  1332.  
  1333. //! To clear the contents of the mailbox, call emptyMailbox().
  1334. //! @since 1.0.0
  1335. function emptyMailbox() {}
  1336.  
  1337. //! Convert a URL string into a percent-encoded string. The reserved characters in
  1338. //! the string will be replaced with their corresponding hex-value pairs. This
  1339. //! follows the URI-encoding scheme as detailed by RFC 3986 which can be found here:
  1340. //! www.ietf.org/rfc/rfc3986.txt
  1341. //! @since 1.1.2
  1342. //! @param [String] url The URL string to be encoded
  1343. //! @return [String] Percent-encoded string
  1344. function encodeURL(url) {}
  1345.  
  1346. //! Call getMailbox() to get the MailboxIterator for this App's mailbox.
  1347. //! @since 1.0.0
  1348. //! @return [MailboxIterator] Iterator for the mailbox
  1349. function getMailbox() {}
  1350.  
  1351. //! To request an image through Garmin Connect Mobile, call makeImageRequest(). GCM
  1352. //! will scale and dither the image based on the capabilities of the device, but the
  1353. //! user will be able to pass additional options (like dithering it down to a one
  1354. //! color image)
  1355. //! @since 1.2.0
  1356. //! @param [String] url URL of image to request
  1357. //! @param [Dictionary] parameters Dictionary of keys and values, appended to the URL. Can be null.
  1358. //! @param [Dictionary] options Additional image options
  1359. //! @param [Method] responseCallback This is a callback in the format function responseCallback(responseCode, data); responseCode has the server response code, and data contains a WatchUi.BitmapResource if it was successful.
  1360. //! @option [Array] :palette The color palette to restrict the image dithering to. Using a smaller palette can reduce the size of the image data to speed up transfers.
  1361. //! @option [Number] :maxWidth The maximum width an image should be scaled to
  1362. //! @option [Number] :maxHeight The maximum height an image should be scaled to
  1363. //! @option [Number] :dithering The type of dithering to use when processing the image. Defaults to Floyd-Steinberg.
  1364. function makeImageRequest(url, parameters, options, responseCallback) {}
  1365.  
  1366. //! To use Garmin Connect Mobile as a proxy to the web, use makeJsonRequest(). The
  1367. //! request is asynchronous; the responseCallback will be called when the request
  1368. //! returns.
  1369. //! @since 1.0.0
  1370. //! @param [String] url The URL being requested
  1371. //! @param [Dictionary] parameters Dictionary of keys and values, appended to the URL as a GET request or set as the body for a POST request. Can be null.
  1372. //! @param [Dictionary] options Dictionary of options. Can be null.
  1373. //! @param [Method] responseCallback This is a callback in the format function responseCallback(responseCode, data); responseCode has the server response code, and data contains a Dictionary of content if the request was successful.
  1374. //! @option [Number] :method The HTTP method of the request. Should be a HTTP_REQUEST_METHOD_* value.
  1375. //! @option [Dictionary] :headers A Dictionary of HTTP headers to include in the request. The “Content-Type” header can be specified using a REQUEST_CONTENT_TYPE_* value. If the content type is not specified, it will default to “appllication/json” for GET and DELETE requests, and will default to “application/x-www-form-urlencoded” for POST and PUT requests.
  1376. function makeJsonRequest(url, parameters, options, responseCallback) {}
  1377.  
  1378. //! Add a listener for mailbox events. The listener method is called whenever a new
  1379. //! message is received
  1380. //! @since 1.0.0
  1381. //! @param [Method] listener Callback in the format function listener(iterator) where iterator is the mailbox iterator for the app
  1382. function setMailboxListener(listener) {}
  1383.  
  1384. //! Send data across the the BLE link.
  1385. //! @since 1.0.0
  1386. //! @param [Object] content The object to be sent
  1387. //! @param [Dictionary] options Additional transmit options (TBD)
  1388. //! @param [ConnectionListener] listener An extension of the ConnectionListener class
  1389. function transmit(content, options, listener) {}
  1390.  
  1391. }
  1392.  
  1393. //! The Graphics module provides basic drawing functionality.
  1394. //! @since 1.0.0
  1395. module Graphics {
  1396. //! Extra tiny font
  1397. //! @since 1.0.0
  1398. const FONT_XTINY = 0;
  1399.  
  1400. //! Tiny font
  1401. //! @since 1.0.0
  1402. const FONT_TINY = 1;
  1403.  
  1404. //! Small font
  1405. //! @since 1.0.0
  1406. const FONT_SMALL = 2;
  1407.  
  1408. //! Medium font
  1409. //! @since 1.0.0
  1410. const FONT_MEDIUM = 3;
  1411.  
  1412. //! Large font
  1413. //! @since 1.0.0
  1414. const FONT_LARGE = 4;
  1415.  
  1416. //! Normal size number only font
  1417. //! @since 1.0.0
  1418. const FONT_NUMBER_MILD = 5;
  1419.  
  1420. //! Medium size number only font
  1421. //! @since 1.0.0
  1422. const FONT_NUMBER_MEDIUM = 6;
  1423.  
  1424. //! Large size number only font
  1425. //! @since 1.0.0
  1426. const FONT_NUMBER_HOT = 7;
  1427.  
  1428. //! Huge size number only font
  1429. //! @since 1.0.0
  1430. const FONT_NUMBER_THAI_HOT = 8;
  1431.  
  1432. //! White
  1433. //! @since 1.0.0
  1434. const COLOR_WHITE = 0xFFFFFF;
  1435.  
  1436. //! Light Gray
  1437. //! @since 1.0.0
  1438. const COLOR_LT_GRAY = 0xAAAAAA;
  1439.  
  1440. //! Dark Gray
  1441. //! @since 1.0.0
  1442. const COLOR_DK_GRAY = 0x555555;
  1443.  
  1444. //! Black
  1445. //! @since 1.0.0
  1446. const COLOR_BLACK = 0x000000;
  1447.  
  1448. //! Red
  1449. //! @since 1.0.0
  1450. const COLOR_RED = 0xFF0000;
  1451.  
  1452. //! Dark Red
  1453. //! @since 1.0.0
  1454. const COLOR_DK_RED = 0xAA0000;
  1455.  
  1456. //! Orange
  1457. //! @since 1.0.0
  1458. const COLOR_ORANGE = 0xFF5500;
  1459.  
  1460. //! Yellow
  1461. //! @since 1.0.0
  1462. const COLOR_YELLOW = 0xFFAA00;
  1463.  
  1464. //! Green
  1465. //! @since 1.0.0
  1466. const COLOR_GREEN = 0x00FF00;
  1467.  
  1468. //! Dark Green
  1469. //! @since 1.0.0
  1470. const COLOR_DK_GREEN = 0x00AA00;
  1471.  
  1472. //! Blue
  1473. //! @since 1.0.0
  1474. const COLOR_BLUE = 0x00AAFF;
  1475.  
  1476. //! Dark Blue
  1477. //! @since 1.0.0
  1478. const COLOR_DK_BLUE = 0x0000FF;
  1479.  
  1480. //! Purple. Not valid on Fenix 3 or D2 Bravo. Use 0x5500AA instead.
  1481. //! @since 1.0.0
  1482. const COLOR_PURPLE = 0xAA00FF;
  1483.  
  1484. //! Pink
  1485. //! @since 1.0.0
  1486. const COLOR_PINK = 0xFF00FF;
  1487.  
  1488. //! Transparent
  1489. //! @since 1.0.0
  1490. const COLOR_TRANSPARENT = -1;
  1491.  
  1492. //! Right justify the text at the x/y coordinates
  1493. //! @since 1.0.0
  1494. const TEXT_JUSTIFY_RIGHT = 0;
  1495.  
  1496. //! Center justify the text at the x/y coordinates
  1497. //! @since 1.0.0
  1498. const TEXT_JUSTIFY_CENTER = 1;
  1499.  
  1500. //! Left justify the text at the x/y coordinates
  1501. //! @since 1.0.0
  1502. const TEXT_JUSTIFY_LEFT = 2;
  1503.  
  1504. //! Center the text vertically
  1505. //! @since 1.0.0
  1506. const TEXT_JUSTIFY_VCENTER = 4;
  1507.  
  1508. //! Counter clockwise draw
  1509. //! @since 1.2.0
  1510. const ARC_COUNTER_CLOCKWISE = 0;
  1511.  
  1512. //! Clockwise draw
  1513. //! @since 1.2.0
  1514. const ARC_CLOCKWISE = 1;
  1515.  
  1516. //! This class represents a device context. It provides methods to perform drawing
  1517. //! operations on the device.
  1518. //! @since 1.0.0
  1519. class Dc {
  1520. //! Erase the screen using the background color by calling clear().
  1521. //! @since 1.0.0
  1522. function clear() {}
  1523.  
  1524. //! Use drawArc() to draw an arc. 0 degree: 3 o'clock position. 90 degrees: 12
  1525. //! o'clock position. 180 degrees: 9 o'clock position. 270 degrees: 6 o'clock
  1526. //! position.
  1527. //! @since 1.2.0
  1528. //! @param [Number] x X location of arc center
  1529. //! @param [Number] y Y location of arc center
  1530. //! @param [Number] r radius of arc.
  1531. //! @param [Number] attr Arc drawing attributes. (ARC_COUNTER_CLOCKWISE or ARC_CLOCKWISE)
  1532. //! @param [Number] degreeStart The start angle of the arc by degrees.
  1533. //! @param [Number] degreeEnd The end angle of the arc by degrees.
  1534. function drawArc(x, y, r, attr, degreeStart, degreeEnd) {}
  1535.  
  1536. //! Draw a bitmap to the screen with drawBitmap().
  1537. //! @since 1.0.0
  1538. //! @param [Number] x Top left X coordinate to begin the draw
  1539. //! @param [Number] y Top left Y coordinate to begin the draw
  1540. //! @param [Symbol] rez The bitmap resource to draw
  1541. function drawBitmap(x, y, rez) {}
  1542.  
  1543. //! Use drawCircle() to draw a circle around a point.
  1544. //! @since 1.0.0
  1545. //! @param [Number] x X location of circle center
  1546. //! @param [Number] y Y location of circle center
  1547. //! @param [Number] radius Radius of circle
  1548. function drawCircle(x, y, radius) {}
  1549.  
  1550. //! Use drawEllispe() to draw an ellipse around a point.
  1551. //! @since 1.0.0
  1552. //! @param [Number] x X location of ellipse center
  1553. //! @param [Number] y Y location of ellipse center
  1554. //! @param [Number] a The radius of the ellipse along the x axis
  1555. //! @param [Number] b The radius of the ellipse along the y axis
  1556. function drawEllipse(x, y, a, b) {}
  1557.  
  1558. //! Draw a line between two points using drawLine().
  1559. //! @since 1.0.0
  1560. //! @param [Number] x1 First x coord
  1561. //! @param [Number] y1 First y coord
  1562. //! @param [Number] x2 Second x coord
  1563. //! @param [Number] y2 Second y coord
  1564. function drawLine(x1, y1, x2, y2) {}
  1565.  
  1566. //! Draw a point on the screen with drawPoint().
  1567. //! @since 1.0.0
  1568. //! @param [Number] x X location of point
  1569. //! @param [Number] y Y location of point
  1570. function drawPoint(x, y) {}
  1571.  
  1572. //! Draw a rectangle with drawRectangle().
  1573. //! @since 1.0.0
  1574. //! @param [Number] x X location of upper corner
  1575. //! @param [Number] y Y location of upper corner
  1576. //! @param [Number] width Width value of rectangle
  1577. //! @param [Number] height Height value of rectangle
  1578. function drawRectangle(x, y, width, height) {}
  1579.  
  1580. //! Draw a rounded rectangle with drawRoundedRectangle().
  1581. //! @since 1.0.0
  1582. //! @param [Number] x X location of upper corner
  1583. //! @param [Number] y Y location of upper corner
  1584. //! @param [Number] width Width value of rectangle
  1585. //! @param [Number] height Height value of rectangle
  1586. //! @param [Number] radius Radius of rounding.
  1587. function drawRoundedRectangle(x, y, width, height, radius) {}
  1588.  
  1589. //! Draw text at the given location using drawText().
  1590. //! @since 1.0.0
  1591. //! @param [Number] x X location of text
  1592. //! @param [Number] y Y location of text
  1593. //! @param [Number] font Font to use. This can be a custom font loaded from resources or a Graphics.FONT_XXX value.
  1594. //! @param [Number] text String to render
  1595. //! @param justification One of the Graphics.TEXT_JUSTIFY_XXX constants
  1596. function drawText(x, y, font, text, justification) {}
  1597.  
  1598. //! Fill a circle with the foreground color using fillCircle().
  1599. //! @since 1.0.0
  1600. //! @param [Number] x X location of circle center
  1601. //! @param [Number] y Y location of circle center
  1602. //! @param [Number] radius Radius of circle
  1603. function fillCircle(x, y, radius) {}
  1604.  
  1605. //! Fill an ellipse with the foreground color using fillEllipse().
  1606. //! @since 1.0.0
  1607. //! @param [Number] x X location of ellipse center
  1608. //! @param [Number] y Y location of ellipse center
  1609. //! @param [Number] a The radius of the ellipse along the x axis
  1610. //! @param [Number] b The radius of the ellipse along the y axis
  1611. function fillEllipse(x, y, a, b) {}
  1612.  
  1613. //! To fill a polygon, use fillPolygon().
  1614. //! @since 1.0.0
  1615. //! @param [Array] pts Array of coordinates with a 64 point limit
  1616. function fillPolygon(pts) {}
  1617.  
  1618. //! Fill a rectangle with the foreground color using fillRectangle().
  1619. //! @since 1.0.0
  1620. //! @param [Number] x X location of upper corner
  1621. //! @param [Number] y Y location of upper corner
  1622. //! @param [Number] width Width value of rectangle
  1623. //! @param [Number] height Height value of rectangle
  1624. function fillRectangle(x, y, width, height) {}
  1625.  
  1626. //! Fill a rounded rectangle with the foreground color using fillRoundedRectangle().
  1627. //! @since 1.0.0
  1628. //! @param [Number] x X location of upper corner
  1629. //! @param [Number] y Y location of upper corner
  1630. //! @param [Number] width Width value of rectangle
  1631. //! @param [Number] height Height value of rectangle
  1632. //! @param [Number] radius Radius of rounding
  1633. function fillRoundedRectangle(x, y, width, height, radius) {}
  1634.  
  1635. //! Get The Font Height by using getFontHeight().
  1636. //! @since 1.0.0
  1637. //! @param [Number] font Font to use
  1638. //! @return [Number] The height of the font
  1639. function getFontHeight(font) {}
  1640.  
  1641. //! Use getHeight() to get the height of the display.
  1642. //! @since 1.0.0
  1643. //! @return [Number] Height of display
  1644. function getHeight() {}
  1645.  
  1646. //! Get the width and height of a string. This takes new lines into account when
  1647. //! determining the height. The width is the maximum width for a given line of the
  1648. //! string. If a string has two n in it, the height would be for three lines and the
  1649. //! width would be the width of the longest string.
  1650. //! @since 1.0.0
  1651. //! @param [String] text Text to get width for
  1652. //! @param font FONT constant or font resource of text
  1653. //! @return [Array] width, height of string in pixels
  1654. function getTextDimensions(text, font) {}
  1655.  
  1656. //! Get the width of a string with getTextWidthInPixels().
  1657. //! @since 1.0.0
  1658. //! @param [String] text Text to get width for
  1659. //! @param font FONT constant or font resource of text
  1660. //! @return [Number] Width of string in pixels
  1661. function getTextWidthInPixels(text, font) {}
  1662.  
  1663. //! Use getWidth() to get the width of the display.
  1664. //! @since 1.0.0
  1665. //! @return [Number] Width of display
  1666. function getWidth() {}
  1667.  
  1668. //! Use setColor() to set the current foreground and background colors.
  1669. //! @since 1.0.0
  1670. //! @param foreground COLOR constant or 24-bit integer of the form 0xRRGGBB
  1671. //! @param background COLOR constant or 24-bit integer of the form 0xRRGGBB
  1672. function setColor(foreground, background) {}
  1673.  
  1674. //! Use setPenWidth() to set the width of a line
  1675. //! @since 1.0.0
  1676. //! @param [Number] width in pixels
  1677. function setPenWidth(width) {}
  1678.  
  1679. }
  1680.  
  1681. //! Gets the recommended distance above the baseline for single spaced text. The
  1682. //! base line is the line on which the text sits.
  1683. //! @since 1.2.0
  1684. //! @param [Number] font Font to use
  1685. //! @return [Number] The ascent of the font
  1686. function getFontAscent(font) {}
  1687.  
  1688. //! Gets the recommended distance below the baseline for single spaced text. The
  1689. //! base line is the line on which the text sits.
  1690. //! @since 1.2.0
  1691. //! @param [Number] font Font to use
  1692. //! @return [Number] The descent of the font
  1693. function getFontDescent(font) {}
  1694.  
  1695. //! Gets the height (ascent plus descent) of the given font.
  1696. //! @since 1.2.0
  1697. //! @param [Number] font Font to use
  1698. //! @return [Number] The height of the font
  1699. function getFontHeight(font) {}
  1700.  
  1701. }
  1702.  
  1703. //! The Lang module contains Monkey C language basic types.
  1704. //!
  1705. //! Number - 32 bit signed
  1706. //! integers
  1707. //!
  1708. //! Float - 32 bit floating point numbers
  1709. //!
  1710. //! Long - 64 bit integers
  1711. //!
  1712. //! Double
  1713. //! - 64 bit floating point numbers
  1714. //!
  1715. //! Booleans - true and false
  1716. //!
  1717. //! Symbols -
  1718. //! Lightweight constants
  1719. //!
  1720. //! Strings - Strings of characters
  1721. //!
  1722. //! Objects - Instantiated
  1723. //! objects are defined with the class keyword. Classes are bindings of names to
  1724. //! values.
  1725. //!
  1726. //! Dictionaries - Associative arrays, allocated with the syntax “new {}”
  1727. //! or just “{}”
  1728. //!
  1729. //! Arrays - Arrays, allocated with the syntax “new [X]” where X is an
  1730. //! expression computing the size of the array
  1731. //!
  1732. //! Exceptions - The base type for an
  1733. //! error that can be handled in code with a try/catch. Used with the throw keyword.
  1734. //! @since 1.0.0
  1735. module Lang {
  1736. //! All Array objects are single dimensional and take any objects (including arrays)
  1737. //! as members. Not all members of an Array need to be the same type of object.
  1738. //! @since 1.0.0
  1739. class Array {
  1740. //! Use size() to get the size of the Array.
  1741. //! @since 1.0.0
  1742. //! @return [Number] The number of elements in Array
  1743. function size() {}
  1744.  
  1745. //! Convert the array to a String representation with toString(). Each elements'
  1746. //! toString() method will be invoked.
  1747. //! @since 1.0.0
  1748. //! @return [String] The String representation of the Array
  1749. function toString() {}
  1750.  
  1751. }
  1752.  
  1753. //! Boolean objects wrap a true or false value. You can use the true or false
  1754. //! keyword to create a Boolean.
  1755. //! @since 1.0.0
  1756. class Boolean {
  1757. }
  1758.  
  1759. //! Dictionary is a hash table used to map keys to values. Both the keys and the
  1760. //! values can be any type of object; the keys/values do not need to be the same
  1761. //! type of object.
  1762. //! @since 1.0.0
  1763. class Dictionary {
  1764. //! Use get() to retrieve a value for a given key.
  1765. //! @since 1.0.0
  1766. //! @param key to retrieve
  1767. //! @return [Object] Value for key, or null if does not exist
  1768. function get(key) {}
  1769.  
  1770. //! Check if the given key exists with hasKey().
  1771. //! @since 1.0.0
  1772. //! @param key Key to check for
  1773. //! @return [Boolean] true if key exists, false otherwise
  1774. function hasKey(key) {}
  1775.  
  1776. //! Use isEmpty() to determine it the Dictionary is empty.
  1777. //! @since 1.0.0
  1778. //! @return [Boolean] true if empty, false otherwise
  1779. function isEmpty() {}
  1780.  
  1781. //! Use keys() to retrieve the keys in the Dictionary.
  1782. //! @since 1.0.0
  1783. //! @return [Array] Array of keys in the Dictionary
  1784. function keys() {}
  1785.  
  1786. //! Use put() to place a value in the hash table with the given key.
  1787. //! @since 1.0.0
  1788. //! @param key Key of the hash map
  1789. //! @param value Value to put in the hash map
  1790. function put(key, value) {}
  1791.  
  1792. //! Use remove() to delete an item from the hash table.
  1793. //! @since 1.0.0
  1794. //! @param key to remove
  1795. function remove(key) {}
  1796.  
  1797. //! Use size() to retrieve the number of elements in the Dictionary.
  1798. //! @since 1.0.0
  1799. //! @return [Number] The number of elements in Dictionary
  1800. function size() {}
  1801.  
  1802. //! Convert to a String with toString().
  1803. //! @since 1.0.1
  1804. //! @return String representation of dictionary
  1805. function toString() {}
  1806.  
  1807. //! Use value() to retrieve the values in the Dictionary.
  1808. //! @since 1.0.0
  1809. //! @return [Array] Array of values in the Dictionary
  1810. function values() {}
  1811.  
  1812. }
  1813.  
  1814. //! Double represents a 64 bit floating point number. To use a double in Monkey C
  1815. //! add 'd' to the end of the number:
  1816. //! @since 1.0.0
  1817. class Double {
  1818. //! Use abs() to get the Absolute value of the Double.
  1819. //! @since 1.0.0
  1820. //! @return [Double] Absolute value of the Double
  1821. function abs() {}
  1822.  
  1823. //! Use format() to format the Double using the given formatting String. The format
  1824. //! string is similar to the format string that can be passed in to printf in c
  1825. //! stdio (the [length] option is not available):
  1826. //!
  1827. //! The supported specifiers are: d,
  1828. //! i, u, o, x, X, f, e, E, g, G.
  1829. //!
  1830. //! supports only + and 0
  1831. //!
  1832. //! supports only numbers (*
  1833. //! is not supported)
  1834. //!
  1835. //! supports only numbers (* is not supported)
  1836. //! @since 1.0.0
  1837. //! @return [String] A formatted String
  1838. function format() {}
  1839.  
  1840. //! Convert to a Double with toDouble().
  1841. //! @since 1.0.0
  1842. //! @return [Double] A Double object
  1843. function toDouble() {}
  1844.  
  1845. //! Convert the Double to a Float with toFloat().
  1846. //! @since 1.0.0
  1847. //! @return [Float] A Float object
  1848. function toFloat() {}
  1849.  
  1850. //! Convert the Double to a Long with toLong().
  1851. //! @since 1.0.0
  1852. //! @return [Long] A Long object
  1853. function toLong() {}
  1854.  
  1855. //! Convert the Double to a Number with toNumber(). Since the number is a double the
  1856. //! value will be rounded toward 0. For example, 6.8 becomes 6 and -5.7 becomes -5.
  1857. //! @since 1.0.0
  1858. //! @return [Number] A Number object
  1859. function toNumber() {}
  1860.  
  1861. //! Convert a Double to a String with toString().
  1862. //! @since 1.0.0
  1863. //! @return [String] The String representation of the object
  1864. function toString() {}
  1865.  
  1866. }
  1867.  
  1868. //! Exception is a class that represents a thrown Exception. Custom exceptions can
  1869. //! be created by extending this class. Make sure to call Exception.initialize() to
  1870. //! get the proper callstack if extending this class.
  1871. //! @since 1.0.0
  1872. class Exception {
  1873. //! Constructor. Sets up the callstack for printStackTrace(). Must be called by
  1874. //! classes that extend Exception.
  1875. //! @since 1.1.2
  1876. function initialize() {}
  1877.  
  1878. //! Get the error message for the exception
  1879. //! @since 1.2.0
  1880. //! @return [String] The error message, or null if no message is given
  1881. function getErrorMessage() {}
  1882.  
  1883. //! Print the stack trace of the thrown exception
  1884. //! @since 1.1.2
  1885. function printStackTrace() {}
  1886.  
  1887. }
  1888.  
  1889. //! Floats are 32 bit floating point values. A decimal number is Float by default
  1890. //! unless the 'd' prefix is used.
  1891. //! @since 1.0.0
  1892. class Float {
  1893. //! Use abs() to get the Absolute value of the Float.
  1894. //! @since 1.0.0
  1895. //! @return [Float] Absolute value of the Float
  1896. function abs() {}
  1897.  
  1898. //! Use format() to format the Float using the given formatting String. The format
  1899. //! string is similar to the format string that can be passed in to printf in c
  1900. //! stdio (the [length] option is not available):
  1901. //!
  1902. //! The supported specifiers are: d,
  1903. //! i, u, o, x, X, f, e, E, g, G.
  1904. //!
  1905. //! supports only + and 0
  1906. //!
  1907. //! supports only numbers (*
  1908. //! is not supported)
  1909. //!
  1910. //! supports only numbers (* is not supported)
  1911. //! @since 1.0.0
  1912. //! @return [String] A formatted String
  1913. function format() {}
  1914.  
  1915. //! Convert the Float to a Double with toDouble().
  1916. //! @since 1.0.0
  1917. //! @return [Double] A Double object
  1918. function toDouble() {}
  1919.  
  1920. //! Convert to a Float with toFloat().
  1921. //! @since 1.0.0
  1922. //! @return [Float] A Float object
  1923. function toFloat() {}
  1924.  
  1925. //! Convert the Float to a Long with toLong().
  1926. //! @since 1.0.0
  1927. //! @return [Long] A Long object
  1928. function toLong() {}
  1929.  
  1930. //! Convert the Float to a Number with toNumber(). Since the number is a float the
  1931. //! value will be rounded toward 0. For example, 6.8 becomes 6 and -5.7 becomes -5.
  1932. //! @since 1.0.0
  1933. //! @return [Number] A Number object
  1934. function toNumber() {}
  1935.  
  1936. }
  1937.  
  1938. //! Long represents a 64 bit integer. To use a Long value in Monkey C add 'l' to the
  1939. //! end of the number:
  1940. //! @since 1.0.0
  1941. class Long {
  1942. //! Use abs() to get the Absolute value of the Long.
  1943. //! @since 1.0.0
  1944. //! @return [Long] Absolute value of the Long
  1945. function abs() {}
  1946.  
  1947. //! Use format() to format the Long using the given formatting String. The format
  1948. //! string is similar to the format string that can be passed in to printf in c
  1949. //! stdio (the [length] option is not available):
  1950. //!
  1951. //! The supported specifiers are: d,
  1952. //! i, u, o, x, X, f, e, E, g, G.
  1953. //!
  1954. //! supports only + and 0
  1955. //!
  1956. //! supports only numbers (*
  1957. //! is not supported)
  1958. //!
  1959. //! supports only numbers (* is not supported)
  1960. //! @since 1.0.0
  1961. //! @return [String] A formatted String
  1962. function format() {}
  1963.  
  1964. //! Convert the Long to a Double with toDouble().
  1965. //! @since 1.0.0
  1966. //! @return [Double] A Double object
  1967. function toDouble() {}
  1968.  
  1969. //! Convert the Long to a Float with toFloat().
  1970. //! @since 1.0.0
  1971. //! @return [Float] A Float object
  1972. function toFloat() {}
  1973.  
  1974. //! Convert to a Long with toLong().
  1975. //! @since 1.0.0
  1976. //! @return [Long] A Long object
  1977. function toLong() {}
  1978.  
  1979. //! Convert the Long to a Number with toNumber().
  1980. //! @since 1.0.0
  1981. //! @return [Number] A Number object
  1982. function toNumber() {}
  1983.  
  1984. //! Convert a Long to a String with toString().
  1985. //! @since 1.0.0
  1986. //! @return [String] The String representation of the Long
  1987. function toString() {}
  1988.  
  1989. }
  1990.  
  1991. //! Method is a class that represents a callback. You can create one using the
  1992. //! object.method call, and invoke the method using the invoke method.
  1993. //! @since 1.0.0
  1994. class Method {
  1995. //! Constructor
  1996. //! @since 1.0.0
  1997. //! @param aClass Classdef of method
  1998. //! @param [Symbol] aMethod Symbol of class object
  1999. function initialize(aClass, aMethod) {}
  2000.  
  2001. //! Use hashCode() to get a hash code value for the Method.
  2002. //! @since 1.0.0
  2003. //! @return [Number] Hash code for the Method
  2004. function hashCode() {}
  2005.  
  2006. //! Invoke the method with invoke().
  2007. //! @since 1.0.0
  2008. //! @param args parameters
  2009. //! @return [Object] The return value from callback
  2010. function invoke(args) {}
  2011.  
  2012. }
  2013.  
  2014. //! All Number objects wrap a 32 bit signed integer.
  2015. //! @since 1.0.0
  2016. class Number {
  2017. //! Use abs() to get the Absolute value of the Number.
  2018. //! @since 1.0.0
  2019. //! @return [Number] Absolute value of the Number
  2020. function abs() {}
  2021.  
  2022. //! Use format() to format the Number using the given formatting String. The format
  2023. //! string is similar to the format string that can be passed in to printf in c
  2024. //! stdio (the [length] option is not available):
  2025. //!
  2026. //! The supported specifiers are: d,
  2027. //! i, u, o, x, X, f, e, E, g, G.
  2028. //!
  2029. //! supports only + and 0
  2030. //!
  2031. //! supports only numbers (*
  2032. //! is not supported)
  2033. //!
  2034. //! supports only numbers (* is not supported)
  2035. //! @since 1.0.0
  2036. //! @return [String] A formatted String
  2037. function format() {}
  2038.  
  2039. //! Convert the Number to a Double with toDouble().
  2040. //! @since 1.0.0
  2041. //! @return [Double] A Double object
  2042. function toDouble() {}
  2043.  
  2044. //! Convert the Number to a Float with toFloat().
  2045. //! @since 1.0.0
  2046. //! @return [Float] A Float object
  2047. function toFloat() {}
  2048.  
  2049. //! Convert the Number to a Long with toLong().
  2050. //! @since 1.0.0
  2051. //! @return [Long] A Long object
  2052. function toLong() {}
  2053.  
  2054. //! Convert to a Number with toNumber().
  2055. //! @since 1.0.0
  2056. //! @return [Number] A Number object
  2057. function toNumber() {}
  2058.  
  2059. }
  2060.  
  2061. //! Toybox.Lang.Object is the root object for the Monkey C class hierarchy.
  2062. //! @since 1.0.0
  2063. class Object {
  2064. //! Test if this instance is equal to another instance of an object by using
  2065. //! equals().
  2066. //! @since 1.0.0
  2067. //! @param that That item to test against
  2068. //! @return [Boolean] true if objects are equal, false otherwise.
  2069. function equals(that) {}
  2070.  
  2071. //! Use hashCode() to return a hash code value for the object.
  2072. //! @since 1.0.0
  2073. //! @return [Number] Hash code for the object
  2074. function hashCode() {}
  2075.  
  2076. //! To retrieve the callback to the given method, use method(). This takes a Symbol
  2077. //! and returns the associated Method object.
  2078. //! @since 1.0.0
  2079. //! @param [Symbol] symbol Symbol of the method requested
  2080. //! @return [Method] Method object associated with the given method symbol
  2081. function method(symbol) {}
  2082.  
  2083. //! Use toString to convert an Object to a String.
  2084. //! @since 1.0.0
  2085. //! @return [String] The String representation of the object
  2086. function toString() {}
  2087.  
  2088. //! Get a weak reference to the object.
  2089. //! @since 1.2.0
  2090. //! @return [WeakReference] Immutable types (Number, Float, Long, Double, Boolean, String) will return their values Other object types will return a WeakReference object
  2091. function weak() {}
  2092.  
  2093. }
  2094.  
  2095. //! All String objects represent a sequence of characters. The String object
  2096. //! provides methods for string operations.
  2097. //! @since 1.0.0
  2098. class String {
  2099. //! Test if this instance is equal to another instance of an Object with equals().
  2100. //! @since 1.0.0
  2101. //! @param that That item to test against
  2102. //! @return [Boolean] true if the objects are equal, false otherwise
  2103. function equals(that) {}
  2104.  
  2105. //! Use find() to determine if the passed String exists in this String.
  2106. //! @since 1.0.0
  2107. //! @param [String] string String to find
  2108. //! @return [Number] index Index of the start of string or null if not found
  2109. function find(string) {}
  2110.  
  2111. //! Use hasCode() to get a hash code value for the String.
  2112. //! @since 1.0.0
  2113. //! @return [Number] Hash code for the String
  2114. function hashCode() {}
  2115.  
  2116. //! Use length() to get the number of characters in the String
  2117. //! @since 1.0.0
  2118. //! @return [Number] The length of the String
  2119. function length() {}
  2120.  
  2121. //! Use subString() to create a new String that contains the contents of the current
  2122. //! string from start position to end position, exclusive.
  2123. //! @since 1.0.0
  2124. //! @param [Number] startIndex Zero based start index of the substring
  2125. //! @param [Number] endIndex End position of the substring, exclusive
  2126. //! @return [String] The substring of String or null on error
  2127. function substring(startIndex, endIndex) {}
  2128.  
  2129. //! If a string is in the numeric form of “123” or “123.45”, convert it to a Float
  2130. //! object with toFloat().
  2131. //! @since 1.0.0
  2132. //! @return [Float] A Float object, or error
  2133. function toFloat() {}
  2134.  
  2135. //! Convert the String to lower case with toLower().
  2136. //! @since 1.0.0
  2137. //! @return [String] A new lower case String
  2138. function toLower() {}
  2139.  
  2140. //! If a string is in numeric form, either “123” or “0x12AB”, convert it to a Number
  2141. //! object with toNumber().
  2142. //! @since 1.0.0
  2143. //! @return [Number] A Number object, or error
  2144. function toNumber() {}
  2145.  
  2146. //! Convert to a String with toString().
  2147. //! @since 1.0.0
  2148. //! @return String representation of String
  2149. function toString() {}
  2150.  
  2151. //! Convert the String to upper case with toUpper().
  2152. //! @since 1.0.0
  2153. //! @return [String] A new upper case String
  2154. function toUpper() {}
  2155.  
  2156. }
  2157.  
  2158. //! A Symbol is a lightweight constant identifier. The Monkey C compiler will assign
  2159. //! a new integer value when it encounters a new symbol. This allows a developer to
  2160. //! use symbols as keys or constant values without explicitly declaring a
  2161. //! constant.
  2162. //!
  2163. //! Symbols can be useful when wanting to create keys without having to
  2164. //! declare an enum.
  2165. //! @since 1.0.0
  2166. class Symbol {
  2167. //! Convert a Symbol to a String with toString().
  2168. //! @since 1.0.0
  2169. //! @return [String] The String representation of the Symbol
  2170. function toString() {}
  2171.  
  2172. }
  2173.  
  2174. //! UnexpecteTypeException is thrown when a function is passed an incorrect type for
  2175. //! a parameter.
  2176. //! @since 1.2.0
  2177. class UnexpectedTypeException extends Exception {
  2178. //! Constructor
  2179. //! @since 1.2.0
  2180. function initialize() {}
  2181.  
  2182. }
  2183.  
  2184. //! A weak reference is a loosly bound reference to another object. If all strong
  2185. //! references have been freed, the get() method will return null. This allows the
  2186. //! developer to avoid circular references.
  2187. //! @since 1.2.0
  2188. class WeakReference {
  2189. //! Get the object referenced.
  2190. //! @since 1.2.0
  2191. //! @return [Object] Object referenced, or null if object is no longer live.
  2192. function get() {}
  2193.  
  2194. //! Return if the reference is still alive.
  2195. //! @since 1.2.0
  2196. //! @return [Boolean] true if object is still alive, false otherwise. When you are dead I will be STILL ALIVE I feel fantastic and I am STILL ALIVE
  2197. function stillAlive() {}
  2198.  
  2199. }
  2200.  
  2201. //! Use format() to create a formatted String by substituting the given parameters
  2202. //! into the given format at the corresponding locations.
  2203. //!
  2204. //! The given format:
  2205. //!
  2206. //! Paired
  2207. //! with the given parameters:
  2208. //!
  2209. //! Would result in the String:
  2210. //! @since 1.0.0
  2211. //! @param [String] format A string using $1$, $2$, $3$… as substitution identifiers
  2212. //! @param [Array] params Array of content to substitute in
  2213. //! @return [String] A new String with the substituted content
  2214. function format(format, params) {}
  2215.  
  2216. }
  2217.  
  2218. //! The Math Module provides various math methods available for use by Apps.
  2219. //! @since 1.0.0
  2220. module Math {
  2221. //! @since 1.0.0
  2222. const PI = 3.14159265358979323846;
  2223.  
  2224. //! @since 1.0.0
  2225. const E = 2.7182818284590452354;
  2226.  
  2227. //! Use acos() to get the arc cosine of a cosine.
  2228. //! @since 1.0.0
  2229. //! @param [Float] x The cosine value
  2230. //! @return [Float] 0..PI in radians, or NaN if invalid
  2231. function acos(x) {}
  2232.  
  2233. //! Use asin() to get the arc sine of a sine.
  2234. //! @since 1.0.0
  2235. //! @param [Float] x The sine value
  2236. //! @return [Float] -PI/2..PI/2 in radians, or NaN if invalid
  2237. function asin(x) {}
  2238.  
  2239. //! Use atan() to get the arc tangent of a tangent.
  2240. //! @since 1.0.0
  2241. //! @param [Float] x The tangent value
  2242. //! @return [Float] -PI/2..PI/2 in radians, or NaN if invalid
  2243. function atan(x) {}
  2244.  
  2245. //! Use cos() to get the cosine of an angle.
  2246. //! @since 1.0.0
  2247. //! @param [Float] x The angle in radians
  2248. //! @return [Float] Cosine value
  2249. function cos(x) {}
  2250.  
  2251. //! Use log() to get logarithmic value of a value.
  2252. //! @since 1.0.0
  2253. //! @param [Float] x The value for which to get logarithm
  2254. //! @param [Float] base Optional base value (E is assumed)
  2255. //! @return [Float] Logarithm of x
  2256. function log(x, base) {}
  2257.  
  2258. //! Use pow() to calculate x to the power of y.
  2259. //! @since 1.0.0
  2260. //! @param [Float] x Base
  2261. //! @param [Float] y Exponent
  2262. //! @return [Float] x to the power of y
  2263. function pow(x, y) {}
  2264.  
  2265. //! Use rand() to get a random number.
  2266. //! @since 1.0.0
  2267. //! @return [Number] Non-negative random number
  2268. function rand() {}
  2269.  
  2270. //! Use sin() to get the sine of an angle.
  2271. //! @since 1.0.0
  2272. //! @param [Float] x The angle in radians
  2273. //! @return [Float] Sine of X
  2274. function sin(x) {}
  2275.  
  2276. //! Use sqrt() to calculate the square root of a value.
  2277. //! @since 1.0.0
  2278. //! @param [Float] x The value for which to get the square root
  2279. //! @return [Float] Square root of X, or NaN if invalid
  2280. function sqrt(x) {}
  2281.  
  2282. //! Use srand() to seed the random number generator.
  2283. //! @since 1.0.0
  2284. //! @param [Number] seed The value used for seeding rand()
  2285. function srand(seed) {}
  2286.  
  2287. //! Use tan() to get the tangent of an angle.
  2288. //! @since 1.0.0
  2289. //! @param [Float] x The angle in radians
  2290. //! @return [Float] Tangent value of x
  2291. function tan(x) {}
  2292.  
  2293. }
  2294.  
  2295. //! Persisted locations allows the saving of a location (waypoint) to a device's
  2296. //! location list. This feature is only available on devices that support waypoints.
  2297. //! @since 1.0.2
  2298. //! @device fenix 3
  2299. //! @device epix
  2300. //! @permission PersistedLocations
  2301. //! @apptype App
  2302. module PersistedLocations {
  2303. //! Save a location (waypoint) to the device's location list
  2304. //! @since 1.0.2
  2305. //! @param [Location] location Location object to persist
  2306. //! @param [Dictionary] options Dictionary of options, or null to accept defaults
  2307. //! @option [Hash] :name a customizable set of options
  2308. function persistLocation(location, options) {}
  2309.  
  2310. }
  2311.  
  2312. //! The Position Module provides an interface into location information.
  2313. //! @since 1.0.0
  2314. //! @permission Positioning
  2315. //! @apptype Widget
  2316. //! @apptype App
  2317. module Position {
  2318. //! The GEO enum is used to retrieve coordinate information in various String
  2319. //! representations.
  2320. //!
  2321. //! Degree Format, ddd.dddddd: 38.278652
  2322. //! @since 1.0.0
  2323. const GEO_DEG = 0;
  2324.  
  2325. //! Degree/Minute Format, dddmm.mmm: 38 27.865'
  2326. //! @since 1.0.0
  2327. const GEO_DM = 1;
  2328.  
  2329. //! Degree/Minute/Seconds Format, dddmmss: 38 27' 8“
  2330. //! @since 1.0.0
  2331. const GEO_DMS = 2;
  2332.  
  2333. //! Military Grid Reference System (MGRS): 4QFJ12345678
  2334. //! @since 1.0.0
  2335. const GEO_MGRS = 3;
  2336.  
  2337. //! The QUALITY enum is used to represent the quality of GPS fix with which the
  2338. //! Location information was calculated.
  2339. //!
  2340. //! GPS is not available
  2341. //! @since 1.0.0
  2342. const QUALITY_NOT_AVAILABLE = 0;
  2343.  
  2344. //! The Location is based on the last known GPS fix.
  2345. //! @since 1.0.0
  2346. const QUALITY_LAST_KNOWN = 1;
  2347.  
  2348. //! The Location was calculated with a poor GPS fix. Only a 2-D GPS fix is
  2349. //! available, likely due to a limited number of tracked satellites.
  2350. //! @since 1.0.0
  2351. const QUALITY_POOR = 2;
  2352.  
  2353. //! The Location was calculated with a usable GPS fix. A 3-D GPS fix is available,
  2354. //! with marginal HDOP (horizontal dilution of precision)
  2355. //! @since 1.0.0
  2356. const QUALITY_USABLE = 3;
  2357.  
  2358. //! The Location was calculated with a good GPS fix. A 3-D GPS fix is available,
  2359. //! with good-to-excellent HDOP.
  2360. //! @since 1.0.0
  2361. const QUALITY_GOOD = 4;
  2362.  
  2363. //! One-time retrieval of Location
  2364. //! @since 1.0.0
  2365. const LOCATION_ONE_SHOT = 0;
  2366.  
  2367. //! Register for Location updates
  2368. //! @since 1.0.0
  2369. const LOCATION_CONTINUOUS = 1;
  2370.  
  2371. //! Unregister for Location updates
  2372. //! @since 1.0.0
  2373. const LOCATION_DISABLE = 2;
  2374.  
  2375. //! The Location.Info class contains all information necessary for the Location. It
  2376. //! can be passed on the update or it can be retrieved on demand. The fields in this
  2377. //! class may return null so you should null check a value before using it.
  2378. //! @since 1.0.0
  2379. class Info {
  2380. //! Positional accuracy (good, usable, poor, not available). Cannot be null.
  2381. //! @since 1.0.0
  2382. //! @return [Number]
  2383. var accuracy;
  2384.  
  2385. //! Elevation in meters (mean sea level). Elevation is derived from the most
  2386. //! accurate source: Barometer or GPS in order of descending accuracy. If no GPS is
  2387. //! present, then barometer readings will be used.
  2388. //! @since 1.0.0
  2389. //! @return [Float]
  2390. var altitude;
  2391.  
  2392. //! True north referenced heading in radians. This metric provides the direction of
  2393. //! travel when moving. When stopped, it provides compass orientation, if supported
  2394. //! by the device.
  2395. //! @since 1.0.0
  2396. //! @return [Float]
  2397. var heading;
  2398.  
  2399. //! Lat/Lon. If no GPS is available or is between GPS fix intervals (typically 1
  2400. //! second), position is propagated (i.e. dead-reckoned) using the last known
  2401. //! heading and last known speed. After a short period of time, position will cease
  2402. //! to be propagated to prevent excessive accumulation of position errors.
  2403. //! @since 1.0.0
  2404. //! @return [Location]
  2405. var position;
  2406.  
  2407. //! Horizontal speed in meters per second. Speed is derived from the most accurate
  2408. //! source: GPS, footpod, or accelerometer in order of descending accuracy.
  2409. //! @since 1.0.0
  2410. //! @return [Float]
  2411. var speed;
  2412.  
  2413. //! GPS time stamp of fix
  2414. //! @since 1.0.0
  2415. //! @return [Moment]
  2416. var when;
  2417.  
  2418. }
  2419.  
  2420. //! The Location object represents a position. It provides accessor methods for
  2421. //! retrieving the coordinates in various formats.
  2422. //! @since 1.0.0
  2423. class Location {
  2424. //! Constructor: create a coordinate based off an options hash table
  2425. //! @since 1.0.0
  2426. //! @param [Dictionary] options Hash table of options
  2427. //! @option [Number] :latitude The latitude
  2428. //! @option [Number] :longitude The longitude
  2429. //! @option [Symbol] :format The format of lat/long (possible values are :degrees, :radians, or :semicircles)
  2430. function initialize(options) {}
  2431.  
  2432. //! Use toDegrees() to retrieve the coordinate back as an Array of degree values.
  2433. //! @since 1.0.0
  2434. //! @return [Array] An Array of the latitude and the longitude in degree format
  2435. function toDegrees() {}
  2436.  
  2437. //! Use toGeoString() to get a String representation of the coordinate.
  2438. //! @since 1.0.0
  2439. //! @param format Coordinate format to which coordinate should be converted (GEO constant)
  2440. //! @return [String] Formatted coordinate String
  2441. function toGeoString(format) {}
  2442.  
  2443. //! Use toRadians() to retrieve the coordinate back as an Array of radian values.
  2444. //! @since 1.0.0
  2445. //! @return [Array] An Array of the latitude and the longitude in radian format
  2446. function toRadians() {}
  2447.  
  2448. }
  2449.  
  2450. //! Request a location event with enableLocationEvents().
  2451. //! @since 1.0.0
  2452. //! @param type LOCATION_ONE_SHOT for a single location request, LOCATION_CONTINUOUS to enable location tracking, and LOCATION_DISABLE to turn off location tracking
  2453. //! @param [Method] listener Method object to call with location updates; receives a Position.Info as an argument
  2454. function enableLocationEvents(type, listener) {}
  2455.  
  2456. //! Use getInfo() to retrieve the current Location.Info.
  2457. //! @since 1.0.0
  2458. //! @return [Location.Info] The Info object containing the current information
  2459. function getInfo() {}
  2460.  
  2461. //! Use parse() to parse an input string and convert it into a Location.
  2462. //! @since 1.0.0
  2463. //! @param [String] input String to parse
  2464. //! @param format Coordinate format to use for parsing (Position.GEO_XXX constant)
  2465. //! @return [Location] The Location object
  2466. function parse(input, format) {}
  2467.  
  2468. }
  2469.  
  2470. //! @permission Sensor
  2471. //! @apptype Widget
  2472. //! @apptype App
  2473. module Sensor {
  2474. //! Remote system sensors that can be enabled
  2475. //! @since 1.0.0
  2476. const SENSOR_BIKESPEED = 0;
  2477.  
  2478. //! @since 1.0.0
  2479. const SENSOR_BIKECADENCE = 1;
  2480.  
  2481. //! @since 1.0.0
  2482. const SENSOR_BIKEPOWER = 2;
  2483.  
  2484. //! @since 1.0.0
  2485. const SENSOR_FOOTPOD = 3;
  2486.  
  2487. //! @since 1.0.0
  2488. const SENSOR_HEARTRATE = 4;
  2489.  
  2490. //! @since 1.0.0
  2491. const SENSOR_TEMPERATURE = 5;
  2492.  
  2493. //! The Sensor.Info class contains all information necessary for the Sensor. It can
  2494. //! be passed on the update or it can be retrieved on demand. The fields in this
  2495. //! class may return null so you should null check a value before using it.
  2496. //! @since 1.0.0
  2497. class Info {
  2498. //! Accelerometer reading for X, Y, and Z as an Array of Number values
  2499. //! (milli-g-units).
  2500. //! @since 1.2.0
  2501. //! @return [Array]
  2502. var accel;
  2503.  
  2504. //! Altitude (m) (See the altitude member of the Info object in the Position module
  2505. //! for more information)
  2506. //! @since 1.0.0
  2507. //! @return [Float]
  2508. var altitude;
  2509.  
  2510. //! Cadence (rpm) Cadence is derived (in order of priority) from bike sensors
  2511. //! (cadence or speed must be enabled), advanced running dynamics sensors (e.g.
  2512. //! heart strap with running dynamics enabled), footpod, or watch-based cadence
  2513. //! calculations.
  2514. //! @since 1.0.0
  2515. //! @return [Number]
  2516. var cadence;
  2517.  
  2518. //! True north referenced heading (radians). This metric provides compass
  2519. //! orientation if it is supported by the device.
  2520. //! @since 1.0.0
  2521. //! @return [Float]
  2522. var heading;
  2523.  
  2524. //! HR (bpm)
  2525. //! @since 1.0.0
  2526. //! @return [Number]
  2527. var heartRate;
  2528.  
  2529. //! Magnetometer reading for X, Y, and Z as an Array of Number values (mGauss)
  2530. //! @since 1.2.0
  2531. //! @return [Array]
  2532. var mag;
  2533.  
  2534. //! Power (W)
  2535. //! @since 1.0.0
  2536. //! @return [Number]
  2537. var power;
  2538.  
  2539. //! Pressure (Pa) Returns base level (sea-level) pressure. This requires that a GPS
  2540. //! altitude has been obtained, in order to take the local (ambient) pressure and
  2541. //! convert the barometric pressure to base level pressure.
  2542. //! @since 1.0.0
  2543. //! @return [Float]
  2544. var pressure;
  2545.  
  2546. //! Speed (m/s) (See the speed member of the Info object in the Position module for
  2547. //! more information)
  2548. //! @since 1.0.0
  2549. //! @return [Float]
  2550. var speed;
  2551.  
  2552. //! Temperature (degC)
  2553. //! @since 1.0.0
  2554. //! @return [Float]
  2555. var temperature;
  2556.  
  2557. }
  2558.  
  2559. //! Use enableSensorEvents() to request a sensor event. This enables sensor events
  2560. //! at 1Hz.
  2561. //! @since 1.0.0
  2562. //! @param [Method] listener Method Object to call with sensor updates. Null for no listener
  2563. function enableSensorEvents(listener) {}
  2564.  
  2565. //! Use getInfo() to retrieve the current Sensor.Info
  2566. //! @since 1.0.0
  2567. //! @return [Sensor.Info] object with current information.
  2568. function getInfo() {}
  2569.  
  2570. //! Use setEnabledSensors() to request system sensors. This will also enable the
  2571. //! system sensors if possible.
  2572. //! @since 1.0.0
  2573. //! @param [Array] sensors Array of Sensor types to enable, or [] to disable all sensors
  2574. //! @return [Array] Array of requested sensors that were available
  2575. function setEnabledSensors(sensors) {}
  2576.  
  2577. }
  2578.  
  2579. //! The System module provides basic system calls.
  2580. //! @since 1.0.0
  2581. module System {
  2582. //! Setting values for DeviceSettings
  2583. //!
  2584. //! Display units in metric units
  2585. //! @since 1.0.0
  2586. const UNIT_METRIC = 0;
  2587.  
  2588. //! Display units in statute units
  2589. //! @since 1.0.0
  2590. const UNIT_STATUTE = 1;
  2591.  
  2592. //! @since 1.2.0
  2593. const SCREEN_SHAPE_ROUND = 1;
  2594.  
  2595. //! @since 1.2.0
  2596. const SCREEN_SHAPE_SEMI_ROUND = 2;
  2597.  
  2598. //! @since 1.2.0
  2599. const SCREEN_SHAPE_RECTANGLE = 3;
  2600.  
  2601. //! @since 1.2.0
  2602. const BUTTON_INPUT_SELECT = 0x01;
  2603.  
  2604. //! @since 1.2.0
  2605. const BUTTON_INPUT_UP = 0x02;
  2606.  
  2607. //! @since 1.2.0
  2608. const BUTTON_INPUT_DOWN = 0x04;
  2609.  
  2610. //! @since 1.2.0
  2611. const BUTTON_INPUT_MENU = 0x08;
  2612.  
  2613. //! ClockTime is a class used to represent clock time.
  2614. //! @since 1.0.0
  2615. class ClockTime {
  2616. //! Daylight savings time offset
  2617. //! @since 1.0.0
  2618. //! @return [Number]
  2619. var dst;
  2620.  
  2621. //! Hour of the day (since midnight)
  2622. //! @since 1.0.0
  2623. //! @return [Number]
  2624. var hour;
  2625.  
  2626. //! Minute of the hour
  2627. //! @since 1.0.0
  2628. //! @return [Number]
  2629. var min;
  2630.  
  2631. //! Second of the minute
  2632. //! @since 1.0.0
  2633. //! @return [Number]
  2634. var sec;
  2635.  
  2636. //! Time offset from UTC in seconds
  2637. //! @since 1.0.0
  2638. //! @return [Number]
  2639. var timeZoneOffset;
  2640.  
  2641. }
  2642.  
  2643. //! DeviceSettings is a class used to represent various settings on the device.
  2644. //! @since 1.0.0
  2645. class DeviceSettings {
  2646. //! True if activity Tracking is enabled on the device
  2647. //! @since 1.2.0
  2648. //! @return [Boolean]
  2649. var activityTrackingOn;
  2650.  
  2651. //! The number of alarms set to go off on the device
  2652. //! @since 1.2.0
  2653. //! @return [Number]
  2654. var alarmCount;
  2655.  
  2656. //! UNIT_METRIC if distance is shown in kilometers, UNIT_STATUTE if it is shown in
  2657. //! miles
  2658. //! @since 1.0.0
  2659. //! @return [Number]
  2660. var distanceUnits;
  2661.  
  2662. //! UNIT_METRIC if elevation is shown in meters, UNIT_STATUTE if it is shown in feet
  2663. //! @since 1.0.0
  2664. //! @return [Number]
  2665. var elevationUnits;
  2666.  
  2667. //! Get the current firmware version as a two entry array [ major, minor ]
  2668. //! @since 1.2.0
  2669. //! @return [Array]
  2670. var firmwareVersion;
  2671.  
  2672. //! UNIT_METRIC if height is shown in meters, UNIT_STATUTE if it is shown in feet
  2673. //! @since 1.0.0
  2674. //! @return [Number]
  2675. var heightUnits;
  2676.  
  2677. //! Enumerate if Select/Up/Down/Menu buttons are supported using the
  2678. //! BUTTON_INPUT_XXXX enum values
  2679. //! @since 1.2.0
  2680. //! @return [Number]
  2681. var inputButtons;
  2682.  
  2683. //! True if unit shows 24 hour units, false if it displays 12 hour
  2684. //! @since 1.0.0
  2685. //! @return [Boolean]
  2686. var is24Hour;
  2687.  
  2688. //! Does this unit have a touch screen?
  2689. //! @since 1.2.0
  2690. //! @return [Boolean]
  2691. var isTouchScreen;
  2692.  
  2693. //! Get the CIQ version as a three entry array [major, minor, micro ]
  2694. //! @since 1.2.0
  2695. //! @return [Array]
  2696. var monkeyVersion;
  2697.  
  2698. //! The number of active notifications
  2699. //! @since 1.2.0
  2700. //! @return [Number]
  2701. var notificationCount;
  2702.  
  2703. //! UNIT_METRIC if pace is shown in kilometers/hour, UNIT_STATUTE if it is shown in
  2704. //! miles/hour
  2705. //! @since 1.0.0
  2706. //! @return [Number]
  2707. var paceUnits;
  2708.  
  2709. //! Get the part number for this product as a string
  2710. //! @since 1.2.0
  2711. //! @return [String]
  2712. var partNumber;
  2713.  
  2714. //! True if a mobile phone is connected to the device, false otherwise
  2715. //! @since 1.1.0
  2716. //! @return [Boolean]
  2717. var phoneConnected;
  2718.  
  2719. //! The height of the screen in pixels
  2720. //! @since 1.2.0
  2721. //! @return [Number]
  2722. var screenHeight;
  2723.  
  2724. //! SCREEN_SHAPE_XXXX enum value that describes the screen shape
  2725. //! @since 1.2.0
  2726. //! @return [Number]
  2727. var screenShape;
  2728.  
  2729. //! The width of the screen in pixels
  2730. //! @since 1.2.0
  2731. //! @return [Number]
  2732. var screenWidth;
  2733.  
  2734. //! UNIT_METRIC if temperature is shown in Celsius, UNIT_STATUTE if it is shown in
  2735. //! Fahrenheit
  2736. //! @since 1.0.0
  2737. //! @return [Number]
  2738. var temperatureUnits;
  2739.  
  2740. //! True if tones are enabled on the unit, false if they are disabled return
  2741. //! [Boolean]
  2742. //! @since 1.0.0
  2743. var tonesOn;
  2744.  
  2745. //! True if vibration is enabled on the unit, false if it is disabled
  2746. //! @since 1.0.0
  2747. //! @return [Boolean]
  2748. var vibrateOn;
  2749.  
  2750. //! UNIT_METRIC if weight is shown in kilograms, UNIT_STATUTE if it is shown in
  2751. //! pounds
  2752. //! @since 1.0.0
  2753. //! @return [Number]
  2754. var weightUnits;
  2755.  
  2756. }
  2757.  
  2758. //! Stats is a class to hold various system stats.
  2759. //! @since 1.0.0
  2760. class Stats {
  2761. //! Battery life remaining in percent (between 0.0 and 100.0)
  2762. //! @since 1.0.0
  2763. //! @return [Float]
  2764. var battery;
  2765.  
  2766. //! Free memory in bytes
  2767. //! @since 1.0.0
  2768. //! @return [Number]
  2769. var freeMemory;
  2770.  
  2771. //! Total available memory in bytes
  2772. //! @since 1.0.0
  2773. //! @return [Number]
  2774. var totalMemory;
  2775.  
  2776. //! Memory used by this application in bytes
  2777. //! @since 1.0.0
  2778. //! @return [Number]
  2779. var usedMemory;
  2780.  
  2781. }
  2782.  
  2783. //! Call error() to cause an error. This will exit the system.
  2784. //! @since 1.0.0
  2785. //! @param [String] msg Error message to output
  2786. function error(msg) {}
  2787.  
  2788. //! To end execution of the current system cleanly from any point in the app.
  2789. //! @since 1.0.0
  2790. function exit() {}
  2791.  
  2792. //! Get the current clock time with getClockTime().
  2793. //! @since 1.0.0
  2794. //! @return [System.ClockTime] Current clock time
  2795. function getClockTime() {}
  2796.  
  2797. //! Get the device settings with getDeviceSettings().
  2798. //! @since 1.0.0
  2799. //! @return [DeviceSetting] The current device settings
  2800. function getDeviceSettings() {}
  2801.  
  2802. //! Get the current system stats with getSystemStats().
  2803. //! @since 1.0.0
  2804. //! @return [System.Stats] Current system stats
  2805. function getSystemStats() {}
  2806.  
  2807. //! Use getTimer() to get the current millisecond timer.
  2808. //! @since 1.0.0
  2809. //! @return [Number] System millisecond timer
  2810. function getTimer() {}
  2811.  
  2812. //! Use print() to print to the console
  2813. //! @since 1.0.0
  2814. //! @param x Object or string to displays
  2815. function print(x) {}
  2816.  
  2817. //! Use println() to print to the console with a line terminator.
  2818. //! @since 1.0.0
  2819. //! @param a Object or string to display
  2820. function println(a) {}
  2821.  
  2822. //! In future versions of the SDK trap() will break into the debugger.
  2823. //! @since 1.0.0
  2824. function trap() {}
  2825.  
  2826. }
  2827.  
  2828. module Test {
  2829. class Test {
  2830. //! Returns the value of attribute mPassed
  2831. var mPassed;
  2832.  
  2833. function getNumberOfTests() {}
  2834.  
  2835. function passed() {}
  2836.  
  2837. function runTest() {}
  2838.  
  2839. }
  2840.  
  2841. }
  2842.  
  2843. //! The Time module provides functionality for dealing with times and dates.
  2844. //! @since 1.0.0
  2845. module Time {
  2846. //! Short formatting is a numerical representation of date/time.
  2847. //! @since 1.0.0
  2848. const FORMAT_SHORT = 0;
  2849.  
  2850. //! Medium formatting is a mix of Numbers and Strings depending on what function is
  2851. //! being called. If a String is used, it results in an abbreviated form of the time
  2852. //! or date.
  2853. //! @since 1.0.0
  2854. const FORMAT_MEDIUM = 1;
  2855.  
  2856. //! Long formatting is a mix of Numbers and Strings depending on what function is
  2857. //! being called. If a String is used, it results in the spelled out form of the
  2858. //! time or date.
  2859. //! @since 1.0.0
  2860. const FORMAT_LONG = 2;
  2861.  
  2862. //! Gregorian provides an interface for getting Moments and Durations for the
  2863. //! Gregorian calendar.
  2864. //! @since 1.0.0
  2865. module Gregorian {
  2866. //! Time constant for number of seconds in a year
  2867. //! @since 1.0.0
  2868. const SECONDS_PER_YEAR = 31557600;
  2869.  
  2870. //! Time constant for number of seconds in a day
  2871. //! @since 1.0.0
  2872. const SECONDS_PER_DAY = 86400;
  2873.  
  2874. //! Time constant for number of seconds in an hour
  2875. //! @since 1.0.0
  2876. const SECONDS_PER_HOUR = 3600;
  2877.  
  2878. //! Time constant for number of seconds in a minute
  2879. //! @since 1.0.0
  2880. const SECONDS_PER_MINUTE = 60;
  2881.  
  2882. //! The Gregorian.Info class contains all information necessary to represent a time.
  2883. //! The types of the returned values depend on the Time.FORMAT_XXX value used when
  2884. //! calling Gregorian.getInfo().
  2885. //! @since 1.0.0
  2886. class Info {
  2887. //! Day
  2888. //! @since 1.0.0
  2889. //! @return [Number]
  2890. var day;
  2891.  
  2892. //! Day of week
  2893. //! @since 1.0.0
  2894. //! @return [Object]
  2895. var day_of_week;
  2896.  
  2897. //! Hours since midnight
  2898. //! @since 1.0.0
  2899. //! @return [Number]
  2900. var hour;
  2901.  
  2902. //! Minutes of hour
  2903. //! @since 1.0.0
  2904. //! @return [Number]
  2905. var min;
  2906.  
  2907. //! Month
  2908. //! @since 1.0.0
  2909. //! @return [Object]
  2910. var month;
  2911.  
  2912. //! Seconds of minute
  2913. //! @since 1.0.0
  2914. //! @return [Number]
  2915. var sec;
  2916.  
  2917. //! Year
  2918. //! @since 1.0.0
  2919. //! @return [Number]
  2920. var year;
  2921.  
  2922. }
  2923.  
  2924. //! Create a Duration object from a hash of options using duration().
  2925. //! @since 1.0.0
  2926. //! @param [Dictionary] options Hash table of options
  2927. //! @option [Number] :years The number of years
  2928. //! @option [Number] :days The number of days
  2929. //! @option [Number] :hours The number of hours
  2930. //! @option [Number] :minutes The number of minutes
  2931. //! @option [Number] :seconds The number of seconds
  2932. //! @return [Duration] The Duration object created using the options
  2933. function duration(options) {}
  2934.  
  2935. //! Use info() to retrieve a Gregorian.Info for a date.
  2936. //! @since 1.0.0
  2937. //! @param [Moment] date Moment object to get Info from
  2938. //! @param [Number] format Time FORMAT_XXX constant to use
  2939. //! @return [Info] For FORMAT_SHORT, all values in Info are integers. For FORMAT_MEDIUM and FORMAT_LONG, the month/day fields have the strings for the date in question.
  2940. function info(date, format) {}
  2941.  
  2942. //! Create a Moment object from a hash table of options with moment(). The Moment is
  2943. //! created from the current time. For instance, if the current day is April 1 and
  2944. //! you pass in a :day value of 1 the returned Moment's day will be April 2.
  2945. //! @since 1.0.0
  2946. //! @param [Dictionary] options Hash table of options
  2947. //! @option [Number] :year The year
  2948. //! @option [Number] :month The month
  2949. //! @option [Number] :day The day
  2950. //! @option [Number] :hour The hour
  2951. //! @option [Number] :minute The minute
  2952. //! @option [Number] :second The second
  2953. //! @return [Moment] The Moment object created using the options
  2954. function moment(options) {}
  2955.  
  2956. }
  2957.  
  2958. //! The Duration object represents an immutable span of time. This is the return
  2959. //! value when requesting a time result in days or hours.
  2960. //! @since 1.0.0
  2961. class Duration {
  2962. //! Creates a Duration object.
  2963. //! @since 1.0.0
  2964. //! @param [Number] value Number of seconds to initialize the Duration to
  2965. function initialize(value) {}
  2966.  
  2967. //! Use add() to add a Moment or another Duration to a Duration.
  2968. //! @since 1.0.0
  2969. //! @param time Duration or Moment to add to Duration
  2970. //! @return Duration + Moment = Moment, Duration + Duration = Duration
  2971. function add(time) {}
  2972.  
  2973. //! Use compare() to determine if a Duration is shorter or longer than another
  2974. //! Duration.
  2975. //! @since 1.0.0
  2976. //! @param [Duration] time Duration to compare to this Duration
  2977. //! @return [Number] Negative if this < that, positive if this > that, 0 if this == that
  2978. function compare(time) {}
  2979.  
  2980. //! Use divide() to divide a Duration by a value.
  2981. //! @since 1.0.0
  2982. //! @param value Number or Float to divide Duration
  2983. //! @return [Duration] Result object of Duration / value
  2984. function divide(value) {}
  2985.  
  2986. //! Use lessThan() to determine if a Duration is longer than another Duration.
  2987. //! @since 1.0.0
  2988. //! @param [Duration] time Duration to compare to this Duration
  2989. //! @return [Boolean] true if this is greater than that, false otherwise
  2990. function greaterThan(time) {}
  2991.  
  2992. //! Use lessThan() to determine if a Duration is shorter than another Duration.
  2993. //! @since 1.0.0
  2994. //! @param [Duration] time Duration to compare to this Duration
  2995. //! @return [Boolean] true if this is less than that, false otherwise
  2996. function lessThan(time) {}
  2997.  
  2998. //! Use multiply() to multiply a Duration by a value.
  2999. //! @since 1.0.0
  3000. //! @param value Number or Float to multiply with Duration
  3001. //! @return [Duration] Result object of Duration * value
  3002. function multiply(value) {}
  3003.  
  3004. //! Use subtract() to compute the delta between two Durations.
  3005. //! @since 1.0.0
  3006. //! @param [Duration] time Duration object used to find delta
  3007. //! @return [Duration] Duration object of Duration - time
  3008. function subtract(time) {}
  3009.  
  3010. //! Get the Duration value with value().
  3011. //! @since 1.0.0
  3012. //! @return [Number] Duration in seconds
  3013. function value() {}
  3014.  
  3015. }
  3016.  
  3017. //! The Moment object represents an immutable moment in time. Internally stored as a
  3018. //! 32 bit integer of number of seconds since the UNIX epoch.
  3019. //! @since 1.0.0
  3020. class Moment {
  3021. //! Returns a new instance of Moment
  3022. //! @since 1.1.2
  3023. function initialize() {}
  3024.  
  3025. //! Use add() to add a Duration to a Moment.
  3026. //! @since 1.0.0
  3027. //! @param [Duration] time Duration delta to add to Moment
  3028. //! @return [Moment] The result of Moment + Duration
  3029. function add(time) {}
  3030.  
  3031. //! Use compare() to determine if a Moment is before or after another Moment.
  3032. //! @since 1.0.0
  3033. //! @param [Moment] date Moment object to compare to this Moment
  3034. //! @return [Number] Negative if this < that, positive if this > that, 0 if this == that
  3035. function compare(date) {}
  3036.  
  3037. //! Use greaterThan() to determine if a Moment is greater than another Moment.
  3038. //! @since 1.0.0
  3039. //! @param [Moment] date Moment object to compare to this Moment
  3040. //! @return [Boolean] true if this is greater than that, false otherwise
  3041. function greaterThan(date) {}
  3042.  
  3043. //! Use lessThan() to determine if a Moment is less than another Moment.
  3044. //! @since 1.0.0
  3045. //! @param [Moment] date Moment object to compare to this Moment
  3046. //! @return [Boolean] true if this is less than that, false otherwise
  3047. function lessThan(date) {}
  3048.  
  3049. //! Use subtract() to compute the delta between two Moments.
  3050. //! @since 1.0.0
  3051. //! @param [Moment] date Moment object used to find delta
  3052. //! @return [Duration] Delta between date and the Moment object
  3053. function subtract(date) {}
  3054.  
  3055. //! Get the UTC value of this date with value().
  3056. //! @since 1.0.0
  3057. //! @return [Number] UTC date in seconds since UNIX epoch
  3058. function value() {}
  3059.  
  3060. }
  3061.  
  3062. //! Use now() to get a Moment for the current moment in time.
  3063. //! @since 1.0.0
  3064. //! @return [Moment] The current moment in time
  3065. function now() {}
  3066.  
  3067. //! Use today() to get a Moment for the beginning of today based on your current GPS
  3068. //! location.
  3069. //! @since 1.0.0
  3070. //! @return [Moment] The beginning of today
  3071. function today() {}
  3072.  
  3073. }
  3074.  
  3075. //! The Timer module allows access to a Timer object that can run code at a later
  3076. //! time.
  3077. //! @since 1.0.0
  3078. //! @apptype Watch Face
  3079. //! @apptype Widget
  3080. //! @apptype App
  3081. module Timer {
  3082. //! A Timer class will call a function after a number of milliseconds. There are two
  3083. //! types of timers: one-shot or repeating. A one-shot timer will only run once
  3084. //! while a repeating timer will call the function every X milliseconds until stop()
  3085. //! is called. If a repeating timer fails to run before its next execution time then
  3086. //! any missed executions will be skipped.
  3087. //! @since 1.0.0
  3088. class Timer {
  3089. //! Use start() to start the timer. The given callback will be called no sooner than
  3090. //! the given number of milliseconds. This will cause an error if too many timers
  3091. //! are set. The number of available timers (default of 3) and the minimum time
  3092. //! value (default of 50ms) depends on the host system.
  3093. //! @since 1.0.0
  3094. //! @param [Method] callback A function to call after the timer completes
  3095. //! @param [Number] time The number of milliseconds to wait before invoking callback
  3096. //! @param [Boolean] repeat Set to true to have the timer repeat until stop() is called
  3097. function start(callback, time, repeat) {}
  3098.  
  3099. //! Use stop() to stop the timer from running. This only needs to be called for
  3100. //! repeating timers. The Timer can be started again by calling start().
  3101. //! @since 1.0.0
  3102. function stop() {}
  3103.  
  3104. }
  3105.  
  3106. }
  3107.  
  3108. //! The UserProfile module will allow apps to access user information.
  3109. //! @since 1.0.0
  3110. //! @permission UserProfile
  3111. module UserProfile {
  3112. //! The GENDER enum specifies the gender of the user working out.
  3113. //! @since 1.0.0
  3114. const GENDER_FEMALE = 0;
  3115.  
  3116. //! @since 1.0.0
  3117. const GENDER_MALE = 1;
  3118.  
  3119. //! The HR_ZONE_SPORT enum specifies the sport heart rate zones should be read from.
  3120. //! @since 1.2.6
  3121. const HR_ZONE_SPORT_GENERIC = 0;
  3122.  
  3123. //! @since 1.2.6
  3124. const HR_ZONE_SPORT_RUNNING = 1;
  3125.  
  3126. //! @since 1.2.6
  3127. const HR_ZONE_SPORT_BIKING = 2;
  3128.  
  3129. //! @since 1.2.6
  3130. const HR_ZONE_SPORT_SWIMMING = 3;
  3131.  
  3132. //! Profile objects contain user information.
  3133. //! @since 1.0.0
  3134. class Profile {
  3135. //! Activity level from 0-100; 20 is low activity, 50 is medium, 80 is high
  3136. //! (athlete)
  3137. //! @since 1.0.0
  3138. //! @return [Number]
  3139. var activityClass;
  3140.  
  3141. //! Birth Year
  3142. //! @since 1.0.0
  3143. //! @return [Number]
  3144. var birthYear;
  3145.  
  3146. //! Gender enum
  3147. //! @since 1.0.0
  3148. //! @return [Number]
  3149. var gender;
  3150.  
  3151. //! Height in centimeters
  3152. //! @since 1.0.0
  3153. //! @return [Number]
  3154. var height;
  3155.  
  3156. //! Heart rate
  3157. //! @since 1.0.0
  3158. //! @return [Number]
  3159. var restingHeartRate;
  3160.  
  3161. //! Running step length in millimeters
  3162. //! @since 1.0.0
  3163. //! @return [Number]
  3164. var runningStepLength;
  3165.  
  3166. //! Typical sleep time as configured by the user. Stored as Duration past local
  3167. //! midnight.
  3168. //! @since 1.0.0
  3169. //! @return [Duration]
  3170. var sleepTime;
  3171.  
  3172. //! Typical wake time as configured by the user. Stored as Duration past local
  3173. //! midnight.
  3174. //! @since 1.0.0
  3175. //! @return [Duration]
  3176. var wakeTime;
  3177.  
  3178. //! Walking step length in millimeters
  3179. //! @since 1.0.0
  3180. //! @return [Number]
  3181. var walkingStepLength;
  3182.  
  3183. //! Weight in grams
  3184. //! @since 1.0.0
  3185. //! @return [Number]
  3186. var weight;
  3187.  
  3188. }
  3189.  
  3190. //! Returns the sport that the HR_ZONE SPORT_XXX enum that the current activity uses
  3191. //! heart rate zones from. If the active sport does not have sport specific zones,
  3192. //! it will retrun HR_ZONE_SPORT_GENERIC.
  3193. //! @since 1.2.6
  3194. //! @return [Number] Returns the current HR zone sport from the HR_ZONE_SPORT_XXX enum.
  3195. function getCurrentSport() {}
  3196.  
  3197. //! Returns Array of zone thresholds for the requested sport. The returned array
  3198. //! contains zone values as follows:
  3199. //! @since 1.2.6
  3200. //! @param [Number] sport The sport that zones are being requested from. Should be a HR_ZONE_SPORT_XXX value.
  3201. //! @return [Array] Array of zone thresholds for the requested sport. The returned array contains zone values as follows: min zone 1, max zone 1, max zone 2, max zone 3, max zone 4, max zone 5
  3202. function getHeartRateZones(sport) {}
  3203.  
  3204. //! Use getProfile() to retrieve the current User Profile.
  3205. //! @since 1.0.0
  3206. //! @return [UserProfile.Profile] The Profile object for the user
  3207. function getProfile() {}
  3208.  
  3209. }
  3210.  
  3211. //! The WatchUi module has user interface elements for watch apps.
  3212. //! @since 1.0.0
  3213. module WatchUi {
  3214. //! The power key
  3215. //! @since 1.0.0
  3216. const KEY_POWER = 0;
  3217.  
  3218. //! The light key
  3219. //! @since 1.0.0
  3220. const KEY_LIGHT = 1;
  3221.  
  3222. //! The zoom in key
  3223. //! @since 1.0.0
  3224. const KEY_ZIN = 2;
  3225.  
  3226. //! The zoom out key
  3227. //! @since 1.0.0
  3228. const KEY_ZOUT = 3;
  3229.  
  3230. //! The enter key
  3231. //! @since 1.0.0
  3232. const KEY_ENTER = 4;
  3233.  
  3234. //! The escape key
  3235. //! @since 1.0.0
  3236. const KEY_ESC = 5;
  3237.  
  3238. //! The find key
  3239. //! @since 1.0.0
  3240. const KEY_FIND = 6;
  3241.  
  3242. //! The menu key
  3243. //! @since 1.0.0
  3244. const KEY_MENU = 7;
  3245.  
  3246. //! The down key
  3247. //! @since 1.0.0
  3248. const KEY_DOWN = 8;
  3249.  
  3250. //! The down left key
  3251. //! @since 1.0.0
  3252. const KEY_DOWN_LEFT = 9;
  3253.  
  3254. //! The down key
  3255. //! @since 1.0.0
  3256. const KEY_DOWN_RIGHT = 10;
  3257.  
  3258. //! The left key
  3259. //! @since 1.0.0
  3260. const KEY_LEFT = 11;
  3261.  
  3262. //! The right key
  3263. //! @since 1.0.0
  3264. const KEY_RIGHT = 12;
  3265.  
  3266. //! The up key
  3267. //! @since 1.0.0
  3268. const KEY_UP = 13;
  3269.  
  3270. //! The up-left
  3271. //! @since 1.0.0
  3272. const KEY_UP_LEFT = 14;
  3273.  
  3274. //! The up-right key
  3275. //! @since 1.0.0
  3276. const KEY_UP_RIGHT = 15;
  3277.  
  3278. //! The following keys have been added after ConnectIQ version 1.1.2. Before
  3279. //! evaluating these keys, the test ( Toybox.WatchUi has :EXTENDED_KEYS ) should be
  3280. //! made.
  3281. //! @since 1.1.2
  3282. const EXTENDED_KEYS = 16;
  3283.  
  3284. //! The page key
  3285. //! @since 1.1.2
  3286. const KEY_PAGE = 17;
  3287.  
  3288. //! The start key
  3289. //! @since 1.1.2
  3290. const KEY_START = 18;
  3291.  
  3292. //! The lap key
  3293. //! @since 1.1.2
  3294. const KEY_LAP = 19;
  3295.  
  3296. //! The reset key
  3297. //! @since 1.1.2
  3298. const KEY_RESET = 20;
  3299.  
  3300. //! The sport key
  3301. //! @since 1.1.2
  3302. const KEY_SPORT = 21;
  3303.  
  3304. //! The clock key
  3305. //! @since 1.1.2
  3306. const KEY_CLOCK = 22;
  3307.  
  3308. //! The mode key
  3309. //! @since 1.1.2
  3310. const KEY_MODE = 23;
  3311.  
  3312. //! Animate the property linearly, so the speed remains constant over time
  3313. //! @since 1.0.0
  3314. const ANIM_TYPE_LINEAR = 0;
  3315.  
  3316. //! Animate the property so the speed increases until the end
  3317. //! @since 1.0.0
  3318. const ANIM_TYPE_EASE_IN = 1;
  3319.  
  3320. //! Animate the property so the speed increases until the end
  3321. //! @since 1.0.0
  3322. const ANIM_TYPE_EASE_OUT = 2;
  3323.  
  3324. //! Animate the property so there is a initial speed up and slow down at the end
  3325. //! @since 1.0.0
  3326. const ANIM_TYPE_EASE_IN_OUT = 3;
  3327.  
  3328. //! Key is pressed down
  3329. //! @since 1.1.2
  3330. const PRESS_TYPE_DOWN = 0;
  3331.  
  3332. //! Key is released
  3333. //! @since 1.1.2
  3334. const PRESS_TYPE_UP = 1;
  3335.  
  3336. //! Key action is performed
  3337. //! @since 1.1.2
  3338. const PRESS_TYPE_ACTION = 2;
  3339.  
  3340. //! A quick press and release of the screen
  3341. //! @since 1.0.0
  3342. const CLICK_TYPE_TAP = 0;
  3343.  
  3344. //! A press and hold of the screen
  3345. //! @since 1.0.0
  3346. const CLICK_TYPE_HOLD = 1;
  3347.  
  3348. //! A release of a hold on the screen
  3349. //! @since 1.0.0
  3350. const CLICK_TYPE_RELEASE = 2;
  3351.  
  3352. //! A swipe in the upward direction
  3353. //! @since 1.0.0
  3354. const SWIPE_UP = 0;
  3355.  
  3356. //! A swipe towards the right
  3357. //! @since 1.0.0
  3358. const SWIPE_RIGHT = 1;
  3359.  
  3360. //! A swipe in the downward direction
  3361. //! @since 1.0.0
  3362. const SWIPE_DOWN = 2;
  3363.  
  3364. //! A swipe towards the left
  3365. //! @since 1.0.0
  3366. const SWIPE_LEFT = 3;
  3367.  
  3368. //! @since 1.0.0
  3369. const CONFIRM_NO = 0;
  3370.  
  3371. //! @since 1.0.0
  3372. const CONFIRM_YES = 1;
  3373.  
  3374. //! A Float in meters
  3375. //! @since 1.0.0
  3376. const NUMBER_PICKER_DISTANCE = 0;
  3377.  
  3378. //! A Duration
  3379. //! @since 1.0.0
  3380. const NUMBER_PICKER_TIME = 1;
  3381.  
  3382. //! A Duration
  3383. //! @since 1.0.0
  3384. const NUMBER_PICKER_TIME_MIN_SEC = 2;
  3385.  
  3386. //! A Duration representing the number of seconds since midnight
  3387. //! @since 1.0.0
  3388. const NUMBER_PICKER_TIME_OF_DAY = 3;
  3389.  
  3390. //! A Float in kilograms
  3391. //! @since 1.0.0
  3392. const NUMBER_PICKER_WEIGHT = 4;
  3393.  
  3394. //! A Float in meters
  3395. //! @since 1.0.0
  3396. const NUMBER_PICKER_HEIGHT = 5;
  3397.  
  3398. //! A Number
  3399. //! @since 1.0.0
  3400. const NUMBER_PICKER_CALORIES = 6;
  3401.  
  3402. //! A Number
  3403. //! @since 1.0.0
  3404. const NUMBER_PICKER_BIRTH_YEAR = 7;
  3405.  
  3406. //! Transition for pushView/popView.
  3407. //!
  3408. //! No transition.
  3409. //! @since 1.0.0
  3410. const SLIDE_IMMEDIATE = 0;
  3411.  
  3412. //! The View slides to the left.
  3413. //! @since 1.0.0
  3414. const SLIDE_LEFT = 1;
  3415.  
  3416. //! The View slides to the right.
  3417. //! @since 1.0.0
  3418. const SLIDE_RIGHT = 2;
  3419.  
  3420. //! The View slides down.
  3421. //! @since 1.0.0
  3422. const SLIDE_DOWN = 3;
  3423.  
  3424. //! The View slides up.
  3425. //! @since 1.0.0
  3426. const SLIDE_UP = 4;
  3427.  
  3428. //! Set a Drawable's locY property to this to align it to the top edge of the dc.
  3429. //! @since 1.2.0
  3430. const LAYOUT_VALIGN_TOP = -0x7FFFFFFF;
  3431.  
  3432. //! Set a Drawable's locY property to this to align it to the bottom edge of the dc.
  3433. //! @since 1.2.0
  3434. const LAYOUT_VALIGN_BOTTOM = -0x7FFFFFFE;
  3435.  
  3436. //! Set a Drawable's locY property to this to center it vertically in the dc.
  3437. //! @since 1.2.0
  3438. const LAYOUT_VALIGN_CENTER = -0x7FFFFFFD;
  3439.  
  3440. //! Set the Drawable's locY property equal to it's parent's locY property.
  3441. //! @since 1.2.0
  3442. const LAYOUT_VALIGN_START = -0x7FFFFFFC;
  3443.  
  3444. //! Set a Drawable's locX property to this to align it along the left edge of the
  3445. //! dc.
  3446. //! @since 1.2.0
  3447. const LAYOUT_HALIGN_LEFT = -0x7FFFFFFF;
  3448.  
  3449. //! Set a Drawable's locX property to this to align it along the right edge of the
  3450. //! dc.
  3451. //! @since 1.2.0
  3452. const LAYOUT_HALIGN_RIGHT = -0x7FFFFFFE;
  3453.  
  3454. //! Set a Drawable's locX property to this to center it horizontally in the dc.
  3455. //! @since 1.2.0
  3456. const LAYOUT_HALIGN_CENTER = -0x7FFFFFFD;
  3457.  
  3458. //! Set a Drawable's locX property equal to it's parent's locX property.
  3459. //! @since 1.2.0
  3460. const LAYOUT_HALIGN_START = -0x7FFFFFFC;
  3461.  
  3462. //! BehaviorDelegate handles behavior inputs. A BehaviorDelegate differs from an
  3463. //! InputDelegate in that it acts upon device independent behaviours such as next
  3464. //! page and previous page. On touch screen devices these behaviors might be mapped
  3465. //! to the basic swipe left and right inputs, while on non-touch screen devices
  3466. //! these behaviors might be mapped to actual keys. BehaviorDelegate extends
  3467. //! InputDelegate so it can also act on basic inputs as well. If a BehaviorDelegate
  3468. //! does return true for a function, indicating that the input was used, then the
  3469. //! InputDelegate function that corresponds to the behavior will be called.
  3470. //! @since 1.0.0
  3471. //! @see InputDelegate
  3472. class BehaviorDelegate extends InputDelegate {
  3473. //! Constructor
  3474. //! @since 1.0.0
  3475. function initialize() {}
  3476.  
  3477. //! This is the function that maps low level events to delegate events. DO NOT
  3478. //! OVERRIDE.
  3479. //! @since 1.0.0
  3480. function handleEvent() {}
  3481.  
  3482. //! When a back behavior occurs, onBack() is called.
  3483. //! @since 1.0.0
  3484. //! @return [Boolean] true if handled, false otherwise
  3485. function onBack() {}
  3486.  
  3487. //! When a menu behavior occurs, onMenu() is called.
  3488. //! @since 1.0.0
  3489. //! @return [Boolean] true if handled, false otherwise
  3490. function onMenu() {}
  3491.  
  3492. //! When a next mode behavior occurs, onNextMode() is called.
  3493. //! @since 1.0.0
  3494. //! @return [Boolean] true if handled, false otherwise
  3495. function onNextMode() {}
  3496.  
  3497. //! When a next page behavior occurs, onNextPage() is called.
  3498. //! @since 1.0.0
  3499. //! @return [Boolean] true if handled, false otherwise
  3500. function onNextPage() {}
  3501.  
  3502. //! When a previous mode behavior occurs, onPreviousMode() is called.
  3503. //! @since 1.0.0
  3504. //! @return [Boolean] true if handled, false otherwise
  3505. function onPreviousMode() {}
  3506.  
  3507. //! When a previous page behavior occurs, onPreviousPage() is called.
  3508. //! @since 1.0.0
  3509. //! @return [Boolean] true if handled, false otherwise
  3510. function onPreviousPage() {}
  3511.  
  3512. //! When the selection behavior occurs, onSelect() is called
  3513. //! @since 1.2.0
  3514. //! @return [Boolean] true if handled, false otherwise
  3515. function onSelect() {}
  3516.  
  3517. }
  3518.  
  3519. //! Bitmap is the class representation of a bitmap resource. It is Created by the
  3520. //! resource compiler.
  3521. //! @since 1.0.0
  3522. //! @see Drawable
  3523. class Bitmap extends Drawable {
  3524. //! Constructor
  3525. //! @since 1.0.0
  3526. //! @see Drawable#initialize
  3527. //! @param [Dictionary] dictionary A Dictionary containing the settings
  3528. //! @option [Symbol] :rezId The Rez identifier for the bitmap
  3529. function initialize(dictionary) {}
  3530.  
  3531. //! Draw the bitmap with draw().
  3532. //! @since 1.0.0
  3533. //! @param [Graphics.Dc] dc The device context
  3534. function draw(dc) {}
  3535.  
  3536. //! Get the dimensions of the bitmap with getDimensions().
  3537. //! @since 1.0.0
  3538. //! @return [Array] A two element array with the contents [width, height]
  3539. function getDimensions() {}
  3540.  
  3541. //! Use setBitmap() to set the resource associated with the Bitmap.
  3542. //! @since 1.0.0
  3543. //! @param [Symbol] rezId The Rez identifier for the bitmap
  3544. function setBitmap(rezId) {}
  3545.  
  3546. }
  3547.  
  3548. //! BitmapResource is the class representation of a bitmap resource. Returned from
  3549. //! WatchUi.loadResource().
  3550. //! @since 1.0.0
  3551. class BitmapResource {
  3552. //! Use getHeight() to get the height of the bitmap.
  3553. //! @since 1.0.0
  3554. //! @return [Number] Height of bitmap
  3555. function getHeight() {}
  3556.  
  3557. //! Use getWidth() to get the width of the bitmap.
  3558. //! @since 1.0.0
  3559. //! @return [Number] Width of bitmap
  3560. function getWidth() {}
  3561.  
  3562. //! Use toString() to print info about this object.
  3563. //! @since 1.0.0
  3564. //! @return [String] A String representation of BitmapResource
  3565. function toString() {}
  3566.  
  3567. }
  3568.  
  3569. //! ClickEvent is an object sent to InputDelegate when the user presses the touch
  3570. //! screen.
  3571. //! @since 1.0.0
  3572. class ClickEvent {
  3573. //! Constructor
  3574. //! @since 1.0.0
  3575. //! @param [Number] x The x-coordinate of the click
  3576. //! @param [Number] y The y-coordinate of the click
  3577. //! @param type The CLICK_TYPE for this event
  3578. function initialize(x, y, type) {}
  3579.  
  3580. //! Get the coordinates of the press with getCoordinates
  3581. //! @since 1.0.0
  3582. //! @return [Array] The press coordinates as an array of [x, y]
  3583. function getCoordinates() {}
  3584.  
  3585. //! Get the type of click event.
  3586. //! @since 1.0.0
  3587. //! @return The WATCH_UI.CLICK_TYPE_* value
  3588. function getType() {}
  3589.  
  3590. }
  3591.  
  3592. //! This is the on-screen representation of the confirmation dialog. The
  3593. //! look-and-feel will be device specific. Confirmations are pushed using
  3594. //! WatchUi.pushView(), providing a ConfirmationDelegate for the input delegate.
  3595. //! @since 1.0.0
  3596. class Confirmation {
  3597. //! Constructor
  3598. //! @since 1.0.0
  3599. //! @param [String] message A textual confirmation message
  3600. function initialize(message) {}
  3601.  
  3602. }
  3603.  
  3604. //! ConfirmationDelegate handles a response being chosen in the Confirmation.
  3605. //! @since 1.0.0
  3606. class ConfirmationDelegate {
  3607. //! When a response is chosen, onResponse() is called, passing the response of
  3608. //! CONFIRM_NO or CONFIRM_YES
  3609. //! @since 1.0.0
  3610. //! @param response The response of the confirmation of CONFIRM_NO or CONFIRM_YES
  3611. function onResponse(response) {}
  3612.  
  3613. }
  3614.  
  3615. //! The DataField class is used for creating data fields. In a DataField, the
  3616. //! developer will implement a compute method, which is called by the system once
  3617. //! per second, with an Activity.Info object. The system will call the onUpdate()
  3618. //! method inherited from View when the field is displayed by the system.
  3619. //! @since 1.0.0
  3620. //! @device All devices
  3621. class DataField extends View {
  3622. //! Some of the left edge of the device context is obscured
  3623. //! @since 1.0.0
  3624. const OBSCURE_LEFT = 1;
  3625.  
  3626. //! Some of the top edge of the device context is obscured
  3627. //! @since 1.0.0
  3628. const OBSCURE_TOP = 2;
  3629.  
  3630. //! Some of the right edge of the device context is obscured
  3631. //! @since 1.0.0
  3632. const OBSCURE_RIGHT = 4;
  3633.  
  3634. //! Some of the bottom edge of the device context is obscured
  3635. //! @since 1.0.0
  3636. const OBSCURE_BOTTOM = 8;
  3637.  
  3638. //! Constructor
  3639. //! @since 1.0.0
  3640. function initialize() {}
  3641.  
  3642. //! To retrieve Activity.Info data for DataFields, it is necessary to override
  3643. //! compute(). This is the method that is called to update the field information.
  3644. //! @since 1.0.0
  3645. //! @param [Activity.Info] info The updated Activity.Info object
  3646. function compute(info) {}
  3647.  
  3648. //! Returns the current background color for data fields, which is either
  3649. //! Graphics.COLOR_WHITE or Graphics.COLOR_BLACK
  3650. //! @since 1.2.0
  3651. //! @return [Number] the current background color for data fields, which is either Graphics.COLOR_WHITE or Graphics.COLOR_BLACK
  3652. function getBackgroundColor() {}
  3653.  
  3654. //! Returns mask of OBSCURE_X values giving the sides of the display that that are
  3655. //! obscured by a round screen. Valid during onUpdate.
  3656. //! @since 1.0.0
  3657. //! @return [Number] mask of OBSCURE_X values giving the sides of the display that that are obscured by a round screen. Valid during onUpdate.
  3658. function getObscurityFlags() {}
  3659.  
  3660. }
  3661.  
  3662. //! A Drawable is the base class of a drawable object. A Drawable can be constructed
  3663. //! using the resource compiler and loaded through the Rez module.
  3664. //! @since 1.0.0
  3665. class Drawable {
  3666. //! The clip height
  3667. //! @since 1.0.0
  3668. //! @return [Number]
  3669. var height;
  3670.  
  3671. //! The id used to identify the Drawable
  3672. //! @since 1.0.0
  3673. //! @return [String]
  3674. var identifier;
  3675.  
  3676. //! The absolute screen x-coordinate
  3677. //! @since 1.0.0
  3678. //! @return [Number]
  3679. var locX;
  3680.  
  3681. //! The absolute screen y-coordinate
  3682. //! @since 1.0.0
  3683. //! @return [Number]
  3684. var locY;
  3685.  
  3686. //! The clip width
  3687. //! @since 1.0.0
  3688. //! @return [Number]
  3689. var width;
  3690.  
  3691. //! Constructor
  3692. //! @since 1.0.0
  3693. //! @param [Dictionary] dictionary A Dictionary containing the settings
  3694. //! @option [String] :identifier The identifier for the Drawable
  3695. //! @option [Number] :locX The absolute screen x-coordinate for the Drawable
  3696. //! @option [Number] :locY The absolute screen y-coordinate for the Drawable
  3697. //! @option [Number] :width The clip width of the Drawable
  3698. //! @option [Number] :height The clip height of the Drawable
  3699. function initialize(dictionary) {}
  3700.  
  3701. //! Draw the object to the display context with draw(). Assume that the device
  3702. //! context has already been configured to the proper settings.
  3703. //! @since 1.0.0
  3704. //! @param [Graphics.Dc] dc The device context
  3705. function draw(dc) {}
  3706.  
  3707. //! Set the location for this Drawable object with setLocation().
  3708. //! @since 1.0.0
  3709. //! @param [Number] x Horizontal position on the screen
  3710. //! @param [Number] y Vertical position on the screen
  3711. function setLocation(x, y) {}
  3712.  
  3713. //! Set the size of this Drawable object with setSize().
  3714. //! @since 1.0.0
  3715. //! @param [Number] w Width of the Drawable object
  3716. //! @param [Number] h Height of the Drawable object
  3717. function setSize(w, h) {}
  3718.  
  3719. }
  3720.  
  3721. //! FontResource is the class representation of a font resource. Returned from
  3722. //! WatchUi.loadResource().
  3723. //! @since 1.0.0
  3724. class FontResource {
  3725. }
  3726.  
  3727. //! InputDelegate handles basic input events. There are three types of basic inputs:
  3728. //! key, touch, and swipe.
  3729. //! @since 1.0.0
  3730. class InputDelegate {
  3731. //! This is the function that maps low level events to delegate events. DO NOT
  3732. //! OVERRIDE.
  3733. //! @since 1.0.0
  3734. function handleEvent() {}
  3735.  
  3736. //! When a screen hold event occurs, onHold() is called. This is sent if user
  3737. //! touches and holds on the screen.
  3738. //! @since 1.0.0
  3739. //! @param [ClickEvent] evt A ClickEvent object containing information about the hold
  3740. //! @return [Boolean] true if handled, false otherwise
  3741. function onHold(evt) {}
  3742.  
  3743. //! When a hard key is pressed, onKey() is called.
  3744. //! @since 1.0.0
  3745. //! @param [KeyEvent] evt The KeyEvent that occured. Call evt.getKey() to get the WatchUi.KEY_* enum value.
  3746. //! @return [Boolean] true if handled, false otherwise
  3747. function onKey(evt) {}
  3748.  
  3749. //! When a hard key is pressed down, onKeyPressed() is called.
  3750. //! @since 1.1.2
  3751. //! @param [KeyEvent] evt The KeyEvent that occured. Call evt.getKey() to get the WatchUi.KEY_* enum value.
  3752. //! @return [Boolean] true if handled, false otherwise
  3753. function onKeyPressed(evt) {}
  3754.  
  3755. //! When a hard key is released, onKeyReleased() is called.
  3756. //! @since 1.1.2
  3757. //! @param [KeyEvent] evt The KeyEvent that occured. Call evt.getKey() to get the WatchUi.KEY_* enum value.
  3758. //! @return [Boolean] true if handled, false otherwise
  3759. function onKeyReleased(evt) {}
  3760.  
  3761. //! When a screen release event occurs, onRelease() is called. This is only sent
  3762. //! after an onHold event when the user stops touching the screen.
  3763. //! @since 1.0.0
  3764. //! @param [ClickEvent] evt A ClickEvent object containing information about the release
  3765. //! @return [Boolean] true if handled, false otherwise
  3766. function onRelease(evt) {}
  3767.  
  3768. //! When a swipe event occurs, onSwipe() is called. This is sent when the user
  3769. //! swipes the screen.
  3770. //! @since 1.0.0
  3771. //! @param [SwipeEvent] evt A SwipeEvent object containing information about the swipe
  3772. //! @return [Boolean] true if handled, false otherwise
  3773. function onSwipe(evt) {}
  3774.  
  3775. //! When a screen tap event occurs, onTap() is called. This is sent if the user taps
  3776. //! (quickly presses and releases) the screen.
  3777. //! @since 1.0.0
  3778. //! @param [ClickEvent] evt A ClickEvent object containing information about the tap
  3779. //! @return [Boolean] true if handled, false otherwise
  3780. function onTap(evt) {}
  3781.  
  3782. }
  3783.  
  3784. //! KeyEvent is an object sent to InputDelegate when a hard key is pressed on the
  3785. //! device.
  3786. //! @since 1.0.0
  3787. class KeyEvent {
  3788. //! Constructor
  3789. //! @since 1.0.0
  3790. //! @param keyValue A Toybox.WatchUi.KEY_* value
  3791. //! @param keyPressType The PRESS_TYPE for this event (since 1.1.2)
  3792. function initialize(keyValue, keyPressType) {}
  3793.  
  3794. //! Use getKey() to get the key value of this event.
  3795. //! @since 1.0.0
  3796. //! @return A Toybox.WatchUi.KEY_* value
  3797. function getKey() {}
  3798.  
  3799. //! Get the type of click event.
  3800. //! @since 1.1.2
  3801. //! @return The WATCH_UI.PRESS_TYPE_* value
  3802. function getType() {}
  3803.  
  3804. }
  3805.  
  3806. //! Menu is a representation of an on-screen menu. The look-and-feel of the menu
  3807. //! will be device specific. It presents the user with a list of options and after
  3808. //! the user chooses one, the registered MenuInputDelegate.onMenuItem() will be
  3809. //! called. While a Menu can be generated programatically, in general they should be
  3810. //! created as a resource. Menus are pushed using WatchUi.pushView(), providing a
  3811. //! MenuInputDelegate for the input delegate.
  3812. //! @since 1.0.0
  3813. class Menu {
  3814. //! The maximum number of entries in a Menu
  3815. //! @since 1.0.0
  3816. const MAX_SIZE = 16;
  3817.  
  3818. //! Add an entry to a Menu with addItem().
  3819. //! @since 1.0.0
  3820. //! @param [String] name The item text or the Rez ID of a string resource
  3821. //! @param [Symbol] id A symbol representing the Menu item value
  3822. function addItem(name, id) {}
  3823.  
  3824. //! Set a title for the menu.
  3825. //! @since 1.0.0
  3826. //! @param [String] title The title text or the Rez ID of a string resource
  3827. function setTitle(title) {}
  3828.  
  3829. }
  3830.  
  3831. //! MenuInputDelegate responds to a Menu selection. This class should be extended to
  3832. //! get the chosen Menu item.
  3833. //! @since 1.0.0
  3834. class MenuInputDelegate {
  3835. //! When a Menu item is chosen, onMenuItem() is called.
  3836. //! @since 1.0.0
  3837. //! @param [Symbol] item The id of the chosen Menu item
  3838. function onMenuItem(item) {}
  3839.  
  3840. }
  3841.  
  3842. //! @deprecated The NumberPicker class will be dropped in Connect IQ 3.0.0
  3843. //! The NumberPicker class will be dropped in Connect IQ 3.0.0
  3844. //!
  3845. //! This is the
  3846. //! on-screen representation of number picker. The look-and-feel will be device
  3847. //! specific. NumberPickers are pushed using WatchUi.pushView(), providing a
  3848. //! NumberPickerDelegate for the input delegate. There are minimum and maximum
  3849. //! values enforced by the product for each mode. The initial value will be modified
  3850. //! to be within these bounds.
  3851. //! @since 1.0.0
  3852. class NumberPicker {
  3853. //! Constructor
  3854. //! @since 1.0.0
  3855. //! @param mode An enum value of type NUMBER_PICKER_*
  3856. //! @param initialValue The initial value for the Number Picker, type depends on mode
  3857. function initialize(mode, initialValue) {}
  3858.  
  3859. }
  3860.  
  3861. //! @deprecated The NumberPickerDelegate class will be dropped in Connect IQ 3.0.0
  3862. //! The NumberPickerDelegate class will be dropped in Connect IQ
  3863. //! 3.0.0
  3864. //!
  3865. //! NumberPickerDelegate responds to a number being chosen. This class should
  3866. //! be extended to get the chosen number.
  3867. //! @since 1.0.0
  3868. class NumberPickerDelegate {
  3869. //! When a number is chosen, onNumberPicked() is called, passing the chosen value.
  3870. //! @since 1.0.0
  3871. //! @param value The chosen number, type depends on the NumberPicker mode
  3872. function onNumberPicked(value) {}
  3873.  
  3874. }
  3875.  
  3876. //! This is the on-screen representation of a generic picker. The look-and-feel will
  3877. //! be device specific, although every device will have the same general layout. A
  3878. //! Picker will consist of one or more choosable objects, a title, a next and
  3879. //! previous arrow, and a confirm button. The next and previous arrows and the
  3880. //! confirm button are device specific but can be overwritten if desired. Pickers
  3881. //! are pushed using WatchUi.pushView(), providing a PickerDelegate for the input
  3882. //! delegate. A PickerFactory is required to indicate what should be displayed for
  3883. //! each pickable value.
  3884. //!
  3885. //! A Picker uses a PickerFactory to decide what to display to
  3886. //! the user. It is capable of displaying any number of entries for the user to
  3887. //! choose from. For instance, if the PickerFactory was [new NumberFactory(), new
  3888. //! Ui.Text(:text=>“-”), new NumberFactory()] then the Picker will have three
  3889. //! entries: a choosable number, a non-choosable “-”, and another choosable number.
  3890. //! @since 1.2.0
  3891. class Picker extends View {
  3892. //! Constructor
  3893. //! @since 1.2.0
  3894. //! @param [Dictionary] options @see Picker#setOptions
  3895. function initialize(options) {}
  3896.  
  3897. //! Set the options for the Picker.
  3898. //! @since 1.2.0
  3899. //! @param [Dictionary] options the options for the Picker
  3900. //! @option [Drawable] :title the title for the Picker. Required.
  3901. //! @option [Array] :pattern an Array of [Object] for the Picker to display. If the Array entry is a PickerFactory then it is presented to the user to make a choice. If it is a Drawable then it is display only. Required.
  3902. //! @option [Array] :defaults an Array of [Number] indicating the starting index for each entry in :pattern. Optional.
  3903. //! @option [Drawable] :nextArrow a custom next icon for the Picker. Optional.
  3904. //! @option [Drawable] :previousArrow a custom previous icon for the Picker. Optional.
  3905. //! @option [Drawable] :confirm a custom confirm icon for the Picker. Optional.
  3906. function setOptions(options) {}
  3907.  
  3908. }
  3909.  
  3910. //! PickerDelegate responds to a confirm or cancel. The Picker does not
  3911. //! automatically call popView. event from a [Picker].
  3912. //! @since 1.2.0
  3913. class PickerDelegate {
  3914. //! Handle a confirm event from a [Picker]
  3915. //! @since 1.2.0
  3916. //! @param [Array] values The chosen values from the Picker. For [Drawable] entries, null will be returned for that value.
  3917. function onAccept(values) {}
  3918.  
  3919. //! Handle a cancel event from a [Picker]
  3920. //! @since 1.2.0
  3921. function onCancel() {}
  3922.  
  3923. }
  3924.  
  3925. //! A PickerFactory is used by a Picker to display Drawables to be chosen.
  3926. //! @since 1.2.0
  3927. class PickerFactory {
  3928. //! Generate a Drawable instance for a given item
  3929. //! @since 1.2.0
  3930. //! @param [Number] item Item index
  3931. //! @param [Boolean] isSelected true if the current item is the selected item, false otherwise
  3932. //! @return [Drawable] object to be rendered
  3933. function getDrawable(item, isSelected) {}
  3934.  
  3935. //! Get the number of items in the factory
  3936. //! @since 1.2.0
  3937. //! @return [Number] number of items in the factory
  3938. function getSize() {}
  3939.  
  3940. //! Return a representative value for this item
  3941. //! @since 1.2.0
  3942. //! @param [Number] item Item index
  3943. //! @return [Object] Representative item for the given index
  3944. function getValue(item) {}
  3945.  
  3946. }
  3947.  
  3948. //! This is the on-screen representation of a progress bar. The look-and-feel will
  3949. //! be device specific. ProgressBars are pushed using WatchUi.pushView(), providing
  3950. //! either null or a behavior delegate. If a behavior delegate is provided, the
  3951. //! onBack method will be called if the user presses the back button from the
  3952. //! progressBar view. This can display a string and either a progress bar from
  3953. //! 0-100% or a busy bar.
  3954. //! @since 1.0.0
  3955. class ProgressBar {
  3956. //! Constructor
  3957. //! @since 1.0.0
  3958. //! @param [String] displayString The string to display on the progress bar view
  3959. //! @param [Float] startValue The initial value for the progress bar (0-100), null for “busy”
  3960. function initialize(displayString, startValue) {}
  3961.  
  3962. //! Use setDisplayString() to set the string displayed on the progress bar view.
  3963. //! @since 1.0.0
  3964. //! @param [String] displayString The string to display on the progress bar view
  3965. function setDisplayString(displayString) {}
  3966.  
  3967. //! Use setProgress() to set the value of the progress bar.
  3968. //! @since 1.0.0
  3969. //! @param [Float] progressValue The value for the progress bar (0-100), null for “busy”
  3970. function setProgress(progressValue) {}
  3971.  
  3972. }
  3973.  
  3974. //! The SimpleDataField class is used for creating simple data fields. In a
  3975. //! SimpleDataField, the developer is only required to implement a compute method.
  3976. //! The compute method is passed an Activity.Info object, which contains all current
  3977. //! workout information. The compute method should return a value to be displayed.
  3978. //! Allowed types are Number, Float, Long, Double, Duration, and String. The
  3979. //! SimpleDataField also contains a variable “label”. This variable should be
  3980. //! assigned to a String label for the field.
  3981. //! @since 1.0.0
  3982. //! @device All devices
  3983. class SimpleDataField extends DataField {
  3984. //! @since 1.0.0
  3985. var label;
  3986.  
  3987. //! Constructor
  3988. //! @since 1.0.0
  3989. function initialize() {}
  3990.  
  3991. //! To retrieve Activity.Info data for DataFields, it is necessary to override
  3992. //! compute(). This is the method that is called to update the field information.
  3993. //! @since 1.0.0
  3994. //! @param [Activity.Info] info The updated Activity.Info object
  3995. function compute(info) {}
  3996.  
  3997. }
  3998.  
  3999. //! SwipeEvent is an object sent to InputDelegate when the user swipes the touch
  4000. //! screen.
  4001. //! @since 1.0.0
  4002. class SwipeEvent {
  4003. //! Constructor
  4004. //! @since 1.0.0
  4005. //! @param direction The WatchUi.SWIPE_* value
  4006. function initialize(direction) {}
  4007.  
  4008. //! Get the direction of the swipe with getDirection().
  4009. //! @since 1.0.0
  4010. //! @return The WatchUi.SWIPE_* value
  4011. function getDirection() {}
  4012.  
  4013. }
  4014.  
  4015. //! Text is the class representation of text from the resource compiler.
  4016. //! @since 1.0.0
  4017. //! @see Drawable
  4018. class Text extends Drawable {
  4019. //! Constructor
  4020. //! @since 1.0.0
  4021. //! @see Drawable#initializes
  4022. //! @param [Dictionary] dictionary A Dictionary containing the settings
  4023. //! @option [Object] :text The text string or the Rez ID of a string resource
  4024. //! @option [Object] :color The text color of type Graphics.COLOR_*
  4025. //! @option [Object] :font The font to use of type Graphics.FONT_*
  4026. //! @option [Object] :justification The text justification of type Graphics.TEXT_JUSTIFY_*
  4027. function initialize(dictionary) {}
  4028.  
  4029. //! Draw the Text resource with draw().
  4030. //! @since 1.0.0
  4031. //! @param [Graphics.Dc] dc The draw context
  4032. function draw(dc) {}
  4033.  
  4034. //! Use setColor() to set the text color.
  4035. //! @since 1.0.0
  4036. //! @param color The text color of type Graphics.COLOR_*
  4037. function setColor(color) {}
  4038.  
  4039. //! Use setFont() to set the text font.
  4040. //! @since 1.0.0
  4041. //! @param font The font to use of type Graphics.FONT_* or from WatchUi.loadResource()
  4042. function setFont(font) {}
  4043.  
  4044. //! Use setJustification() to set the text justification.
  4045. //! @since 1.0.0
  4046. //! @param justification The text justification of type Graphics.TEXT_JUSTIFY_*
  4047. function setJustification(justification) {}
  4048.  
  4049. //! Use setText() to set the text string.
  4050. //! @since 1.0.0
  4051. //! @param [String] text The text string or the Rez ID of a string resource
  4052. function setText(text) {}
  4053.  
  4054. }
  4055.  
  4056. //! This is the on-screen representation of text picker. The look-and-feel will be
  4057. //! device specific. TextPickers are pushed using WatchUi.pushView(), providing a
  4058. //! TextPickerDelegate for the input delegate. A default value can be provided and
  4059. //! will be displayed as editable text with the cursor at the end.
  4060. //! @since 1.1.0
  4061. //! @device Forerunner 920XT
  4062. //! @device fenix 3
  4063. //! @device epix
  4064. class TextPicker {
  4065. //! Constructor
  4066. //! @since 1.1.0
  4067. //! @param initialText The initial text for the Number Picker, type depends on mode
  4068. function initialize(initialText) {}
  4069.  
  4070. }
  4071.  
  4072. //! TextPickerDelegate responds to text being entered This class should be extended
  4073. //! to get the chosen text.
  4074. //! @since 1.1.0
  4075. //! @device Forerunner 920XT
  4076. //! @device fenix 3
  4077. //! @device epix
  4078. class TextPickerDelegate {
  4079. //! When the user cancels entering text, onCancel() is called.
  4080. //! @since 1.1.0
  4081. function onCancel() {}
  4082.  
  4083. //! When text is entered, onTextEntered() is called, passing the entered text.
  4084. //! @since 1.1.0
  4085. //! @param [String] text The entered text
  4086. //! @param [Boolean] changed If the entered text was modified
  4087. function onTextEntered(text, changed) {}
  4088.  
  4089. }
  4090.  
  4091. //! View is the base class for a drawable page. It handles the lifecycle of each
  4092. //! View in an app. For widgets and watch-apps the lifecyle is onStart(),
  4093. //! onLayout(), onShow(), onUpdate() and onHide(). For watchfaces and datafields the
  4094. //! lifecycle is onLayout(), onShow() and onUpdate(). For datafields, if the size
  4095. //! changed since the last onUpdate(), onLayout() will be called prior to
  4096. //! onUpdate(). SimpleDataField objects don't have the same life cycle. onLayout(),
  4097. //! onShow(), and onUpdate() aren't called for SimpleDataField objects.
  4098. //! @since 1.0.0
  4099. class View {
  4100. //! Find a Drawable by its ID.
  4101. //! @since 1.0.0
  4102. //! @param [String] id The ID of the Drawable to find
  4103. //! @return [WatchUi.Drawable] The Drawable if found, null otherwise
  4104. function findDrawableById(id) {}
  4105.  
  4106. //! Before the View is removed from the foreground, onHide() is called. Here you
  4107. //! should free resources from memory if you are planning on leaving this view on
  4108. //! the page stack.
  4109. //! @since 1.0.0
  4110. function onHide() {}
  4111.  
  4112. //! The entry point for the View is onLayout(). This is called before the View is
  4113. //! shown to load resources and set up the layout of the View.
  4114. //! @since 1.0.0
  4115. //! @param [Graphics.Dc] dc The drawing context
  4116. //! @return [Boolean] true if handled, false otherwise
  4117. function onLayout(dc) {}
  4118.  
  4119. //! When the View is brought into the foreground, onShow() is called. This is where
  4120. //! you should load resources into system memory for use in this view.
  4121. //! @since 1.0.0
  4122. //! @return [Boolean] true if handled, false otherwise
  4123. function onShow() {}
  4124.  
  4125. //! When a View is active, onUpdate() is used to update dynamic content. This
  4126. //! function is called when the View is brought to the foreground. For widgets and
  4127. //! watch-apps it is also called when WatchUi.requestUpdate() is called. For
  4128. //! watchfaces it is called once a minute and for datafields it is called once a
  4129. //! second. If a class that extends View does not implement this function then any
  4130. //! Drawables contained in the View will automatically be drawn.
  4131. //! @since 1.0.0
  4132. //! @param [Graphics.Dc] dc The drawing context
  4133. //! @return [Boolean] true if handled, false otherwise
  4134. function onUpdate(dc) {}
  4135.  
  4136. //! Use setLayout() to set the layout for the View. If the extending class does not
  4137. //! override onUpdate(), then all Drawables contained in layout will automatically
  4138. //! be drawn by the View.
  4139. //! @since 1.0.0
  4140. //! @param [Layout] layout An array of Drawables
  4141. function setLayout(layout) {}
  4142.  
  4143. }
  4144.  
  4145. //! The WatchFace class is used for creating watch faces that support
  4146. //! exiting/entering low power mode. The developer will use the WatchFace View to
  4147. //! tie in to gestures. This will enable the watchface to update at a faster rate
  4148. //! than once a minute when the user has brought the watch “up”, presumably to look
  4149. //! at it. “Sleep” will be entered when the user looks away (lowers the watch) or
  4150. //! the watch times out and automatically reenters sleep.
  4151. //! @since 1.0.0
  4152. class WatchFace extends View {
  4153. //! Constructor
  4154. //! @since 1.0.0
  4155. function initialize() {}
  4156.  
  4157. //! onEnterSleep() is called when the watch is entering sleep mode. Terminate any
  4158. //! active timers and prepare for slow updates.
  4159. //! @since 1.0.0
  4160. function onEnterSleep() {}
  4161.  
  4162. //! onExitSleep() is called when the watch is exiting sleep mode. Timers and
  4163. //! animations may be started here.
  4164. //! @since 1.0.0
  4165. function onExitSleep() {}
  4166.  
  4167. }
  4168.  
  4169. //! Use animate() to animate a property over a given period of time. The animation
  4170. //! starts after the call and runs the length of the specified period. During this
  4171. //! time the View's draw callback will be called.
  4172. //! @since 1.0.0
  4173. //! @param [Drawable] drawable Drawable to animate
  4174. //! @param [Symbol] property Symbol of property to animate over time
  4175. //! @param type Toybox.WatchUi.ANIM_TYPE_* value
  4176. //! @param [Number] start Initial value of property
  4177. //! @param [Number] stop Final value of property after animation
  4178. //! @param [Float] period Time in seconds for animation to run
  4179. //! @param [Method] callback Method object to call when complete, or null
  4180. function animate(drawable, property, type, start, stop, period, callback) {}
  4181.  
  4182. //! @since 1.0.0
  4183. function initResources() {}
  4184.  
  4185. //! Load a resource from the executable with loadResource().
  4186. //! @since 1.0.0
  4187. //! @param [Symbol] resource Rez identifier from resources.xml to load
  4188. //! @return A Font, Bitmap, or String resource
  4189. function loadResource(resource) {}
  4190.  
  4191. //! Pop a View from the View stack with popView().
  4192. //! @since 1.0.0
  4193. //! @param transition View transition of type SLIDE_*
  4194. function popView(transition) {}
  4195.  
  4196. //! Push a View onto the View stack with pushView().
  4197. //! @since 1.0.0
  4198. //! @param [View] view View to push
  4199. //! @param delegate The input delegate to handle input for the View
  4200. //! @param transition View transition of type SLIDE_*
  4201. function pushView(view, delegate, transition) {}
  4202.  
  4203. //! Use requestUpdate() to request that onUpdate() method be called for the current
  4204. //! View.
  4205. //! @since 1.0.0
  4206. function requestUpdate() {}
  4207.  
  4208. //! Use switchToView() to pop the current View and push the new one. Native views
  4209. //! (e.g. progress bars, confirmation dialogues, number pickers, etc.) may not be
  4210. //! passed as an input parameter. switchToView() only supports switching to
  4211. //! non-native views.
  4212. //! @since 1.0.0
  4213. //! @param [View] view View object to push
  4214. //! @param delegate the input delegate to handle input for the View
  4215. //! @param transition View transition of type SLIDE_*
  4216. function switchToView(view, delegate, transition) {}
  4217.  
  4218. }
  4219.  
  4220. }
Advertisement
Add Comment
Please, Sign In to add comment