Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is generated Connect IQ API stub, do not edit this!
- module Toybox {
- //! The Activity module contains the interface to use to retrieve Activity data.
- //! @since 1.0.0
- module Activity {
- //! The SWIM_STROKE enum is used to evaluate the results of the activity swim stroke
- //! info.
- //!
- //! Freestyle stroke
- //! @since 1.2.2
- const SWIM_STROKE_FREESTYLE = 0;
- //! Backstroke
- //! @since 1.2.2
- const SWIM_STROKE_BACKSTROKE = 1;
- //! Breaststroke
- //! @since 1.2.2
- const SWIM_STROKE_BREASTSTROKE = 2;
- //! Butterfly stroke
- //! @since 1.2.2
- const SWIM_STORKE_BUTTERFLY = 3;
- //! Drill mode
- //! @since 1.2.2
- const SWIM_STROKE_DRILL = 4;
- //! Mixed stroke mode
- //! @since 1.2.2
- const SWIM_STROKE_MIXED = 5;
- //! Mixed interval with equal number of butterfly, backstroke, breaststroke, and
- //! freestyle in that order.
- //! @since 1.2.2
- const SWIM_STROKE_IM = 6;
- //! A class containing information about the current activity. The fields in this
- //! class may return null so you should null check a value before using it.
- //! @since 1.0.0
- class Info {
- //! The altitude in meters
- //! @since 1.0.0
- //! @return [Float]
- var altitude;
- //! The average cadence in revolutions per minute
- //! @since 1.0.0
- //! @return [Number]
- var averageCadence;
- //! The swim stroke average distance in meters from the previous interval
- //! @since 1.2.2
- //! @return [Float]
- var averageDistance;
- //! The average heart rate in beats per minute
- //! @since 1.0.0
- //! @return [Number]
- var averageHeartRate;
- //! The average power in watts
- //! @since 1.0.0
- //! @device Forerunner 920XT
- //! @device fenix 3
- //! @device epix
- //! @device All Edges
- //! @return [Number]
- var averagePower;
- //! The average speed in meters per second. The average is computed as the elapsed
- //! 3-D accumulated distance divided by the elapsed time.
- //! @since 1.0.0
- //! @return [Float]
- var averageSpeed;
- //! The current calories burned during the current activity being recorded in kcal
- //! @since 1.0.0
- //! @return [Number]
- var calories;
- //! The current cadence in revolutions per minute
- //! @since 1.0.0
- //! @return [Number]
- var currentCadence;
- //! The current true north referenced heading in radians. This value matches heading
- //! from the Positioning module. It will provide the direction of travel when
- //! moving. When stopped, it will provide compass orientation, if supported by the
- //! device.
- //! @since 1.0.0
- //! @return [Float]
- var currentHeading;
- //! The current heart rate in beats per minute
- //! @since 1.0.0
- //! @return [Number]
- var currentHeartRate;
- //! The current location
- //! @since 1.0.0
- //! @return [Location]
- var currentLocation;
- //! GPS Accuracy (See the accuracy member of the Info object in the Position module
- //! for more information)
- //! @since 1.0.0
- //! @return [Number]
- var currentLocationAccuracy;
- //! The current power in watts
- //! @since 1.0.0
- //! @device Forerunner 920XT
- //! @device fenix 3
- //! @device epix
- //! @device All Edges
- //! @return [Number]
- var currentPower;
- //! The current speed in meters per second. (See the speed member of the Info object
- //! in the Position module for more information)
- //! @since 1.0.0
- //! @return [Float]
- var currentSpeed;
- //! Distance in meters
- //! @since 1.0.0
- //! @return [Float]
- var elapsedDistance;
- //! Elapsed time of the activity in milliseconds
- //! @since 1.0.0
- //! @return [Number]
- var elapsedTime;
- //! Momentary energy expenditure in kcals/min
- //! (www.firstbeat.com/consumers/analyzed-by-firstbeat-features#4)
- //! @since 1.2.0
- //! @return [Float]
- var energyExpenditure;
- //! The maximum cadence in revolutions per minute
- //! @since 1.0.0
- //! @return [Number]
- var maxCadence;
- //! The maximum heart rate in beats per minute
- //! @since 1.0.0
- //! @return [Number]
- var maxHeartRate;
- //! The maximum power in watts
- //! @since 1.0.0
- //! @device Forerunner 920XT
- //! @device fenix 3
- //! @device epix
- //! @device All Edges
- //! @return [Number]
- var maxPower;
- //! The maximum speed recorded during the timed activity, in meters per second
- //! @since 1.0.0
- //! @return [Float]
- var maxSpeed;
- //! The starting location of the activity
- //! @since 1.0.0
- //! @return [Location]
- var startLocation;
- //! The starting time of the activity
- //! @since 1.0.0
- //! @return [Moment]
- var startTime;
- //! The swim stroke type from the previous length
- //! @since 1.2.2
- //! @return [Number]
- var swimStrokeType;
- //! The swimming SWOLF score from the previous length
- //! @since 1.2.2
- //! @return [Number]
- var swimSwolf;
- //! Timer time in milliseconds
- //! @since 1.0.0
- //! @return [Number]
- var timerTime;
- //! The total ascent in meters
- //! @since 1.0.0
- //! @return [Float]
- var totalAscent;
- //! The total descent in meters
- //! @since 1.0.0
- //! @return [Float]
- var totalDescent;
- //! Training Effect: The activity's level of effect on aerobic fitness.
- //! (www.firstbeat.com/consumers/analyzed-by-firstbeat-features#3)
- //! @since 1.2.0
- //! @return [Float]
- var trainingEffect;
- }
- //! To retrieve the current Activity.Info, call getActivityInfo()
- //! @since 1.0.0
- //! @return [Activity.Info] The current Activity.Info or null if there is no activity running.
- function getActivityInfo() {}
- }
- //! The ActivityMonitor module contains the interface for Activity Monitoring data.
- //! @since 1.0.0
- module ActivityMonitor {
- //! @since 1.0.0
- const MOVE_BAR_LEVEL_MAX = 5;
- //! @since 1.0.0
- const MOVE_BAR_LEVEL_MIN = 0;
- //! Indicates that the given heart rate sample is invalid.
- //! @since 1.2.2
- //! @device fr235
- //! @device fenix 3 HR
- const INVALID_HR_SAMPLE = 255;
- //! A class containing heart rate data for a given period of time.
- //! @since 1.2.2
- //! @device fr235
- //! @device fenix 3 HR
- class HeartRateIterator {
- //! Get the maximium heart rate contained in this iterator.
- //! @since 1.2.2
- //! @return [Number] the maximum heart rate (bpm)
- function getMax() {}
- //! Get the minimium heart rate contained in this iterator.
- //! @since 1.2.2
- //! @return [Number] the minimum heart rate (bpm)
- function getMin() {}
- //! Get the next entry in the iterator. This must be called to get the initial data
- //! from the iterator.
- //! @since 1.2.2
- //! @return [HeartRateSample] returns the next HeartRateSample, or null if there are no more samples
- function next() {}
- }
- //! A class containing heart rate data at a given time.
- //! @since 1.2.2
- //! @device fr235
- //! @device fenix 3 HR
- class HeartRateSample {
- //! Heart rate in bpm. Make sure to check for INVALID_HR_SAMPLE.
- //! @since 1.2.2
- //! @return [Number]
- var heartRate;
- //! @since 1.2.2
- //! @return [Moment]
- var when;
- }
- //! A class containing information about the user's activity history. The fields in
- //! this class may return null so you should null check a value before using it.
- //! @since 1.0.0
- class History {
- //! Calories in kCal
- //! @since 1.0.0
- //! @return [Number]
- var calories;
- //! Distance in cm
- //! @since 1.0.0
- //! @return [Number]
- var distance;
- //! Start of Day, Moment object with the start time of the day
- //! @since 1.0.0
- //! @return [Moment]
- var startOfDay;
- //! Step goal for the day
- //! @since 1.0.0
- //! @return [Number]
- var stepGoal;
- //! Steps in number of steps
- //! @since 1.0.0
- //! @return [Number]
- var steps;
- }
- //! A class containing information about the user's current activity status. The
- //! fields in this class may return null so you should null check a value before
- //! using it.
- //! @since 1.0.0
- class Info {
- //! Calories burned so far for the day in kCal
- //! @since 1.0.0
- //! @return [Number]
- var calories;
- //! Distance in cm
- //! @since 1.0.0
- //! @return [Number]
- var distance;
- //! Is the user in sleep mode?
- //! @since 1.0.0
- //! @return [Boolean]
- var isSleepMode;
- //! Current level of the move bar. Between MOVE_BAR_LEVEL_MIN and
- //! MOVE_BAR_LEVEL_MAX.
- //! @since 1.0.0
- //! @return [Number]
- var moveBarLevel;
- //! Step goal for the day
- //! @since 1.0.0
- //! @return [Number]
- var stepGoal;
- //! Steps in number of steps
- //! @since 1.0.0
- //! @return [Number]
- var steps;
- }
- //! Retrieve the heart rate history for the given period, up to the last power
- //! cycle. This function always returns the most recent heart rate samples. The time
- //! between each HeartRateSample in the iterator may be device dependent.
- //! @since 1.2.1
- //! @device fr235
- //! @device fenix 3 HR
- //! @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.
- //! @param newestFirst true to get the samples newest first, false to get them oldest first
- //! @return [ActivityMonitor.HeartRateIterator] an iterator for the heart rate history for the given period
- function getHeartRateHistory(period, newestFirst) {}
- //! Use getHistory() to retrieve an array of ActivityMonitor.History objects
- //! @since 1.0.0
- //! @return [Array] of ActivityMonitor.History objects.
- function getHistory() {}
- //! Use getInfo() to retrieve the current ActivityMonitor.Info
- //! @since 1.0.0
- //! @return [ActivityMonitor.Info] object with current information.
- function getInfo() {}
- }
- //! The Activity Recording module will allow Apps to access the FIT file recording
- //! capabilities of the device. Apps can use this module to allow the user to start
- //! and stop recordings, create laps, and save recorded data.
- //! @since 1.0.0
- //! @permission Fit
- //! @apptype App
- module ActivityRecording {
- //! The SPORT enum allows definition of what kind of sport is being recorded. Use
- //! SPORT_GENERIC for sports not on the list.
- //! @since 1.0.0
- const SPORT_GENERIC = 0;
- //! @since 1.0.0
- const SPORT_RUNNING = 1;
- //! @since 1.0.0
- const SPORT_CYCLING = 2;
- //! Sport used for mulitsport transitions
- //! @since 1.0.0
- const SPORT_TRANSITION = 3;
- //! Sport used for ANT enabled excercise equipment
- //! @since 1.0.0
- const SPORT_FITNESS_EQUIPMENT = 4;
- //! @since 1.0.0
- const SPORT_SWIMMING = 5;
- //! @since 1.0.0
- const SPORT_BASKETBALL = 6;
- //! @since 1.0.0
- const SPORT_SOCCER = 7;
- //! @since 1.0.0
- const SPORT_TENNIS = 8;
- //! @since 1.0.0
- const SPORT_AMERICAN_FOOTBALL = 9;
- //! Sport used for activities such as strength training, cardio, etc
- //! @since 1.0.0
- const SPORT_TRAINING = 10;
- //! @since 1.0.0
- const SPORT_WALKING = 11;
- //! @since 1.0.0
- const SPORT_CROSS_COUNTRY_SKIING = 12;
- //! @since 1.0.0
- const SPORT_ALPINE_SKIING = 13;
- //! @since 1.0.0
- const SPORT_SNOWBOARDING = 14;
- //! @since 1.0.0
- const SPORT_ROWING = 15;
- //! @since 1.0.0
- const SPORT_MOUNTAINEERING = 16;
- //! @since 1.0.0
- const SPORT_HIKING = 17;
- //! @since 1.0.0
- const SPORT_MULTISPORT = 18;
- //! @since 1.0.0
- const SPORT_PADDLING = 19;
- //! Sub-sports allow for clarification of sport when recording. Use
- //! SUB_SPORT_GENERIC if no other sub-sport is applicable.
- //! @since 1.0.0
- const SUB_SPORT_GENERIC = 0;
- //! Sub-sport for Running and Fitness Equipment
- //! @since 1.0.0
- const SUB_SPORT_TREADMILL = 1;
- //! Sub-sport for Running
- //! @since 1.0.0
- const SUB_SPORT_STREET = 2;
- //! Sub-sport for Running
- //! @since 1.0.0
- const SUB_SPORT_TRAIL = 3;
- //! Sub-sport for Running
- //! @since 1.0.0
- const SUB_SPORT_TRACK = 4;
- //! Sub-sport for Cycling
- //! @since 1.0.0
- const SUB_SPORT_SPIN = 5;
- //! Sub-sport for Cycling and Fitness Equipment
- //! @since 1.0.0
- const SUB_SPORT_INDOOR_CYCLING = 6;
- //! Sub-sport for Cycling
- //! @since 1.0.0
- const SUB_SPORT_ROAD = 7;
- //! Sub-sport for Cycling
- //! @since 1.0.0
- const SUB_SPORT_MOUNTAIN = 8;
- //! Sub-sport for Cycling
- //! @since 1.0.0
- const SUB_SPORT_DOWNHILL = 9;
- //! Sub-sport for Cycling
- //! @since 1.0.0
- const SUB_SPORT_RECUMBENT = 10;
- //! Sub-sport for Cycling
- //! @since 1.0.0
- const SUB_SPORT_CYCLOCROSS = 11;
- //! Sub-sport for Cycling
- //! @since 1.0.0
- const SUB_SPORT_HAND_CYCLING = 12;
- //! Sub-sport for Cycling
- //! @since 1.0.0
- const SUB_SPORT_TRACK_CYCLING = 13;
- //! Sub-sport for Rowing and Fitness Equipment
- //! @since 1.0.0
- const SUB_SPORT_INDOOR_ROWING = 14;
- //! Sub-sport for Fitness Equipment
- //! @since 1.0.0
- const SUB_SPORT_ELLIPTICAL = 15;
- //! Sub-sport for Fitness Equipment
- //! @since 1.0.0
- const SUB_SPORT_STAIR_CLIMBING = 16;
- //! Sub-sport for Swimming
- //! @since 1.0.0
- const SUB_SPORT_LAP_SWIMMING = 17;
- //! Sub-sport for Swimming
- //! @since 1.0.0
- const SUB_SPORT_OPEN_WATER = 18;
- //! Sub-sport for Training
- //! @since 1.0.0
- const SUB_SPORT_FLEXIBILITY_TRAINING = 19;
- //! Sub-sport for Training
- //! @since 1.0.0
- const SUB_SPORT_STRENGTH_TRAINING = 20;
- //! Sub-sport for Activity Warm-up
- //! @since 1.0.0
- const SUB_SPORT_WARM_UP = 21;
- //! Sub-sport for Sports with Matches (e.g. Tennis)
- //! @since 1.0.0
- const SUB_SPORT_MATCH = 22;
- //! Sub-sport for Excercise
- //! @since 1.0.0
- const SUB_SPORT_EXERCISE = 23;
- //! Sub-sport for a Sport Challenge
- //! @since 1.0.0
- const SUB_SPORT_CHALLENGE = 24;
- //! Sub-sport for Fitness Equipment
- //! @since 1.0.0
- const SUB_SPORT_INDOOR_SKIING = 25;
- //! Sub-sport for Training
- //! @since 1.0.0
- const SUB_SPORT_CARDIO_TRAINING = 26;
- //! Session objects control the FIT recording state machine.
- //! @since 1.0.0
- class Session {
- //! Add a lap to the current recording by calling addLap().
- //! @since 1.0.0
- //! @return [Boolean] true if a lap was successfully created, or false if a lap could not be created
- function addLap() {}
- //! After recording is complete, the discard() method will complete the session by
- //! discarding the recorded data.
- //! @since 1.0.0
- //! @return [Boolean] true if the session was succesfully discarded, else false
- function discard() {}
- //! @deprecated The GeometryIterator class will be dropped in Connect IQ 3.x
- //! The GeometryIterator class will be dropped in Connect IQ 3.x
- //!
- //! Get a
- //! GeometryIterator for the session. Call get() to retrieve the Location. Use
- //! next() to iterate to the next point. It is important that the geometryIterator
- //! doesn't persist as this locks down the ActivityRecording. Use it to iterate the
- //! points and then let it go. If there are no points, null is returned.
- //! @since 1.0.0
- //! @return [GeometryIterator] A geometry iterator for the session or null
- function getGeometry() {}
- //! Use isRecording() to check if recording is active for this session.
- //! @since 1.0.0
- //! @return [Boolean] true if recording is active, false otherwise
- function isRecording() {}
- //! After recording is complete, the save() method will complete the session by
- //! storing the FIT file on the file system.
- //! @since 1.0.0
- //! @return [Boolean] true if the session was succesfully saved, or false if it was unable to save
- function save() {}
- //! To begin recording a FIT file on the system, start() should be called.
- //! @since 1.0.0
- //! @return [Boolean] true if recording was successfully started, or false if it could not be started
- function start() {}
- //! To stop recording a FIT file on the system, stop() should be called.
- //! @since 1.0.0
- //! @return [Boolean] true if recording was successfully stopped, or false if it could not be stopped
- function stop() {}
- }
- //! Use createSession() to create a session object with options determined by the
- //! caller. Only one session object is allowed to exist at a time. If there is an
- //! existing object that has not been closed using the save() or discard() methods,
- //! this method will return that object instead of creating a new one.
- //! @since 1.0.0
- //! @param [Dictionary] options A Dictionary containing session creation options
- //! @option [Object] :sport The primary sport being recorded (SPORT_GENERIC by default)
- //! @option [Object] :subSport The sport subcategory being recorded (SUB_SPORT_GENERIC by default)
- //! @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).
- //! @return [Session] A new session object, or the existing session object if a session is active and has not been saved or discarded
- function createSession(options) {}
- }
- //! @since 1.0.0
- //! @device All devices
- //! @permission Ant
- //! @apptype Data Field
- //! @apptype Widget
- //! @apptype App
- module Ant {
- //! Message ID's
- //! @since 1.0.0
- const MSG_ID_RF_EVENT = 0x01;
- //! @since 1.0.0
- const MSG_ID_UNASSIGN_CHANNEL = 0x41;
- //! @since 1.0.0
- const MSG_ID_ASSIGN_CHANNEL = 0x42;
- //! @since 1.0.0
- const MSG_ID_CHANNEL_ID = 0x51;
- //! @since 1.0.0
- const MSG_ID_CHANNEL_PERIOD = 0x43;
- //! @since 1.0.0
- const MSG_ID_SEARCH_TIMEOUT = 0x44;
- //! @since 1.0.0
- const MSG_ID_CHANNEL_RF_FREQUENCY = 0x45;
- //! @since 1.0.0
- const MSG_ID_NETWORK_KEY = 0x46;
- //! @since 1.0.0
- const MSG_ID_TRANSMIT_POWER = 0x47;
- //! @since 1.0.0
- const MSG_ID_CHANNEL_TRANSMIT_POWER = 0x60;
- //! @since 1.0.0
- const MSG_ID_LOW_PRIORITY_SEARCH_TIMEOUT = 0x63;
- //! @since 1.0.0
- const MSG_ID_LIB_CONFIG = 0x6E;
- //! @since 1.0.0
- const MSG_ID_PROXIMITY_SEARCH = 0x71;
- //! @since 1.0.0
- const MSG_ID_RESET_SYSTEM = 0x4A;
- //! @since 1.0.0
- const MSG_ID_OPEN_CHANNEL = 0x4B;
- //! @since 1.0.0
- const MSG_ID_CLOSE_CHANNEL = 0x4C;
- //! @since 1.0.0
- const MSG_ID_BROADCAST_DATA = 0x4E;
- //! @since 1.0.0
- const MSG_ID_ACKNOWLEDGED_DATA = 0x4F;
- //! @since 1.0.0
- const MSG_ID_CHANNEL_RESPONSE_EVENT = 0x40;
- //! Message Code's for the response event
- //! @since 1.0.0
- const MSG_CODE_RESPONSE_NO_ERROR = 0x00;
- //! @since 1.0.0
- const MSG_CODE_EVENT_RX_SEARCH_TIMEOUT = 0x01;
- //! @since 1.0.0
- const MSG_CODE_EVENT_RX_FAIL = 0x02;
- //! @since 1.0.0
- const MSG_CODE_EVENT_TX = 0x03;
- //! @since 1.0.0
- const MSG_CODE_EVENT_TRANSFER_RX_FAILED = 0x04;
- //! @since 1.0.0
- const MSG_CODE_EVENT_TRANSFER_TX_COMPLETED = 0x05;
- //! @since 1.0.0
- const MSG_CODE_EVENT_TRANSFER_TX_FAILED = 0x06;
- //! @since 1.0.0
- const MSG_CODE_EVENT_CHANNEL_CLOSED = 0x07;
- //! @since 1.0.0
- const MSG_CODE_EVENT_RX_FAIL_GO_TO_SEARCH = 0x08;
- //! @since 1.0.0
- const MSG_CODE_CHANNEL_IN_WRONG_STATE = 0x15;
- //! @since 1.0.0
- const MSG_CODE_CHANNEL_ID_NOT_SET = 0x18;
- //! @since 1.0.0
- const MSG_CODE_TRANSFER_IN_PROGRESS = 0x1F;
- //! @since 1.0.0
- const MSG_CODE_INVALID_MESSAGE = 0x28;
- //! @since 1.0.0
- const MSG_CODE_EVENT_QUE_OVERFLOW = 0x35;
- //! Ant Network Type
- //! @since 1.0.0
- const NETWORK_PUBLIC = 0;
- //! @since 1.0.0
- const NETWORK_PLUS = 1;
- //! @since 1.2.0
- const NETWORK_PRIVATE = 2;
- //! Channel Type
- //!
- //! Bidirectional Transmit (Master)
- //! @since 1.0.0
- const CHANNEL_TYPE_TX_NOT_RX = 0x10;
- //! Bidirectional Receive (Slave)
- //! @since 1.0.0
- const CHANNEL_TYPE_RX_NOT_TX = 0x00;
- //! Receive Only (Slave)
- //! @since 1.2.0
- const CHANNEL_TYPE_RX_ONLY = 0x40;
- //! @since 1.0.0
- class ChannelAssignment {
- //! Whether the channel is to be primarily sending data (master) or receiving
- //! data(slave)
- //! @since 1.0.0
- var channelType;
- //! The network the channel should operate under.
- //! @since 1.0.0
- var network;
- //! Constructor for the channel object. By default disables background scanning.
- //! @since 1.0.0
- //! @param [enum] c Channel type specifier
- //! @param n Network
- //! @option [Hash] [CHANNEL_TYPE_TX_NOT_RX] a customizable set of options
- //! @option [Hash] [CHANNEL_TYPE_RX_NOT_TX] a customizable set of options
- //! @option [Hash] [CHANNEL_TYPE_RX_ONLY] a customizable set of options
- //! @option [Hash] [NETWORK_PUBLIC] a customizable set of options
- //! @option [Hash] [NETWORK_PLUS] a customizable set of options
- //! @option [Hash] [NETWORK_PRIVATE] a customizable set of options
- function initialize(c, n) {}
- //! See if background scanning is enabled for the channel assignment.
- //! @since 1.2.0
- //! @return [Boolean] true - If background scan is enabled.
- function isBackgroundScanEnabled() {}
- //! Set background scan to be enabled or disabled. Enabling background scan can only
- //! be done on Receive Only channels.
- //! @since 1.2.0
- //! @param [Boolean] isBackgroundScanEnabled true to enable background scan, false otherwise.
- //! @return [Boolean] true - If the background scan property was successfully set.
- function setBackgroundScan(isBackgroundScanEnabled) {}
- }
- //! @since 1.0.0
- class DeviceConfig {
- //! Default values for a device configuration
- //! @since 1.0.0
- const DEFAULT_DEVICE_NUMBER = 123;
- //! @since 1.0.0
- const DEFAULT_DEVICE_TYPE = 1;
- //! @since 1.0.0
- const DEFAULT_TRANSMISSION_TYPE = 0;
- //! @since 1.0.0
- const DEFAULT_MESSAGE_PERIOD = 8192;
- //! @since 1.0.0
- const DEFAULT_RADIO_FREQUENCY = 10;
- //! @since 1.0.0
- const DEFAULT_SEARCH_TIMEOUT_LOW = 6;
- //! @since 1.0.0
- const DEFAULT_SEARCH_TIMEOUT_HIGH = 0;
- //! @since 1.0.0
- const DEFAULT_THRESHOLD = 0;
- //! @since 1.2.0
- const DEFAULT_NETWORK_KEY = 0;
- //! Network key lengths
- //! @since 1.2.0
- const NETWORK_KEY_LENGTH_64BIT = 8;
- //! @since 1.2.0
- const NETWORK_KEY_LENGTH_128BIT = 16;
- //! Unique device number (ANT-id)
- //! @since 1.0.0
- var deviceNumber;
- //! 1-Byte device type identifier (See ANT Protocol for pre-defined Device Types)
- //! @since 1.0.0
- var deviceType;
- //! Message period that the sensor uses
- //! @since 1.0.0
- var messagePeriod;
- //! 128 bit network key
- //! @since 1.2.0
- var networkKey128Bit;
- //! 64 bit network key
- //! @since 1.2.0
- var networkKey64Bit;
- //! Radio frequency that the sensor operates on
- //! @since 1.0.0
- var radioFrequency;
- //! Proximity threshold bin
- //! @since 1.0.0
- var searchThreshold;
- //! High Priority search timeout (2.5s increments) that a receiving channel will
- //! wait for in order to start tracking a master. Limited to a maximum of 5 seconds
- //! (Range of 0 to 2).
- //! @since 1.0.0
- var searchTimeoutHighPriority;
- //! Low Priority search timeout (2.5s increments) that a receiving channel will wait
- //! for in order to start tracking a master. Limited to a maximum of 30 seconds
- //! (Range of 0 to 12).
- //! @since 1.0.0
- var searchTimeoutLowPriority;
- //! Manufacturer-specific transport type and extended device number
- //! @since 1.0.0
- var transmissionType;
- //! Constructor for the device config object
- //! @since 1.2.0
- //! @param [Dictionary] options initialization options
- //! @option [Hash] [:deviceNumber] a customizable set of options
- //! @option [Hash] [:deviceType] a customizable set of options
- //! @option [Hash] [:transmissionType] a customizable set of options
- //! @option [Hash] [:messagePeriod] a customizable set of options
- //! @option [Hash] [:radioFrequency] a customizable set of options
- //! @option [Hash] [:searchTimeoutLowPriority] a customizable set of options
- //! @option [Hash] [:searchTimeoutHighPriority] a customizable set of options
- //! @option [Hash] [:searchThreshold] a customizable set of options
- //! @option [Hash] [:networkKey64Bit] a customizable set of options
- //! @option [Hash] [:networkKey128Bit] a customizable set of options
- function initialize(options) {}
- }
- //! @since 1.0.0
- class GenericChannel {
- //! Constructor for the generic channel throws UnableToAcquireChannelException if
- //! the the system does not have a channel available.
- //! @since 1.0.0
- //! @param [Method] listener Method object to call with sensor updates.
- //! @param [ChannelAssignment] ca ChannelAssignment object for the channel
- function initialize(listener, ca) {}
- //! Close a generic ANT Channel
- //! @since 1.0.0
- function close() {}
- //! Get the current ANT channel configuration
- //! @since 1.0.0
- //! @return [DeviceConfig] DeviceConfig object with current channel device configuration.
- function getDeviceConfig() {}
- //! Open a generic ANT Channel
- //! @since 1.0.0
- //! @return [Boolean] true - If successfully opened the channel
- function open() {}
- //! Release the generic ANT Channel back to the system. If it is open it will be
- //! automatically closed.
- //! @since 1.0.0
- function release() {}
- //! Sends an acknowledge message
- //! @since 1.0.0
- //! @param [Integer] data 8 byte data packet
- function sendAcknowledge(data) {}
- //! Sends a broadcast message
- //! @since 1.0.0
- //! @param [Integer] data 8 byte data packet
- function sendBroadcast(data) {}
- //! Set the current ANT channel configuration
- //! @since 1.0.0
- //! @param [DeviceConfig] config DeviceConfig object to set
- function setDeviceConfig(config) {}
- }
- //! @since 1.0.0
- class Message {
- //! @since 1.0.0
- const DATA_PAYLOAD_LENGTH = 8;
- //! Unique device number (ANT-id)
- //! @since 1.2.0
- var deviceNumber;
- //! 1-Byte device type identifier (See ANT Protocol for pre-defined Device Types)
- //! @since 1.2.0
- var deviceType;
- //! Number of data bytes in the data payload ( not including any extended data if
- //! applicable )
- //! @since 1.0.0
- var length;
- //! Data Type Identifier
- //! @since 1.0.0
- var messageId;
- //! Received Signal Strength Indication
- //! @since 1.0.0
- var rssi;
- //! Timestamp of received message generated off of a 32.768 kHz clock. Rolls over
- //! every 2 seconds.
- //! @since 1.2.0
- var timestamp;
- //! Manufacturer-specific transport type and extended device number
- //! @since 1.2.0
- var transmissionType;
- //! Get the ANT data packet
- //! @since 1.0.0
- //! @return [Array] Array of integers representing the bytes of the data payload
- function getPayload() {}
- //! Set the ANT data packet.
- //! @since 1.0.0
- //! @param [Array] data Array of integers representing the bytes of the data payload
- function setPayload(data) {}
- }
- //! UnableToAcquireChannelException is thrown if the Generic Channel initializer is
- //! unable to acquire an ANT channel from the system. This indicates that all
- //! available ANT channels are in use.
- //! @since 1.2.0
- module toplevel {
- //! Constructor
- //! @since 1.2.0
- function initialize() {}
- }
- }
- //! The Application module contains the base class for every Connect IQ app.
- //! @since 1.0.0
- module Application {
- //! AppBase is the base class for an app. All apps shall inherit from this class. It
- //! is used to manage the lifecycle of an app. For widgets and watch-apps, the
- //! functions are called in the following order: onStart(), getInitialView() and
- //! onStop(). For watchfaces and datafields, only getInitialView() is called. Every
- //! AppBase object has access to an object store to persist data.
- //! @since 1.0.0
- class AppBase {
- //! Clears the object store for the application.
- //! @since 1.0.0
- function clearProperties() {}
- //! Deletes the given key from the object store.
- //! @since 1.0.0
- //! @param key The key to delete
- function deleteProperty(key) {}
- //! To retrieve the initial WatchUi.View and WatchUi.InputDelegate of the
- //! application, call getInitialView(). Providing a WatchUi.InputDelegate is
- //! optional for widgets and watch-apps. For watchfaces and datafields, an array
- //! containing just a WatchUi.View should be returned as input is not available for
- //! these app types.
- //! @since 1.0.0
- //! @return [Array] An array containing [ WatchUi.View, WatchUi.InputDelegate (optional) ]
- function getInitialView() {}
- //! To get the data associated with the given key from the object store, use
- //! getProperty().
- //! @since 1.0.0
- //! @param key Key of the value to retrieve from the object store (cannot be a Symbol)
- //! @return [Object] Content associated with the key, or null if the key is not in the object store
- function getProperty(key) {}
- //! @deprecated loadProperties() will be removed in Connect IQ 3.0.0
- //! loadProperties() will be removed in Connect IQ 3.0.0
- //!
- //! Load the properties for
- //! this app
- //! @since 1.0.0
- function loadProperties() {}
- //! When an application is started as a result of a system Event, the the onEvent
- //! method is called after onStart.
- //! @since 1.2.0
- //! @param [Dictionary] properties The properties provided when the Event was scheduled
- function onEvent(properties) {}
- //! Called when the application settings have been changed by Garmin Connect Mobile
- //! while while the app is running.
- //! @since 1.2.0
- function onSettingsChanged() {}
- //! Before the initial WatchUi.View is retrieved, onStart() is called. This is where
- //! app level settings can be initialized or retrieved from the object store before
- //! the initial View is created.
- //! @since 1.0.0
- //! @param [Dictionary] state Unused
- function onStart(state) {}
- //! When the system is going to terminate an application, onStop() is called. If the
- //! application needs to save state to the object store it should be done in this
- //! function.
- //! @since 1.0.0
- //! @param [Dictionary] state Unused
- function onStop(state) {}
- //! @deprecated saveProperties() will be removed in Connect IQ 3.0.0
- //! saveProperties() will be removed in Connect IQ 3.0.0
- //!
- //! Save the properties for
- //! this app
- //! @since 1.0.0
- function saveProperties() {}
- //! Using a key, store the given data in the object by calling setProperty(). Keys
- //! can be of type String, Number, Float, and Boolean. Values can be of type String,
- //! Number, Float, Boolean, null, and Arrays or Dictionaries containing those types.
- //! There is a limit on the size of the Properties of 8KB. If you reach this limit,
- //! the properties will not be saved or reloaded.
- //! @since 1.0.0
- //! @param key The key used to store and retrieve the value from the object store (cannot be a Symbol)
- //! @param value The value to put into the object store
- function setProperty(key, value) {}
- //! Validate a property being stored
- //! @since 1.0.0
- function validateProperty() {}
- }
- //! Call getApp() to retrieve the AppBase object that is currently running.
- //! @since 1.0.0
- //! @return [AppBase] The currently running AppBase object
- function getApp() {}
- }
- //! The Tone module allows for making pre-defined sounds. Not all devices support
- //! this API.
- //! @since 1.0.0
- //! @apptype Widget
- //! @apptype App
- module Attention {
- //! Indicates that a key was pressed
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_KEY = 0;
- //! Indicates that an activity has started
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_START = 1;
- //! Indicates that an acitivty has stopped
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_STOP = 2;
- //! Indicates that a message is available
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_MSG = 3;
- //! An alert ending with a high note
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_ALERT_HI = 4;
- //! An alert ending with a low note
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_ALERT_LO = 5;
- //! A loud beep
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_LOUD_BEEP = 6;
- //! Indicates a change in interval
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_INTERVAL_ALERT = 7;
- //! Indicates an alarm has triggered
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_ALARM = 8;
- //! Indicates that the activity was reset
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_RESET = 9;
- //! Indicates that the user has completed a lap
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_LAP = 10;
- //! An annoying sound to get the users attention
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_CANARY = 11;
- //! An alert that a time threshold has been met
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_TIME_ALERT = 12;
- //! An alert that a distance threshold has been met
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_DISTANCE_ALERT = 13;
- //! Indicates that the activity was a failure
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_FAILURE = 14;
- //! Indicates that the activity was a success
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_SUCCESS = 15;
- //! The power on tone
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_POWER = 16;
- //! Indicates that the device has low battery power
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_LOW_BATTERY = 17;
- //! Indicates an error occurred
- //! @since 1.0.0
- //! @device All except vivoactive
- const TONE_ERROR = 18;
- //! @since 1.0.0
- //! @device All non-Edge devices
- class VibeProfile {
- //! Duty Cycle of the vibration, has a range of [0, 100]
- //! @since 1.0.0
- var dutyCycle;
- //! Length of the vibration, in milliseconds
- //! @since 1.0.0
- var length;
- //! Returns a new instance of VibeProfile
- //! @since 1.0.0
- function initialize() {}
- }
- //! Turn on or off the backlight.
- //! @since 1.0.0
- //! @device All devices
- //! @param [Boolean] onOff true to turn on backlight, false otherwise.
- function backlight(onOff) {}
- //! Play a tone.
- //! @since 1.0.0
- //! @device All except vivoactive
- //! @param tone TONE_XXX value to play
- function playTone(tone) {}
- //! Use the vibe motor
- //! @since 1.0.0
- //! @device All non-Edge devices
- //! @param [Array] vibe Array of VibeProfile objects to play in sequence. Maximum of 8 supported.
- function vibrate(vibe) {}
- }
- //! Widgets and apps will be able to communicate with a mobile phone via Bluetooth
- //! Low Energy (BLE). The mobile phone may be sharing data with the device, or it
- //! may act as a bridge between the app and the Internet. This allows the mobile
- //! phone to become part of the wearable web.
- //! @since 1.0.0
- //! @device All devices
- //! @permission Communications
- //! @apptype Widget
- //! @apptype App
- module Communications {
- //! Additional Resonse codes that can occur from JSON requests
- //! @since 1.0.0
- const UNKNOWN_ERROR = 0;
- //! @since 1.0.0
- const BLE_ERROR = -1;
- //! @since 1.0.0
- const BLE_HOST_TIMEOUT = -2;
- //! @since 1.0.0
- const BLE_SERVER_TIMEOUT = -3;
- //! @since 1.0.0
- const BLE_NO_DATA = -4;
- //! @since 1.0.0
- const BLE_REQUEST_CANCELLED = -5;
- //! @since 1.0.0
- const BLE_QUEUE_FULL = -101;
- //! @since 1.0.0
- const BLE_REQUEST_TOO_LARGE = -102;
- //! @since 1.0.0
- const BLE_UNKNOWN_SEND_ERROR = -103;
- //! @since 1.0.0
- const BLE_CONNECTION_UNAVAILABLE = -104;
- //! @since 1.0.0
- const INVALID_HTTP_HEADER_FIELDS_IN_REQUEST = -200;
- //! @since 1.0.0
- const INVALID_HTTP_BODY_IN_REQUEST = -201;
- //! @since 1.0.0
- const INVALID_HTTP_METHOD_IN_REQUEST = -202;
- //! @since 1.0.0
- const NETWORK_REQUEST_TIMED_OUT = -300;
- //! @since 1.0.0
- const INVALID_HTTP_BODY_IN_NETWORK_RESPONSE = -400;
- //! @since 1.0.0
- const INVALID_HTTP_HEADER_FIELDS_IN_NETWORK_RESPONSE = -401;
- //! @since 1.0.0
- const NETWORK_RESPONSE_TOO_LARGE = -402;
- //! @since 1.2.0
- const HTTP_REQUEST_METHOD_GET = 1;
- //! @since 1.2.0
- const HTTP_REQUEST_METHOD_PUT = 2;
- //! @since 1.2.0
- const HTTP_REQUEST_METHOD_POST = 3;
- //! @since 1.2.0
- const HTTP_REQUEST_METHOD_DELETE = 4;
- //! These values are used in conjunction with the “Content-Type” header
- //! key.
- //!
- //! Specifies a content type of application/x-www-form-urlencoded
- //! @since 1.2.0
- const REQUEST_CONTENT_TYPE_URL_ENCODED = 0;
- //! Specifies a content type of application/json
- //! @since 1.2.0
- const REQUEST_CONTENT_TYPE_JSON = 1;
- //! @since 1.2.0
- const IMAGE_DITHERING_NONE = 1;
- //! @since 1.2.0
- const IMAGE_DITHERING_FLOYD_STEINBERG = 2;
- //! @since 1.0.0
- class ConnectionListener {
- //! Callback when a communications operation completes.
- //! @since 1.0.0
- function onComplete() {}
- //! Callback when a communications operation error occurs.
- //! @since 1.0.0
- function onError() {}
- }
- //! The MailboxIterator is used to get the messages out of the Mailbox.
- //! @since 1.0.0
- class MailboxIterator {
- //! Call next() to get the next message from the mailbox.
- //! @since 1.0.0
- //! @return Message content, or null if no messages
- function next() {}
- }
- //! To cancel all pending JSON and Image requests use cancelAllRequests()
- //! @since 1.2.0
- function cancelAllRequests() {}
- //! To clear the contents of the mailbox, call emptyMailbox().
- //! @since 1.0.0
- function emptyMailbox() {}
- //! Convert a URL string into a percent-encoded string. The reserved characters in
- //! the string will be replaced with their corresponding hex-value pairs. This
- //! follows the URI-encoding scheme as detailed by RFC 3986 which can be found here:
- //! www.ietf.org/rfc/rfc3986.txt
- //! @since 1.1.2
- //! @param [String] url The URL string to be encoded
- //! @return [String] Percent-encoded string
- function encodeURL(url) {}
- //! Call getMailbox() to get the MailboxIterator for this App's mailbox.
- //! @since 1.0.0
- //! @return [MailboxIterator] Iterator for the mailbox
- function getMailbox() {}
- //! To request an image through Garmin Connect Mobile, call makeImageRequest(). GCM
- //! will scale and dither the image based on the capabilities of the device, but the
- //! user will be able to pass additional options (like dithering it down to a one
- //! color image)
- //! @since 1.2.0
- //! @param [String] url URL of image to request
- //! @param [Dictionary] parameters Dictionary of keys and values, appended to the URL. Can be null.
- //! @param [Dictionary] options Additional image options
- //! @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.
- //! @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.
- //! @option [Number] :maxWidth The maximum width an image should be scaled to
- //! @option [Number] :maxHeight The maximum height an image should be scaled to
- //! @option [Number] :dithering The type of dithering to use when processing the image. Defaults to Floyd-Steinberg.
- function makeImageRequest(url, parameters, options, responseCallback) {}
- //! To use Garmin Connect Mobile as a proxy to the web, use makeJsonRequest(). The
- //! request is asynchronous; the responseCallback will be called when the request
- //! returns.
- //! @since 1.0.0
- //! @param [String] url The URL being requested
- //! @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.
- //! @param [Dictionary] options Dictionary of options. Can be null.
- //! @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.
- //! @option [Number] :method The HTTP method of the request. Should be a HTTP_REQUEST_METHOD_* value.
- //! @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.
- function makeJsonRequest(url, parameters, options, responseCallback) {}
- //! Add a listener for mailbox events. The listener method is called whenever a new
- //! message is received
- //! @since 1.0.0
- //! @param [Method] listener Callback in the format function listener(iterator) where iterator is the mailbox iterator for the app
- function setMailboxListener(listener) {}
- //! Send data across the the BLE link.
- //! @since 1.0.0
- //! @param [Object] content The object to be sent
- //! @param [Dictionary] options Additional transmit options (TBD)
- //! @param [ConnectionListener] listener An extension of the ConnectionListener class
- function transmit(content, options, listener) {}
- }
- //! The Graphics module provides basic drawing functionality.
- //! @since 1.0.0
- module Graphics {
- //! Extra tiny font
- //! @since 1.0.0
- const FONT_XTINY = 0;
- //! Tiny font
- //! @since 1.0.0
- const FONT_TINY = 1;
- //! Small font
- //! @since 1.0.0
- const FONT_SMALL = 2;
- //! Medium font
- //! @since 1.0.0
- const FONT_MEDIUM = 3;
- //! Large font
- //! @since 1.0.0
- const FONT_LARGE = 4;
- //! Normal size number only font
- //! @since 1.0.0
- const FONT_NUMBER_MILD = 5;
- //! Medium size number only font
- //! @since 1.0.0
- const FONT_NUMBER_MEDIUM = 6;
- //! Large size number only font
- //! @since 1.0.0
- const FONT_NUMBER_HOT = 7;
- //! Huge size number only font
- //! @since 1.0.0
- const FONT_NUMBER_THAI_HOT = 8;
- //! White
- //! @since 1.0.0
- const COLOR_WHITE = 0xFFFFFF;
- //! Light Gray
- //! @since 1.0.0
- const COLOR_LT_GRAY = 0xAAAAAA;
- //! Dark Gray
- //! @since 1.0.0
- const COLOR_DK_GRAY = 0x555555;
- //! Black
- //! @since 1.0.0
- const COLOR_BLACK = 0x000000;
- //! Red
- //! @since 1.0.0
- const COLOR_RED = 0xFF0000;
- //! Dark Red
- //! @since 1.0.0
- const COLOR_DK_RED = 0xAA0000;
- //! Orange
- //! @since 1.0.0
- const COLOR_ORANGE = 0xFF5500;
- //! Yellow
- //! @since 1.0.0
- const COLOR_YELLOW = 0xFFAA00;
- //! Green
- //! @since 1.0.0
- const COLOR_GREEN = 0x00FF00;
- //! Dark Green
- //! @since 1.0.0
- const COLOR_DK_GREEN = 0x00AA00;
- //! Blue
- //! @since 1.0.0
- const COLOR_BLUE = 0x00AAFF;
- //! Dark Blue
- //! @since 1.0.0
- const COLOR_DK_BLUE = 0x0000FF;
- //! Purple. Not valid on Fenix 3 or D2 Bravo. Use 0x5500AA instead.
- //! @since 1.0.0
- const COLOR_PURPLE = 0xAA00FF;
- //! Pink
- //! @since 1.0.0
- const COLOR_PINK = 0xFF00FF;
- //! Transparent
- //! @since 1.0.0
- const COLOR_TRANSPARENT = -1;
- //! Right justify the text at the x/y coordinates
- //! @since 1.0.0
- const TEXT_JUSTIFY_RIGHT = 0;
- //! Center justify the text at the x/y coordinates
- //! @since 1.0.0
- const TEXT_JUSTIFY_CENTER = 1;
- //! Left justify the text at the x/y coordinates
- //! @since 1.0.0
- const TEXT_JUSTIFY_LEFT = 2;
- //! Center the text vertically
- //! @since 1.0.0
- const TEXT_JUSTIFY_VCENTER = 4;
- //! Counter clockwise draw
- //! @since 1.2.0
- const ARC_COUNTER_CLOCKWISE = 0;
- //! Clockwise draw
- //! @since 1.2.0
- const ARC_CLOCKWISE = 1;
- //! This class represents a device context. It provides methods to perform drawing
- //! operations on the device.
- //! @since 1.0.0
- class Dc {
- //! Erase the screen using the background color by calling clear().
- //! @since 1.0.0
- function clear() {}
- //! Use drawArc() to draw an arc. 0 degree: 3 o'clock position. 90 degrees: 12
- //! o'clock position. 180 degrees: 9 o'clock position. 270 degrees: 6 o'clock
- //! position.
- //! @since 1.2.0
- //! @param [Number] x X location of arc center
- //! @param [Number] y Y location of arc center
- //! @param [Number] r radius of arc.
- //! @param [Number] attr Arc drawing attributes. (ARC_COUNTER_CLOCKWISE or ARC_CLOCKWISE)
- //! @param [Number] degreeStart The start angle of the arc by degrees.
- //! @param [Number] degreeEnd The end angle of the arc by degrees.
- function drawArc(x, y, r, attr, degreeStart, degreeEnd) {}
- //! Draw a bitmap to the screen with drawBitmap().
- //! @since 1.0.0
- //! @param [Number] x Top left X coordinate to begin the draw
- //! @param [Number] y Top left Y coordinate to begin the draw
- //! @param [Symbol] rez The bitmap resource to draw
- function drawBitmap(x, y, rez) {}
- //! Use drawCircle() to draw a circle around a point.
- //! @since 1.0.0
- //! @param [Number] x X location of circle center
- //! @param [Number] y Y location of circle center
- //! @param [Number] radius Radius of circle
- function drawCircle(x, y, radius) {}
- //! Use drawEllispe() to draw an ellipse around a point.
- //! @since 1.0.0
- //! @param [Number] x X location of ellipse center
- //! @param [Number] y Y location of ellipse center
- //! @param [Number] a The radius of the ellipse along the x axis
- //! @param [Number] b The radius of the ellipse along the y axis
- function drawEllipse(x, y, a, b) {}
- //! Draw a line between two points using drawLine().
- //! @since 1.0.0
- //! @param [Number] x1 First x coord
- //! @param [Number] y1 First y coord
- //! @param [Number] x2 Second x coord
- //! @param [Number] y2 Second y coord
- function drawLine(x1, y1, x2, y2) {}
- //! Draw a point on the screen with drawPoint().
- //! @since 1.0.0
- //! @param [Number] x X location of point
- //! @param [Number] y Y location of point
- function drawPoint(x, y) {}
- //! Draw a rectangle with drawRectangle().
- //! @since 1.0.0
- //! @param [Number] x X location of upper corner
- //! @param [Number] y Y location of upper corner
- //! @param [Number] width Width value of rectangle
- //! @param [Number] height Height value of rectangle
- function drawRectangle(x, y, width, height) {}
- //! Draw a rounded rectangle with drawRoundedRectangle().
- //! @since 1.0.0
- //! @param [Number] x X location of upper corner
- //! @param [Number] y Y location of upper corner
- //! @param [Number] width Width value of rectangle
- //! @param [Number] height Height value of rectangle
- //! @param [Number] radius Radius of rounding.
- function drawRoundedRectangle(x, y, width, height, radius) {}
- //! Draw text at the given location using drawText().
- //! @since 1.0.0
- //! @param [Number] x X location of text
- //! @param [Number] y Y location of text
- //! @param [Number] font Font to use. This can be a custom font loaded from resources or a Graphics.FONT_XXX value.
- //! @param [Number] text String to render
- //! @param justification One of the Graphics.TEXT_JUSTIFY_XXX constants
- function drawText(x, y, font, text, justification) {}
- //! Fill a circle with the foreground color using fillCircle().
- //! @since 1.0.0
- //! @param [Number] x X location of circle center
- //! @param [Number] y Y location of circle center
- //! @param [Number] radius Radius of circle
- function fillCircle(x, y, radius) {}
- //! Fill an ellipse with the foreground color using fillEllipse().
- //! @since 1.0.0
- //! @param [Number] x X location of ellipse center
- //! @param [Number] y Y location of ellipse center
- //! @param [Number] a The radius of the ellipse along the x axis
- //! @param [Number] b The radius of the ellipse along the y axis
- function fillEllipse(x, y, a, b) {}
- //! To fill a polygon, use fillPolygon().
- //! @since 1.0.0
- //! @param [Array] pts Array of coordinates with a 64 point limit
- function fillPolygon(pts) {}
- //! Fill a rectangle with the foreground color using fillRectangle().
- //! @since 1.0.0
- //! @param [Number] x X location of upper corner
- //! @param [Number] y Y location of upper corner
- //! @param [Number] width Width value of rectangle
- //! @param [Number] height Height value of rectangle
- function fillRectangle(x, y, width, height) {}
- //! Fill a rounded rectangle with the foreground color using fillRoundedRectangle().
- //! @since 1.0.0
- //! @param [Number] x X location of upper corner
- //! @param [Number] y Y location of upper corner
- //! @param [Number] width Width value of rectangle
- //! @param [Number] height Height value of rectangle
- //! @param [Number] radius Radius of rounding
- function fillRoundedRectangle(x, y, width, height, radius) {}
- //! Get The Font Height by using getFontHeight().
- //! @since 1.0.0
- //! @param [Number] font Font to use
- //! @return [Number] The height of the font
- function getFontHeight(font) {}
- //! Use getHeight() to get the height of the display.
- //! @since 1.0.0
- //! @return [Number] Height of display
- function getHeight() {}
- //! Get the width and height of a string. This takes new lines into account when
- //! determining the height. The width is the maximum width for a given line of the
- //! string. If a string has two n in it, the height would be for three lines and the
- //! width would be the width of the longest string.
- //! @since 1.0.0
- //! @param [String] text Text to get width for
- //! @param font FONT constant or font resource of text
- //! @return [Array] width, height of string in pixels
- function getTextDimensions(text, font) {}
- //! Get the width of a string with getTextWidthInPixels().
- //! @since 1.0.0
- //! @param [String] text Text to get width for
- //! @param font FONT constant or font resource of text
- //! @return [Number] Width of string in pixels
- function getTextWidthInPixels(text, font) {}
- //! Use getWidth() to get the width of the display.
- //! @since 1.0.0
- //! @return [Number] Width of display
- function getWidth() {}
- //! Use setColor() to set the current foreground and background colors.
- //! @since 1.0.0
- //! @param foreground COLOR constant or 24-bit integer of the form 0xRRGGBB
- //! @param background COLOR constant or 24-bit integer of the form 0xRRGGBB
- function setColor(foreground, background) {}
- //! Use setPenWidth() to set the width of a line
- //! @since 1.0.0
- //! @param [Number] width in pixels
- function setPenWidth(width) {}
- }
- //! Gets the recommended distance above the baseline for single spaced text. The
- //! base line is the line on which the text sits.
- //! @since 1.2.0
- //! @param [Number] font Font to use
- //! @return [Number] The ascent of the font
- function getFontAscent(font) {}
- //! Gets the recommended distance below the baseline for single spaced text. The
- //! base line is the line on which the text sits.
- //! @since 1.2.0
- //! @param [Number] font Font to use
- //! @return [Number] The descent of the font
- function getFontDescent(font) {}
- //! Gets the height (ascent plus descent) of the given font.
- //! @since 1.2.0
- //! @param [Number] font Font to use
- //! @return [Number] The height of the font
- function getFontHeight(font) {}
- }
- //! The Lang module contains Monkey C language basic types.
- //!
- //! Number - 32 bit signed
- //! integers
- //!
- //! Float - 32 bit floating point numbers
- //!
- //! Long - 64 bit integers
- //!
- //! Double
- //! - 64 bit floating point numbers
- //!
- //! Booleans - true and false
- //!
- //! Symbols -
- //! Lightweight constants
- //!
- //! Strings - Strings of characters
- //!
- //! Objects - Instantiated
- //! objects are defined with the class keyword. Classes are bindings of names to
- //! values.
- //!
- //! Dictionaries - Associative arrays, allocated with the syntax “new {}”
- //! or just “{}”
- //!
- //! Arrays - Arrays, allocated with the syntax “new [X]” where X is an
- //! expression computing the size of the array
- //!
- //! Exceptions - The base type for an
- //! error that can be handled in code with a try/catch. Used with the throw keyword.
- //! @since 1.0.0
- module Lang {
- //! All Array objects are single dimensional and take any objects (including arrays)
- //! as members. Not all members of an Array need to be the same type of object.
- //! @since 1.0.0
- class Array {
- //! Use size() to get the size of the Array.
- //! @since 1.0.0
- //! @return [Number] The number of elements in Array
- function size() {}
- //! Convert the array to a String representation with toString(). Each elements'
- //! toString() method will be invoked.
- //! @since 1.0.0
- //! @return [String] The String representation of the Array
- function toString() {}
- }
- //! Boolean objects wrap a true or false value. You can use the true or false
- //! keyword to create a Boolean.
- //! @since 1.0.0
- class Boolean {
- }
- //! Dictionary is a hash table used to map keys to values. Both the keys and the
- //! values can be any type of object; the keys/values do not need to be the same
- //! type of object.
- //! @since 1.0.0
- class Dictionary {
- //! Use get() to retrieve a value for a given key.
- //! @since 1.0.0
- //! @param key to retrieve
- //! @return [Object] Value for key, or null if does not exist
- function get(key) {}
- //! Check if the given key exists with hasKey().
- //! @since 1.0.0
- //! @param key Key to check for
- //! @return [Boolean] true if key exists, false otherwise
- function hasKey(key) {}
- //! Use isEmpty() to determine it the Dictionary is empty.
- //! @since 1.0.0
- //! @return [Boolean] true if empty, false otherwise
- function isEmpty() {}
- //! Use keys() to retrieve the keys in the Dictionary.
- //! @since 1.0.0
- //! @return [Array] Array of keys in the Dictionary
- function keys() {}
- //! Use put() to place a value in the hash table with the given key.
- //! @since 1.0.0
- //! @param key Key of the hash map
- //! @param value Value to put in the hash map
- function put(key, value) {}
- //! Use remove() to delete an item from the hash table.
- //! @since 1.0.0
- //! @param key to remove
- function remove(key) {}
- //! Use size() to retrieve the number of elements in the Dictionary.
- //! @since 1.0.0
- //! @return [Number] The number of elements in Dictionary
- function size() {}
- //! Convert to a String with toString().
- //! @since 1.0.1
- //! @return String representation of dictionary
- function toString() {}
- //! Use value() to retrieve the values in the Dictionary.
- //! @since 1.0.0
- //! @return [Array] Array of values in the Dictionary
- function values() {}
- }
- //! Double represents a 64 bit floating point number. To use a double in Monkey C
- //! add 'd' to the end of the number:
- //! @since 1.0.0
- class Double {
- //! Use abs() to get the Absolute value of the Double.
- //! @since 1.0.0
- //! @return [Double] Absolute value of the Double
- function abs() {}
- //! Use format() to format the Double using the given formatting String. The format
- //! string is similar to the format string that can be passed in to printf in c
- //! stdio (the [length] option is not available):
- //!
- //! The supported specifiers are: d,
- //! i, u, o, x, X, f, e, E, g, G.
- //!
- //! supports only + and 0
- //!
- //! supports only numbers (*
- //! is not supported)
- //!
- //! supports only numbers (* is not supported)
- //! @since 1.0.0
- //! @return [String] A formatted String
- function format() {}
- //! Convert to a Double with toDouble().
- //! @since 1.0.0
- //! @return [Double] A Double object
- function toDouble() {}
- //! Convert the Double to a Float with toFloat().
- //! @since 1.0.0
- //! @return [Float] A Float object
- function toFloat() {}
- //! Convert the Double to a Long with toLong().
- //! @since 1.0.0
- //! @return [Long] A Long object
- function toLong() {}
- //! Convert the Double to a Number with toNumber(). Since the number is a double the
- //! value will be rounded toward 0. For example, 6.8 becomes 6 and -5.7 becomes -5.
- //! @since 1.0.0
- //! @return [Number] A Number object
- function toNumber() {}
- //! Convert a Double to a String with toString().
- //! @since 1.0.0
- //! @return [String] The String representation of the object
- function toString() {}
- }
- //! Exception is a class that represents a thrown Exception. Custom exceptions can
- //! be created by extending this class. Make sure to call Exception.initialize() to
- //! get the proper callstack if extending this class.
- //! @since 1.0.0
- class Exception {
- //! Constructor. Sets up the callstack for printStackTrace(). Must be called by
- //! classes that extend Exception.
- //! @since 1.1.2
- function initialize() {}
- //! Get the error message for the exception
- //! @since 1.2.0
- //! @return [String] The error message, or null if no message is given
- function getErrorMessage() {}
- //! Print the stack trace of the thrown exception
- //! @since 1.1.2
- function printStackTrace() {}
- }
- //! Floats are 32 bit floating point values. A decimal number is Float by default
- //! unless the 'd' prefix is used.
- //! @since 1.0.0
- class Float {
- //! Use abs() to get the Absolute value of the Float.
- //! @since 1.0.0
- //! @return [Float] Absolute value of the Float
- function abs() {}
- //! Use format() to format the Float using the given formatting String. The format
- //! string is similar to the format string that can be passed in to printf in c
- //! stdio (the [length] option is not available):
- //!
- //! The supported specifiers are: d,
- //! i, u, o, x, X, f, e, E, g, G.
- //!
- //! supports only + and 0
- //!
- //! supports only numbers (*
- //! is not supported)
- //!
- //! supports only numbers (* is not supported)
- //! @since 1.0.0
- //! @return [String] A formatted String
- function format() {}
- //! Convert the Float to a Double with toDouble().
- //! @since 1.0.0
- //! @return [Double] A Double object
- function toDouble() {}
- //! Convert to a Float with toFloat().
- //! @since 1.0.0
- //! @return [Float] A Float object
- function toFloat() {}
- //! Convert the Float to a Long with toLong().
- //! @since 1.0.0
- //! @return [Long] A Long object
- function toLong() {}
- //! Convert the Float to a Number with toNumber(). Since the number is a float the
- //! value will be rounded toward 0. For example, 6.8 becomes 6 and -5.7 becomes -5.
- //! @since 1.0.0
- //! @return [Number] A Number object
- function toNumber() {}
- }
- //! Long represents a 64 bit integer. To use a Long value in Monkey C add 'l' to the
- //! end of the number:
- //! @since 1.0.0
- class Long {
- //! Use abs() to get the Absolute value of the Long.
- //! @since 1.0.0
- //! @return [Long] Absolute value of the Long
- function abs() {}
- //! Use format() to format the Long using the given formatting String. The format
- //! string is similar to the format string that can be passed in to printf in c
- //! stdio (the [length] option is not available):
- //!
- //! The supported specifiers are: d,
- //! i, u, o, x, X, f, e, E, g, G.
- //!
- //! supports only + and 0
- //!
- //! supports only numbers (*
- //! is not supported)
- //!
- //! supports only numbers (* is not supported)
- //! @since 1.0.0
- //! @return [String] A formatted String
- function format() {}
- //! Convert the Long to a Double with toDouble().
- //! @since 1.0.0
- //! @return [Double] A Double object
- function toDouble() {}
- //! Convert the Long to a Float with toFloat().
- //! @since 1.0.0
- //! @return [Float] A Float object
- function toFloat() {}
- //! Convert to a Long with toLong().
- //! @since 1.0.0
- //! @return [Long] A Long object
- function toLong() {}
- //! Convert the Long to a Number with toNumber().
- //! @since 1.0.0
- //! @return [Number] A Number object
- function toNumber() {}
- //! Convert a Long to a String with toString().
- //! @since 1.0.0
- //! @return [String] The String representation of the Long
- function toString() {}
- }
- //! Method is a class that represents a callback. You can create one using the
- //! object.method call, and invoke the method using the invoke method.
- //! @since 1.0.0
- class Method {
- //! Constructor
- //! @since 1.0.0
- //! @param aClass Classdef of method
- //! @param [Symbol] aMethod Symbol of class object
- function initialize(aClass, aMethod) {}
- //! Use hashCode() to get a hash code value for the Method.
- //! @since 1.0.0
- //! @return [Number] Hash code for the Method
- function hashCode() {}
- //! Invoke the method with invoke().
- //! @since 1.0.0
- //! @param args parameters
- //! @return [Object] The return value from callback
- function invoke(args) {}
- }
- //! All Number objects wrap a 32 bit signed integer.
- //! @since 1.0.0
- class Number {
- //! Use abs() to get the Absolute value of the Number.
- //! @since 1.0.0
- //! @return [Number] Absolute value of the Number
- function abs() {}
- //! Use format() to format the Number using the given formatting String. The format
- //! string is similar to the format string that can be passed in to printf in c
- //! stdio (the [length] option is not available):
- //!
- //! The supported specifiers are: d,
- //! i, u, o, x, X, f, e, E, g, G.
- //!
- //! supports only + and 0
- //!
- //! supports only numbers (*
- //! is not supported)
- //!
- //! supports only numbers (* is not supported)
- //! @since 1.0.0
- //! @return [String] A formatted String
- function format() {}
- //! Convert the Number to a Double with toDouble().
- //! @since 1.0.0
- //! @return [Double] A Double object
- function toDouble() {}
- //! Convert the Number to a Float with toFloat().
- //! @since 1.0.0
- //! @return [Float] A Float object
- function toFloat() {}
- //! Convert the Number to a Long with toLong().
- //! @since 1.0.0
- //! @return [Long] A Long object
- function toLong() {}
- //! Convert to a Number with toNumber().
- //! @since 1.0.0
- //! @return [Number] A Number object
- function toNumber() {}
- }
- //! Toybox.Lang.Object is the root object for the Monkey C class hierarchy.
- //! @since 1.0.0
- class Object {
- //! Test if this instance is equal to another instance of an object by using
- //! equals().
- //! @since 1.0.0
- //! @param that That item to test against
- //! @return [Boolean] true if objects are equal, false otherwise.
- function equals(that) {}
- //! Use hashCode() to return a hash code value for the object.
- //! @since 1.0.0
- //! @return [Number] Hash code for the object
- function hashCode() {}
- //! To retrieve the callback to the given method, use method(). This takes a Symbol
- //! and returns the associated Method object.
- //! @since 1.0.0
- //! @param [Symbol] symbol Symbol of the method requested
- //! @return [Method] Method object associated with the given method symbol
- function method(symbol) {}
- //! Use toString to convert an Object to a String.
- //! @since 1.0.0
- //! @return [String] The String representation of the object
- function toString() {}
- //! Get a weak reference to the object.
- //! @since 1.2.0
- //! @return [WeakReference] Immutable types (Number, Float, Long, Double, Boolean, String) will return their values Other object types will return a WeakReference object
- function weak() {}
- }
- //! All String objects represent a sequence of characters. The String object
- //! provides methods for string operations.
- //! @since 1.0.0
- class String {
- //! Test if this instance is equal to another instance of an Object with equals().
- //! @since 1.0.0
- //! @param that That item to test against
- //! @return [Boolean] true if the objects are equal, false otherwise
- function equals(that) {}
- //! Use find() to determine if the passed String exists in this String.
- //! @since 1.0.0
- //! @param [String] string String to find
- //! @return [Number] index Index of the start of string or null if not found
- function find(string) {}
- //! Use hasCode() to get a hash code value for the String.
- //! @since 1.0.0
- //! @return [Number] Hash code for the String
- function hashCode() {}
- //! Use length() to get the number of characters in the String
- //! @since 1.0.0
- //! @return [Number] The length of the String
- function length() {}
- //! Use subString() to create a new String that contains the contents of the current
- //! string from start position to end position, exclusive.
- //! @since 1.0.0
- //! @param [Number] startIndex Zero based start index of the substring
- //! @param [Number] endIndex End position of the substring, exclusive
- //! @return [String] The substring of String or null on error
- function substring(startIndex, endIndex) {}
- //! If a string is in the numeric form of “123” or “123.45”, convert it to a Float
- //! object with toFloat().
- //! @since 1.0.0
- //! @return [Float] A Float object, or error
- function toFloat() {}
- //! Convert the String to lower case with toLower().
- //! @since 1.0.0
- //! @return [String] A new lower case String
- function toLower() {}
- //! If a string is in numeric form, either “123” or “0x12AB”, convert it to a Number
- //! object with toNumber().
- //! @since 1.0.0
- //! @return [Number] A Number object, or error
- function toNumber() {}
- //! Convert to a String with toString().
- //! @since 1.0.0
- //! @return String representation of String
- function toString() {}
- //! Convert the String to upper case with toUpper().
- //! @since 1.0.0
- //! @return [String] A new upper case String
- function toUpper() {}
- }
- //! A Symbol is a lightweight constant identifier. The Monkey C compiler will assign
- //! a new integer value when it encounters a new symbol. This allows a developer to
- //! use symbols as keys or constant values without explicitly declaring a
- //! constant.
- //!
- //! Symbols can be useful when wanting to create keys without having to
- //! declare an enum.
- //! @since 1.0.0
- class Symbol {
- //! Convert a Symbol to a String with toString().
- //! @since 1.0.0
- //! @return [String] The String representation of the Symbol
- function toString() {}
- }
- //! UnexpecteTypeException is thrown when a function is passed an incorrect type for
- //! a parameter.
- //! @since 1.2.0
- class UnexpectedTypeException extends Exception {
- //! Constructor
- //! @since 1.2.0
- function initialize() {}
- }
- //! A weak reference is a loosly bound reference to another object. If all strong
- //! references have been freed, the get() method will return null. This allows the
- //! developer to avoid circular references.
- //! @since 1.2.0
- class WeakReference {
- //! Get the object referenced.
- //! @since 1.2.0
- //! @return [Object] Object referenced, or null if object is no longer live.
- function get() {}
- //! Return if the reference is still alive.
- //! @since 1.2.0
- //! @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
- function stillAlive() {}
- }
- //! Use format() to create a formatted String by substituting the given parameters
- //! into the given format at the corresponding locations.
- //!
- //! The given format:
- //!
- //! Paired
- //! with the given parameters:
- //!
- //! Would result in the String:
- //! @since 1.0.0
- //! @param [String] format A string using $1$, $2$, $3$… as substitution identifiers
- //! @param [Array] params Array of content to substitute in
- //! @return [String] A new String with the substituted content
- function format(format, params) {}
- }
- //! The Math Module provides various math methods available for use by Apps.
- //! @since 1.0.0
- module Math {
- //! @since 1.0.0
- const PI = 3.14159265358979323846;
- //! @since 1.0.0
- const E = 2.7182818284590452354;
- //! Use acos() to get the arc cosine of a cosine.
- //! @since 1.0.0
- //! @param [Float] x The cosine value
- //! @return [Float] 0..PI in radians, or NaN if invalid
- function acos(x) {}
- //! Use asin() to get the arc sine of a sine.
- //! @since 1.0.0
- //! @param [Float] x The sine value
- //! @return [Float] -PI/2..PI/2 in radians, or NaN if invalid
- function asin(x) {}
- //! Use atan() to get the arc tangent of a tangent.
- //! @since 1.0.0
- //! @param [Float] x The tangent value
- //! @return [Float] -PI/2..PI/2 in radians, or NaN if invalid
- function atan(x) {}
- //! Use cos() to get the cosine of an angle.
- //! @since 1.0.0
- //! @param [Float] x The angle in radians
- //! @return [Float] Cosine value
- function cos(x) {}
- //! Use log() to get logarithmic value of a value.
- //! @since 1.0.0
- //! @param [Float] x The value for which to get logarithm
- //! @param [Float] base Optional base value (E is assumed)
- //! @return [Float] Logarithm of x
- function log(x, base) {}
- //! Use pow() to calculate x to the power of y.
- //! @since 1.0.0
- //! @param [Float] x Base
- //! @param [Float] y Exponent
- //! @return [Float] x to the power of y
- function pow(x, y) {}
- //! Use rand() to get a random number.
- //! @since 1.0.0
- //! @return [Number] Non-negative random number
- function rand() {}
- //! Use sin() to get the sine of an angle.
- //! @since 1.0.0
- //! @param [Float] x The angle in radians
- //! @return [Float] Sine of X
- function sin(x) {}
- //! Use sqrt() to calculate the square root of a value.
- //! @since 1.0.0
- //! @param [Float] x The value for which to get the square root
- //! @return [Float] Square root of X, or NaN if invalid
- function sqrt(x) {}
- //! Use srand() to seed the random number generator.
- //! @since 1.0.0
- //! @param [Number] seed The value used for seeding rand()
- function srand(seed) {}
- //! Use tan() to get the tangent of an angle.
- //! @since 1.0.0
- //! @param [Float] x The angle in radians
- //! @return [Float] Tangent value of x
- function tan(x) {}
- }
- //! Persisted locations allows the saving of a location (waypoint) to a device's
- //! location list. This feature is only available on devices that support waypoints.
- //! @since 1.0.2
- //! @device fenix 3
- //! @device epix
- //! @permission PersistedLocations
- //! @apptype App
- module PersistedLocations {
- //! Save a location (waypoint) to the device's location list
- //! @since 1.0.2
- //! @param [Location] location Location object to persist
- //! @param [Dictionary] options Dictionary of options, or null to accept defaults
- //! @option [Hash] :name a customizable set of options
- function persistLocation(location, options) {}
- }
- //! The Position Module provides an interface into location information.
- //! @since 1.0.0
- //! @permission Positioning
- //! @apptype Widget
- //! @apptype App
- module Position {
- //! The GEO enum is used to retrieve coordinate information in various String
- //! representations.
- //!
- //! Degree Format, ddd.dddddd: 38.278652
- //! @since 1.0.0
- const GEO_DEG = 0;
- //! Degree/Minute Format, dddmm.mmm: 38 27.865'
- //! @since 1.0.0
- const GEO_DM = 1;
- //! Degree/Minute/Seconds Format, dddmmss: 38 27' 8“
- //! @since 1.0.0
- const GEO_DMS = 2;
- //! Military Grid Reference System (MGRS): 4QFJ12345678
- //! @since 1.0.0
- const GEO_MGRS = 3;
- //! The QUALITY enum is used to represent the quality of GPS fix with which the
- //! Location information was calculated.
- //!
- //! GPS is not available
- //! @since 1.0.0
- const QUALITY_NOT_AVAILABLE = 0;
- //! The Location is based on the last known GPS fix.
- //! @since 1.0.0
- const QUALITY_LAST_KNOWN = 1;
- //! The Location was calculated with a poor GPS fix. Only a 2-D GPS fix is
- //! available, likely due to a limited number of tracked satellites.
- //! @since 1.0.0
- const QUALITY_POOR = 2;
- //! The Location was calculated with a usable GPS fix. A 3-D GPS fix is available,
- //! with marginal HDOP (horizontal dilution of precision)
- //! @since 1.0.0
- const QUALITY_USABLE = 3;
- //! The Location was calculated with a good GPS fix. A 3-D GPS fix is available,
- //! with good-to-excellent HDOP.
- //! @since 1.0.0
- const QUALITY_GOOD = 4;
- //! One-time retrieval of Location
- //! @since 1.0.0
- const LOCATION_ONE_SHOT = 0;
- //! Register for Location updates
- //! @since 1.0.0
- const LOCATION_CONTINUOUS = 1;
- //! Unregister for Location updates
- //! @since 1.0.0
- const LOCATION_DISABLE = 2;
- //! The Location.Info class contains all information necessary for the Location. It
- //! can be passed on the update or it can be retrieved on demand. The fields in this
- //! class may return null so you should null check a value before using it.
- //! @since 1.0.0
- class Info {
- //! Positional accuracy (good, usable, poor, not available). Cannot be null.
- //! @since 1.0.0
- //! @return [Number]
- var accuracy;
- //! Elevation in meters (mean sea level). Elevation is derived from the most
- //! accurate source: Barometer or GPS in order of descending accuracy. If no GPS is
- //! present, then barometer readings will be used.
- //! @since 1.0.0
- //! @return [Float]
- var altitude;
- //! True north referenced heading in radians. This metric provides the direction of
- //! travel when moving. When stopped, it provides compass orientation, if supported
- //! by the device.
- //! @since 1.0.0
- //! @return [Float]
- var heading;
- //! Lat/Lon. If no GPS is available or is between GPS fix intervals (typically 1
- //! second), position is propagated (i.e. dead-reckoned) using the last known
- //! heading and last known speed. After a short period of time, position will cease
- //! to be propagated to prevent excessive accumulation of position errors.
- //! @since 1.0.0
- //! @return [Location]
- var position;
- //! Horizontal speed in meters per second. Speed is derived from the most accurate
- //! source: GPS, footpod, or accelerometer in order of descending accuracy.
- //! @since 1.0.0
- //! @return [Float]
- var speed;
- //! GPS time stamp of fix
- //! @since 1.0.0
- //! @return [Moment]
- var when;
- }
- //! The Location object represents a position. It provides accessor methods for
- //! retrieving the coordinates in various formats.
- //! @since 1.0.0
- class Location {
- //! Constructor: create a coordinate based off an options hash table
- //! @since 1.0.0
- //! @param [Dictionary] options Hash table of options
- //! @option [Number] :latitude The latitude
- //! @option [Number] :longitude The longitude
- //! @option [Symbol] :format The format of lat/long (possible values are :degrees, :radians, or :semicircles)
- function initialize(options) {}
- //! Use toDegrees() to retrieve the coordinate back as an Array of degree values.
- //! @since 1.0.0
- //! @return [Array] An Array of the latitude and the longitude in degree format
- function toDegrees() {}
- //! Use toGeoString() to get a String representation of the coordinate.
- //! @since 1.0.0
- //! @param format Coordinate format to which coordinate should be converted (GEO constant)
- //! @return [String] Formatted coordinate String
- function toGeoString(format) {}
- //! Use toRadians() to retrieve the coordinate back as an Array of radian values.
- //! @since 1.0.0
- //! @return [Array] An Array of the latitude and the longitude in radian format
- function toRadians() {}
- }
- //! Request a location event with enableLocationEvents().
- //! @since 1.0.0
- //! @param type LOCATION_ONE_SHOT for a single location request, LOCATION_CONTINUOUS to enable location tracking, and LOCATION_DISABLE to turn off location tracking
- //! @param [Method] listener Method object to call with location updates; receives a Position.Info as an argument
- function enableLocationEvents(type, listener) {}
- //! Use getInfo() to retrieve the current Location.Info.
- //! @since 1.0.0
- //! @return [Location.Info] The Info object containing the current information
- function getInfo() {}
- //! Use parse() to parse an input string and convert it into a Location.
- //! @since 1.0.0
- //! @param [String] input String to parse
- //! @param format Coordinate format to use for parsing (Position.GEO_XXX constant)
- //! @return [Location] The Location object
- function parse(input, format) {}
- }
- //! @permission Sensor
- //! @apptype Widget
- //! @apptype App
- module Sensor {
- //! Remote system sensors that can be enabled
- //! @since 1.0.0
- const SENSOR_BIKESPEED = 0;
- //! @since 1.0.0
- const SENSOR_BIKECADENCE = 1;
- //! @since 1.0.0
- const SENSOR_BIKEPOWER = 2;
- //! @since 1.0.0
- const SENSOR_FOOTPOD = 3;
- //! @since 1.0.0
- const SENSOR_HEARTRATE = 4;
- //! @since 1.0.0
- const SENSOR_TEMPERATURE = 5;
- //! The Sensor.Info class contains all information necessary for the Sensor. It can
- //! be passed on the update or it can be retrieved on demand. The fields in this
- //! class may return null so you should null check a value before using it.
- //! @since 1.0.0
- class Info {
- //! Accelerometer reading for X, Y, and Z as an Array of Number values
- //! (milli-g-units).
- //! @since 1.2.0
- //! @return [Array]
- var accel;
- //! Altitude (m) (See the altitude member of the Info object in the Position module
- //! for more information)
- //! @since 1.0.0
- //! @return [Float]
- var altitude;
- //! Cadence (rpm) Cadence is derived (in order of priority) from bike sensors
- //! (cadence or speed must be enabled), advanced running dynamics sensors (e.g.
- //! heart strap with running dynamics enabled), footpod, or watch-based cadence
- //! calculations.
- //! @since 1.0.0
- //! @return [Number]
- var cadence;
- //! True north referenced heading (radians). This metric provides compass
- //! orientation if it is supported by the device.
- //! @since 1.0.0
- //! @return [Float]
- var heading;
- //! HR (bpm)
- //! @since 1.0.0
- //! @return [Number]
- var heartRate;
- //! Magnetometer reading for X, Y, and Z as an Array of Number values (mGauss)
- //! @since 1.2.0
- //! @return [Array]
- var mag;
- //! Power (W)
- //! @since 1.0.0
- //! @return [Number]
- var power;
- //! Pressure (Pa) Returns base level (sea-level) pressure. This requires that a GPS
- //! altitude has been obtained, in order to take the local (ambient) pressure and
- //! convert the barometric pressure to base level pressure.
- //! @since 1.0.0
- //! @return [Float]
- var pressure;
- //! Speed (m/s) (See the speed member of the Info object in the Position module for
- //! more information)
- //! @since 1.0.0
- //! @return [Float]
- var speed;
- //! Temperature (degC)
- //! @since 1.0.0
- //! @return [Float]
- var temperature;
- }
- //! Use enableSensorEvents() to request a sensor event. This enables sensor events
- //! at 1Hz.
- //! @since 1.0.0
- //! @param [Method] listener Method Object to call with sensor updates. Null for no listener
- function enableSensorEvents(listener) {}
- //! Use getInfo() to retrieve the current Sensor.Info
- //! @since 1.0.0
- //! @return [Sensor.Info] object with current information.
- function getInfo() {}
- //! Use setEnabledSensors() to request system sensors. This will also enable the
- //! system sensors if possible.
- //! @since 1.0.0
- //! @param [Array] sensors Array of Sensor types to enable, or [] to disable all sensors
- //! @return [Array] Array of requested sensors that were available
- function setEnabledSensors(sensors) {}
- }
- //! The System module provides basic system calls.
- //! @since 1.0.0
- module System {
- //! Setting values for DeviceSettings
- //!
- //! Display units in metric units
- //! @since 1.0.0
- const UNIT_METRIC = 0;
- //! Display units in statute units
- //! @since 1.0.0
- const UNIT_STATUTE = 1;
- //! @since 1.2.0
- const SCREEN_SHAPE_ROUND = 1;
- //! @since 1.2.0
- const SCREEN_SHAPE_SEMI_ROUND = 2;
- //! @since 1.2.0
- const SCREEN_SHAPE_RECTANGLE = 3;
- //! @since 1.2.0
- const BUTTON_INPUT_SELECT = 0x01;
- //! @since 1.2.0
- const BUTTON_INPUT_UP = 0x02;
- //! @since 1.2.0
- const BUTTON_INPUT_DOWN = 0x04;
- //! @since 1.2.0
- const BUTTON_INPUT_MENU = 0x08;
- //! ClockTime is a class used to represent clock time.
- //! @since 1.0.0
- class ClockTime {
- //! Daylight savings time offset
- //! @since 1.0.0
- //! @return [Number]
- var dst;
- //! Hour of the day (since midnight)
- //! @since 1.0.0
- //! @return [Number]
- var hour;
- //! Minute of the hour
- //! @since 1.0.0
- //! @return [Number]
- var min;
- //! Second of the minute
- //! @since 1.0.0
- //! @return [Number]
- var sec;
- //! Time offset from UTC in seconds
- //! @since 1.0.0
- //! @return [Number]
- var timeZoneOffset;
- }
- //! DeviceSettings is a class used to represent various settings on the device.
- //! @since 1.0.0
- class DeviceSettings {
- //! True if activity Tracking is enabled on the device
- //! @since 1.2.0
- //! @return [Boolean]
- var activityTrackingOn;
- //! The number of alarms set to go off on the device
- //! @since 1.2.0
- //! @return [Number]
- var alarmCount;
- //! UNIT_METRIC if distance is shown in kilometers, UNIT_STATUTE if it is shown in
- //! miles
- //! @since 1.0.0
- //! @return [Number]
- var distanceUnits;
- //! UNIT_METRIC if elevation is shown in meters, UNIT_STATUTE if it is shown in feet
- //! @since 1.0.0
- //! @return [Number]
- var elevationUnits;
- //! Get the current firmware version as a two entry array [ major, minor ]
- //! @since 1.2.0
- //! @return [Array]
- var firmwareVersion;
- //! UNIT_METRIC if height is shown in meters, UNIT_STATUTE if it is shown in feet
- //! @since 1.0.0
- //! @return [Number]
- var heightUnits;
- //! Enumerate if Select/Up/Down/Menu buttons are supported using the
- //! BUTTON_INPUT_XXXX enum values
- //! @since 1.2.0
- //! @return [Number]
- var inputButtons;
- //! True if unit shows 24 hour units, false if it displays 12 hour
- //! @since 1.0.0
- //! @return [Boolean]
- var is24Hour;
- //! Does this unit have a touch screen?
- //! @since 1.2.0
- //! @return [Boolean]
- var isTouchScreen;
- //! Get the CIQ version as a three entry array [major, minor, micro ]
- //! @since 1.2.0
- //! @return [Array]
- var monkeyVersion;
- //! The number of active notifications
- //! @since 1.2.0
- //! @return [Number]
- var notificationCount;
- //! UNIT_METRIC if pace is shown in kilometers/hour, UNIT_STATUTE if it is shown in
- //! miles/hour
- //! @since 1.0.0
- //! @return [Number]
- var paceUnits;
- //! Get the part number for this product as a string
- //! @since 1.2.0
- //! @return [String]
- var partNumber;
- //! True if a mobile phone is connected to the device, false otherwise
- //! @since 1.1.0
- //! @return [Boolean]
- var phoneConnected;
- //! The height of the screen in pixels
- //! @since 1.2.0
- //! @return [Number]
- var screenHeight;
- //! SCREEN_SHAPE_XXXX enum value that describes the screen shape
- //! @since 1.2.0
- //! @return [Number]
- var screenShape;
- //! The width of the screen in pixels
- //! @since 1.2.0
- //! @return [Number]
- var screenWidth;
- //! UNIT_METRIC if temperature is shown in Celsius, UNIT_STATUTE if it is shown in
- //! Fahrenheit
- //! @since 1.0.0
- //! @return [Number]
- var temperatureUnits;
- //! True if tones are enabled on the unit, false if they are disabled return
- //! [Boolean]
- //! @since 1.0.0
- var tonesOn;
- //! True if vibration is enabled on the unit, false if it is disabled
- //! @since 1.0.0
- //! @return [Boolean]
- var vibrateOn;
- //! UNIT_METRIC if weight is shown in kilograms, UNIT_STATUTE if it is shown in
- //! pounds
- //! @since 1.0.0
- //! @return [Number]
- var weightUnits;
- }
- //! Stats is a class to hold various system stats.
- //! @since 1.0.0
- class Stats {
- //! Battery life remaining in percent (between 0.0 and 100.0)
- //! @since 1.0.0
- //! @return [Float]
- var battery;
- //! Free memory in bytes
- //! @since 1.0.0
- //! @return [Number]
- var freeMemory;
- //! Total available memory in bytes
- //! @since 1.0.0
- //! @return [Number]
- var totalMemory;
- //! Memory used by this application in bytes
- //! @since 1.0.0
- //! @return [Number]
- var usedMemory;
- }
- //! Call error() to cause an error. This will exit the system.
- //! @since 1.0.0
- //! @param [String] msg Error message to output
- function error(msg) {}
- //! To end execution of the current system cleanly from any point in the app.
- //! @since 1.0.0
- function exit() {}
- //! Get the current clock time with getClockTime().
- //! @since 1.0.0
- //! @return [System.ClockTime] Current clock time
- function getClockTime() {}
- //! Get the device settings with getDeviceSettings().
- //! @since 1.0.0
- //! @return [DeviceSetting] The current device settings
- function getDeviceSettings() {}
- //! Get the current system stats with getSystemStats().
- //! @since 1.0.0
- //! @return [System.Stats] Current system stats
- function getSystemStats() {}
- //! Use getTimer() to get the current millisecond timer.
- //! @since 1.0.0
- //! @return [Number] System millisecond timer
- function getTimer() {}
- //! Use print() to print to the console
- //! @since 1.0.0
- //! @param x Object or string to displays
- function print(x) {}
- //! Use println() to print to the console with a line terminator.
- //! @since 1.0.0
- //! @param a Object or string to display
- function println(a) {}
- //! In future versions of the SDK trap() will break into the debugger.
- //! @since 1.0.0
- function trap() {}
- }
- module Test {
- class Test {
- //! Returns the value of attribute mPassed
- var mPassed;
- function getNumberOfTests() {}
- function passed() {}
- function runTest() {}
- }
- }
- //! The Time module provides functionality for dealing with times and dates.
- //! @since 1.0.0
- module Time {
- //! Short formatting is a numerical representation of date/time.
- //! @since 1.0.0
- const FORMAT_SHORT = 0;
- //! Medium formatting is a mix of Numbers and Strings depending on what function is
- //! being called. If a String is used, it results in an abbreviated form of the time
- //! or date.
- //! @since 1.0.0
- const FORMAT_MEDIUM = 1;
- //! Long formatting is a mix of Numbers and Strings depending on what function is
- //! being called. If a String is used, it results in the spelled out form of the
- //! time or date.
- //! @since 1.0.0
- const FORMAT_LONG = 2;
- //! Gregorian provides an interface for getting Moments and Durations for the
- //! Gregorian calendar.
- //! @since 1.0.0
- module Gregorian {
- //! Time constant for number of seconds in a year
- //! @since 1.0.0
- const SECONDS_PER_YEAR = 31557600;
- //! Time constant for number of seconds in a day
- //! @since 1.0.0
- const SECONDS_PER_DAY = 86400;
- //! Time constant for number of seconds in an hour
- //! @since 1.0.0
- const SECONDS_PER_HOUR = 3600;
- //! Time constant for number of seconds in a minute
- //! @since 1.0.0
- const SECONDS_PER_MINUTE = 60;
- //! The Gregorian.Info class contains all information necessary to represent a time.
- //! The types of the returned values depend on the Time.FORMAT_XXX value used when
- //! calling Gregorian.getInfo().
- //! @since 1.0.0
- class Info {
- //! Day
- //! @since 1.0.0
- //! @return [Number]
- var day;
- //! Day of week
- //! @since 1.0.0
- //! @return [Object]
- var day_of_week;
- //! Hours since midnight
- //! @since 1.0.0
- //! @return [Number]
- var hour;
- //! Minutes of hour
- //! @since 1.0.0
- //! @return [Number]
- var min;
- //! Month
- //! @since 1.0.0
- //! @return [Object]
- var month;
- //! Seconds of minute
- //! @since 1.0.0
- //! @return [Number]
- var sec;
- //! Year
- //! @since 1.0.0
- //! @return [Number]
- var year;
- }
- //! Create a Duration object from a hash of options using duration().
- //! @since 1.0.0
- //! @param [Dictionary] options Hash table of options
- //! @option [Number] :years The number of years
- //! @option [Number] :days The number of days
- //! @option [Number] :hours The number of hours
- //! @option [Number] :minutes The number of minutes
- //! @option [Number] :seconds The number of seconds
- //! @return [Duration] The Duration object created using the options
- function duration(options) {}
- //! Use info() to retrieve a Gregorian.Info for a date.
- //! @since 1.0.0
- //! @param [Moment] date Moment object to get Info from
- //! @param [Number] format Time FORMAT_XXX constant to use
- //! @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.
- function info(date, format) {}
- //! Create a Moment object from a hash table of options with moment(). The Moment is
- //! created from the current time. For instance, if the current day is April 1 and
- //! you pass in a :day value of 1 the returned Moment's day will be April 2.
- //! @since 1.0.0
- //! @param [Dictionary] options Hash table of options
- //! @option [Number] :year The year
- //! @option [Number] :month The month
- //! @option [Number] :day The day
- //! @option [Number] :hour The hour
- //! @option [Number] :minute The minute
- //! @option [Number] :second The second
- //! @return [Moment] The Moment object created using the options
- function moment(options) {}
- }
- //! The Duration object represents an immutable span of time. This is the return
- //! value when requesting a time result in days or hours.
- //! @since 1.0.0
- class Duration {
- //! Creates a Duration object.
- //! @since 1.0.0
- //! @param [Number] value Number of seconds to initialize the Duration to
- function initialize(value) {}
- //! Use add() to add a Moment or another Duration to a Duration.
- //! @since 1.0.0
- //! @param time Duration or Moment to add to Duration
- //! @return Duration + Moment = Moment, Duration + Duration = Duration
- function add(time) {}
- //! Use compare() to determine if a Duration is shorter or longer than another
- //! Duration.
- //! @since 1.0.0
- //! @param [Duration] time Duration to compare to this Duration
- //! @return [Number] Negative if this < that, positive if this > that, 0 if this == that
- function compare(time) {}
- //! Use divide() to divide a Duration by a value.
- //! @since 1.0.0
- //! @param value Number or Float to divide Duration
- //! @return [Duration] Result object of Duration / value
- function divide(value) {}
- //! Use lessThan() to determine if a Duration is longer than another Duration.
- //! @since 1.0.0
- //! @param [Duration] time Duration to compare to this Duration
- //! @return [Boolean] true if this is greater than that, false otherwise
- function greaterThan(time) {}
- //! Use lessThan() to determine if a Duration is shorter than another Duration.
- //! @since 1.0.0
- //! @param [Duration] time Duration to compare to this Duration
- //! @return [Boolean] true if this is less than that, false otherwise
- function lessThan(time) {}
- //! Use multiply() to multiply a Duration by a value.
- //! @since 1.0.0
- //! @param value Number or Float to multiply with Duration
- //! @return [Duration] Result object of Duration * value
- function multiply(value) {}
- //! Use subtract() to compute the delta between two Durations.
- //! @since 1.0.0
- //! @param [Duration] time Duration object used to find delta
- //! @return [Duration] Duration object of Duration - time
- function subtract(time) {}
- //! Get the Duration value with value().
- //! @since 1.0.0
- //! @return [Number] Duration in seconds
- function value() {}
- }
- //! The Moment object represents an immutable moment in time. Internally stored as a
- //! 32 bit integer of number of seconds since the UNIX epoch.
- //! @since 1.0.0
- class Moment {
- //! Returns a new instance of Moment
- //! @since 1.1.2
- function initialize() {}
- //! Use add() to add a Duration to a Moment.
- //! @since 1.0.0
- //! @param [Duration] time Duration delta to add to Moment
- //! @return [Moment] The result of Moment + Duration
- function add(time) {}
- //! Use compare() to determine if a Moment is before or after another Moment.
- //! @since 1.0.0
- //! @param [Moment] date Moment object to compare to this Moment
- //! @return [Number] Negative if this < that, positive if this > that, 0 if this == that
- function compare(date) {}
- //! Use greaterThan() to determine if a Moment is greater than another Moment.
- //! @since 1.0.0
- //! @param [Moment] date Moment object to compare to this Moment
- //! @return [Boolean] true if this is greater than that, false otherwise
- function greaterThan(date) {}
- //! Use lessThan() to determine if a Moment is less than another Moment.
- //! @since 1.0.0
- //! @param [Moment] date Moment object to compare to this Moment
- //! @return [Boolean] true if this is less than that, false otherwise
- function lessThan(date) {}
- //! Use subtract() to compute the delta between two Moments.
- //! @since 1.0.0
- //! @param [Moment] date Moment object used to find delta
- //! @return [Duration] Delta between date and the Moment object
- function subtract(date) {}
- //! Get the UTC value of this date with value().
- //! @since 1.0.0
- //! @return [Number] UTC date in seconds since UNIX epoch
- function value() {}
- }
- //! Use now() to get a Moment for the current moment in time.
- //! @since 1.0.0
- //! @return [Moment] The current moment in time
- function now() {}
- //! Use today() to get a Moment for the beginning of today based on your current GPS
- //! location.
- //! @since 1.0.0
- //! @return [Moment] The beginning of today
- function today() {}
- }
- //! The Timer module allows access to a Timer object that can run code at a later
- //! time.
- //! @since 1.0.0
- //! @apptype Watch Face
- //! @apptype Widget
- //! @apptype App
- module Timer {
- //! A Timer class will call a function after a number of milliseconds. There are two
- //! types of timers: one-shot or repeating. A one-shot timer will only run once
- //! while a repeating timer will call the function every X milliseconds until stop()
- //! is called. If a repeating timer fails to run before its next execution time then
- //! any missed executions will be skipped.
- //! @since 1.0.0
- class Timer {
- //! Use start() to start the timer. The given callback will be called no sooner than
- //! the given number of milliseconds. This will cause an error if too many timers
- //! are set. The number of available timers (default of 3) and the minimum time
- //! value (default of 50ms) depends on the host system.
- //! @since 1.0.0
- //! @param [Method] callback A function to call after the timer completes
- //! @param [Number] time The number of milliseconds to wait before invoking callback
- //! @param [Boolean] repeat Set to true to have the timer repeat until stop() is called
- function start(callback, time, repeat) {}
- //! Use stop() to stop the timer from running. This only needs to be called for
- //! repeating timers. The Timer can be started again by calling start().
- //! @since 1.0.0
- function stop() {}
- }
- }
- //! The UserProfile module will allow apps to access user information.
- //! @since 1.0.0
- //! @permission UserProfile
- module UserProfile {
- //! The GENDER enum specifies the gender of the user working out.
- //! @since 1.0.0
- const GENDER_FEMALE = 0;
- //! @since 1.0.0
- const GENDER_MALE = 1;
- //! The HR_ZONE_SPORT enum specifies the sport heart rate zones should be read from.
- //! @since 1.2.6
- const HR_ZONE_SPORT_GENERIC = 0;
- //! @since 1.2.6
- const HR_ZONE_SPORT_RUNNING = 1;
- //! @since 1.2.6
- const HR_ZONE_SPORT_BIKING = 2;
- //! @since 1.2.6
- const HR_ZONE_SPORT_SWIMMING = 3;
- //! Profile objects contain user information.
- //! @since 1.0.0
- class Profile {
- //! Activity level from 0-100; 20 is low activity, 50 is medium, 80 is high
- //! (athlete)
- //! @since 1.0.0
- //! @return [Number]
- var activityClass;
- //! Birth Year
- //! @since 1.0.0
- //! @return [Number]
- var birthYear;
- //! Gender enum
- //! @since 1.0.0
- //! @return [Number]
- var gender;
- //! Height in centimeters
- //! @since 1.0.0
- //! @return [Number]
- var height;
- //! Heart rate
- //! @since 1.0.0
- //! @return [Number]
- var restingHeartRate;
- //! Running step length in millimeters
- //! @since 1.0.0
- //! @return [Number]
- var runningStepLength;
- //! Typical sleep time as configured by the user. Stored as Duration past local
- //! midnight.
- //! @since 1.0.0
- //! @return [Duration]
- var sleepTime;
- //! Typical wake time as configured by the user. Stored as Duration past local
- //! midnight.
- //! @since 1.0.0
- //! @return [Duration]
- var wakeTime;
- //! Walking step length in millimeters
- //! @since 1.0.0
- //! @return [Number]
- var walkingStepLength;
- //! Weight in grams
- //! @since 1.0.0
- //! @return [Number]
- var weight;
- }
- //! Returns the sport that the HR_ZONE SPORT_XXX enum that the current activity uses
- //! heart rate zones from. If the active sport does not have sport specific zones,
- //! it will retrun HR_ZONE_SPORT_GENERIC.
- //! @since 1.2.6
- //! @return [Number] Returns the current HR zone sport from the HR_ZONE_SPORT_XXX enum.
- function getCurrentSport() {}
- //! Returns Array of zone thresholds for the requested sport. The returned array
- //! contains zone values as follows:
- //! @since 1.2.6
- //! @param [Number] sport The sport that zones are being requested from. Should be a HR_ZONE_SPORT_XXX value.
- //! @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
- function getHeartRateZones(sport) {}
- //! Use getProfile() to retrieve the current User Profile.
- //! @since 1.0.0
- //! @return [UserProfile.Profile] The Profile object for the user
- function getProfile() {}
- }
- //! The WatchUi module has user interface elements for watch apps.
- //! @since 1.0.0
- module WatchUi {
- //! The power key
- //! @since 1.0.0
- const KEY_POWER = 0;
- //! The light key
- //! @since 1.0.0
- const KEY_LIGHT = 1;
- //! The zoom in key
- //! @since 1.0.0
- const KEY_ZIN = 2;
- //! The zoom out key
- //! @since 1.0.0
- const KEY_ZOUT = 3;
- //! The enter key
- //! @since 1.0.0
- const KEY_ENTER = 4;
- //! The escape key
- //! @since 1.0.0
- const KEY_ESC = 5;
- //! The find key
- //! @since 1.0.0
- const KEY_FIND = 6;
- //! The menu key
- //! @since 1.0.0
- const KEY_MENU = 7;
- //! The down key
- //! @since 1.0.0
- const KEY_DOWN = 8;
- //! The down left key
- //! @since 1.0.0
- const KEY_DOWN_LEFT = 9;
- //! The down key
- //! @since 1.0.0
- const KEY_DOWN_RIGHT = 10;
- //! The left key
- //! @since 1.0.0
- const KEY_LEFT = 11;
- //! The right key
- //! @since 1.0.0
- const KEY_RIGHT = 12;
- //! The up key
- //! @since 1.0.0
- const KEY_UP = 13;
- //! The up-left
- //! @since 1.0.0
- const KEY_UP_LEFT = 14;
- //! The up-right key
- //! @since 1.0.0
- const KEY_UP_RIGHT = 15;
- //! The following keys have been added after ConnectIQ version 1.1.2. Before
- //! evaluating these keys, the test ( Toybox.WatchUi has :EXTENDED_KEYS ) should be
- //! made.
- //! @since 1.1.2
- const EXTENDED_KEYS = 16;
- //! The page key
- //! @since 1.1.2
- const KEY_PAGE = 17;
- //! The start key
- //! @since 1.1.2
- const KEY_START = 18;
- //! The lap key
- //! @since 1.1.2
- const KEY_LAP = 19;
- //! The reset key
- //! @since 1.1.2
- const KEY_RESET = 20;
- //! The sport key
- //! @since 1.1.2
- const KEY_SPORT = 21;
- //! The clock key
- //! @since 1.1.2
- const KEY_CLOCK = 22;
- //! The mode key
- //! @since 1.1.2
- const KEY_MODE = 23;
- //! Animate the property linearly, so the speed remains constant over time
- //! @since 1.0.0
- const ANIM_TYPE_LINEAR = 0;
- //! Animate the property so the speed increases until the end
- //! @since 1.0.0
- const ANIM_TYPE_EASE_IN = 1;
- //! Animate the property so the speed increases until the end
- //! @since 1.0.0
- const ANIM_TYPE_EASE_OUT = 2;
- //! Animate the property so there is a initial speed up and slow down at the end
- //! @since 1.0.0
- const ANIM_TYPE_EASE_IN_OUT = 3;
- //! Key is pressed down
- //! @since 1.1.2
- const PRESS_TYPE_DOWN = 0;
- //! Key is released
- //! @since 1.1.2
- const PRESS_TYPE_UP = 1;
- //! Key action is performed
- //! @since 1.1.2
- const PRESS_TYPE_ACTION = 2;
- //! A quick press and release of the screen
- //! @since 1.0.0
- const CLICK_TYPE_TAP = 0;
- //! A press and hold of the screen
- //! @since 1.0.0
- const CLICK_TYPE_HOLD = 1;
- //! A release of a hold on the screen
- //! @since 1.0.0
- const CLICK_TYPE_RELEASE = 2;
- //! A swipe in the upward direction
- //! @since 1.0.0
- const SWIPE_UP = 0;
- //! A swipe towards the right
- //! @since 1.0.0
- const SWIPE_RIGHT = 1;
- //! A swipe in the downward direction
- //! @since 1.0.0
- const SWIPE_DOWN = 2;
- //! A swipe towards the left
- //! @since 1.0.0
- const SWIPE_LEFT = 3;
- //! @since 1.0.0
- const CONFIRM_NO = 0;
- //! @since 1.0.0
- const CONFIRM_YES = 1;
- //! A Float in meters
- //! @since 1.0.0
- const NUMBER_PICKER_DISTANCE = 0;
- //! A Duration
- //! @since 1.0.0
- const NUMBER_PICKER_TIME = 1;
- //! A Duration
- //! @since 1.0.0
- const NUMBER_PICKER_TIME_MIN_SEC = 2;
- //! A Duration representing the number of seconds since midnight
- //! @since 1.0.0
- const NUMBER_PICKER_TIME_OF_DAY = 3;
- //! A Float in kilograms
- //! @since 1.0.0
- const NUMBER_PICKER_WEIGHT = 4;
- //! A Float in meters
- //! @since 1.0.0
- const NUMBER_PICKER_HEIGHT = 5;
- //! A Number
- //! @since 1.0.0
- const NUMBER_PICKER_CALORIES = 6;
- //! A Number
- //! @since 1.0.0
- const NUMBER_PICKER_BIRTH_YEAR = 7;
- //! Transition for pushView/popView.
- //!
- //! No transition.
- //! @since 1.0.0
- const SLIDE_IMMEDIATE = 0;
- //! The View slides to the left.
- //! @since 1.0.0
- const SLIDE_LEFT = 1;
- //! The View slides to the right.
- //! @since 1.0.0
- const SLIDE_RIGHT = 2;
- //! The View slides down.
- //! @since 1.0.0
- const SLIDE_DOWN = 3;
- //! The View slides up.
- //! @since 1.0.0
- const SLIDE_UP = 4;
- //! Set a Drawable's locY property to this to align it to the top edge of the dc.
- //! @since 1.2.0
- const LAYOUT_VALIGN_TOP = -0x7FFFFFFF;
- //! Set a Drawable's locY property to this to align it to the bottom edge of the dc.
- //! @since 1.2.0
- const LAYOUT_VALIGN_BOTTOM = -0x7FFFFFFE;
- //! Set a Drawable's locY property to this to center it vertically in the dc.
- //! @since 1.2.0
- const LAYOUT_VALIGN_CENTER = -0x7FFFFFFD;
- //! Set the Drawable's locY property equal to it's parent's locY property.
- //! @since 1.2.0
- const LAYOUT_VALIGN_START = -0x7FFFFFFC;
- //! Set a Drawable's locX property to this to align it along the left edge of the
- //! dc.
- //! @since 1.2.0
- const LAYOUT_HALIGN_LEFT = -0x7FFFFFFF;
- //! Set a Drawable's locX property to this to align it along the right edge of the
- //! dc.
- //! @since 1.2.0
- const LAYOUT_HALIGN_RIGHT = -0x7FFFFFFE;
- //! Set a Drawable's locX property to this to center it horizontally in the dc.
- //! @since 1.2.0
- const LAYOUT_HALIGN_CENTER = -0x7FFFFFFD;
- //! Set a Drawable's locX property equal to it's parent's locX property.
- //! @since 1.2.0
- const LAYOUT_HALIGN_START = -0x7FFFFFFC;
- //! BehaviorDelegate handles behavior inputs. A BehaviorDelegate differs from an
- //! InputDelegate in that it acts upon device independent behaviours such as next
- //! page and previous page. On touch screen devices these behaviors might be mapped
- //! to the basic swipe left and right inputs, while on non-touch screen devices
- //! these behaviors might be mapped to actual keys. BehaviorDelegate extends
- //! InputDelegate so it can also act on basic inputs as well. If a BehaviorDelegate
- //! does return true for a function, indicating that the input was used, then the
- //! InputDelegate function that corresponds to the behavior will be called.
- //! @since 1.0.0
- //! @see InputDelegate
- class BehaviorDelegate extends InputDelegate {
- //! Constructor
- //! @since 1.0.0
- function initialize() {}
- //! This is the function that maps low level events to delegate events. DO NOT
- //! OVERRIDE.
- //! @since 1.0.0
- function handleEvent() {}
- //! When a back behavior occurs, onBack() is called.
- //! @since 1.0.0
- //! @return [Boolean] true if handled, false otherwise
- function onBack() {}
- //! When a menu behavior occurs, onMenu() is called.
- //! @since 1.0.0
- //! @return [Boolean] true if handled, false otherwise
- function onMenu() {}
- //! When a next mode behavior occurs, onNextMode() is called.
- //! @since 1.0.0
- //! @return [Boolean] true if handled, false otherwise
- function onNextMode() {}
- //! When a next page behavior occurs, onNextPage() is called.
- //! @since 1.0.0
- //! @return [Boolean] true if handled, false otherwise
- function onNextPage() {}
- //! When a previous mode behavior occurs, onPreviousMode() is called.
- //! @since 1.0.0
- //! @return [Boolean] true if handled, false otherwise
- function onPreviousMode() {}
- //! When a previous page behavior occurs, onPreviousPage() is called.
- //! @since 1.0.0
- //! @return [Boolean] true if handled, false otherwise
- function onPreviousPage() {}
- //! When the selection behavior occurs, onSelect() is called
- //! @since 1.2.0
- //! @return [Boolean] true if handled, false otherwise
- function onSelect() {}
- }
- //! Bitmap is the class representation of a bitmap resource. It is Created by the
- //! resource compiler.
- //! @since 1.0.0
- //! @see Drawable
- class Bitmap extends Drawable {
- //! Constructor
- //! @since 1.0.0
- //! @see Drawable#initialize
- //! @param [Dictionary] dictionary A Dictionary containing the settings
- //! @option [Symbol] :rezId The Rez identifier for the bitmap
- function initialize(dictionary) {}
- //! Draw the bitmap with draw().
- //! @since 1.0.0
- //! @param [Graphics.Dc] dc The device context
- function draw(dc) {}
- //! Get the dimensions of the bitmap with getDimensions().
- //! @since 1.0.0
- //! @return [Array] A two element array with the contents [width, height]
- function getDimensions() {}
- //! Use setBitmap() to set the resource associated with the Bitmap.
- //! @since 1.0.0
- //! @param [Symbol] rezId The Rez identifier for the bitmap
- function setBitmap(rezId) {}
- }
- //! BitmapResource is the class representation of a bitmap resource. Returned from
- //! WatchUi.loadResource().
- //! @since 1.0.0
- class BitmapResource {
- //! Use getHeight() to get the height of the bitmap.
- //! @since 1.0.0
- //! @return [Number] Height of bitmap
- function getHeight() {}
- //! Use getWidth() to get the width of the bitmap.
- //! @since 1.0.0
- //! @return [Number] Width of bitmap
- function getWidth() {}
- //! Use toString() to print info about this object.
- //! @since 1.0.0
- //! @return [String] A String representation of BitmapResource
- function toString() {}
- }
- //! ClickEvent is an object sent to InputDelegate when the user presses the touch
- //! screen.
- //! @since 1.0.0
- class ClickEvent {
- //! Constructor
- //! @since 1.0.0
- //! @param [Number] x The x-coordinate of the click
- //! @param [Number] y The y-coordinate of the click
- //! @param type The CLICK_TYPE for this event
- function initialize(x, y, type) {}
- //! Get the coordinates of the press with getCoordinates
- //! @since 1.0.0
- //! @return [Array] The press coordinates as an array of [x, y]
- function getCoordinates() {}
- //! Get the type of click event.
- //! @since 1.0.0
- //! @return The WATCH_UI.CLICK_TYPE_* value
- function getType() {}
- }
- //! This is the on-screen representation of the confirmation dialog. The
- //! look-and-feel will be device specific. Confirmations are pushed using
- //! WatchUi.pushView(), providing a ConfirmationDelegate for the input delegate.
- //! @since 1.0.0
- class Confirmation {
- //! Constructor
- //! @since 1.0.0
- //! @param [String] message A textual confirmation message
- function initialize(message) {}
- }
- //! ConfirmationDelegate handles a response being chosen in the Confirmation.
- //! @since 1.0.0
- class ConfirmationDelegate {
- //! When a response is chosen, onResponse() is called, passing the response of
- //! CONFIRM_NO or CONFIRM_YES
- //! @since 1.0.0
- //! @param response The response of the confirmation of CONFIRM_NO or CONFIRM_YES
- function onResponse(response) {}
- }
- //! The DataField class is used for creating data fields. In a DataField, the
- //! developer will implement a compute method, which is called by the system once
- //! per second, with an Activity.Info object. The system will call the onUpdate()
- //! method inherited from View when the field is displayed by the system.
- //! @since 1.0.0
- //! @device All devices
- class DataField extends View {
- //! Some of the left edge of the device context is obscured
- //! @since 1.0.0
- const OBSCURE_LEFT = 1;
- //! Some of the top edge of the device context is obscured
- //! @since 1.0.0
- const OBSCURE_TOP = 2;
- //! Some of the right edge of the device context is obscured
- //! @since 1.0.0
- const OBSCURE_RIGHT = 4;
- //! Some of the bottom edge of the device context is obscured
- //! @since 1.0.0
- const OBSCURE_BOTTOM = 8;
- //! Constructor
- //! @since 1.0.0
- function initialize() {}
- //! To retrieve Activity.Info data for DataFields, it is necessary to override
- //! compute(). This is the method that is called to update the field information.
- //! @since 1.0.0
- //! @param [Activity.Info] info The updated Activity.Info object
- function compute(info) {}
- //! Returns the current background color for data fields, which is either
- //! Graphics.COLOR_WHITE or Graphics.COLOR_BLACK
- //! @since 1.2.0
- //! @return [Number] the current background color for data fields, which is either Graphics.COLOR_WHITE or Graphics.COLOR_BLACK
- function getBackgroundColor() {}
- //! Returns mask of OBSCURE_X values giving the sides of the display that that are
- //! obscured by a round screen. Valid during onUpdate.
- //! @since 1.0.0
- //! @return [Number] mask of OBSCURE_X values giving the sides of the display that that are obscured by a round screen. Valid during onUpdate.
- function getObscurityFlags() {}
- }
- //! A Drawable is the base class of a drawable object. A Drawable can be constructed
- //! using the resource compiler and loaded through the Rez module.
- //! @since 1.0.0
- class Drawable {
- //! The clip height
- //! @since 1.0.0
- //! @return [Number]
- var height;
- //! The id used to identify the Drawable
- //! @since 1.0.0
- //! @return [String]
- var identifier;
- //! The absolute screen x-coordinate
- //! @since 1.0.0
- //! @return [Number]
- var locX;
- //! The absolute screen y-coordinate
- //! @since 1.0.0
- //! @return [Number]
- var locY;
- //! The clip width
- //! @since 1.0.0
- //! @return [Number]
- var width;
- //! Constructor
- //! @since 1.0.0
- //! @param [Dictionary] dictionary A Dictionary containing the settings
- //! @option [String] :identifier The identifier for the Drawable
- //! @option [Number] :locX The absolute screen x-coordinate for the Drawable
- //! @option [Number] :locY The absolute screen y-coordinate for the Drawable
- //! @option [Number] :width The clip width of the Drawable
- //! @option [Number] :height The clip height of the Drawable
- function initialize(dictionary) {}
- //! Draw the object to the display context with draw(). Assume that the device
- //! context has already been configured to the proper settings.
- //! @since 1.0.0
- //! @param [Graphics.Dc] dc The device context
- function draw(dc) {}
- //! Set the location for this Drawable object with setLocation().
- //! @since 1.0.0
- //! @param [Number] x Horizontal position on the screen
- //! @param [Number] y Vertical position on the screen
- function setLocation(x, y) {}
- //! Set the size of this Drawable object with setSize().
- //! @since 1.0.0
- //! @param [Number] w Width of the Drawable object
- //! @param [Number] h Height of the Drawable object
- function setSize(w, h) {}
- }
- //! FontResource is the class representation of a font resource. Returned from
- //! WatchUi.loadResource().
- //! @since 1.0.0
- class FontResource {
- }
- //! InputDelegate handles basic input events. There are three types of basic inputs:
- //! key, touch, and swipe.
- //! @since 1.0.0
- class InputDelegate {
- //! This is the function that maps low level events to delegate events. DO NOT
- //! OVERRIDE.
- //! @since 1.0.0
- function handleEvent() {}
- //! When a screen hold event occurs, onHold() is called. This is sent if user
- //! touches and holds on the screen.
- //! @since 1.0.0
- //! @param [ClickEvent] evt A ClickEvent object containing information about the hold
- //! @return [Boolean] true if handled, false otherwise
- function onHold(evt) {}
- //! When a hard key is pressed, onKey() is called.
- //! @since 1.0.0
- //! @param [KeyEvent] evt The KeyEvent that occured. Call evt.getKey() to get the WatchUi.KEY_* enum value.
- //! @return [Boolean] true if handled, false otherwise
- function onKey(evt) {}
- //! When a hard key is pressed down, onKeyPressed() is called.
- //! @since 1.1.2
- //! @param [KeyEvent] evt The KeyEvent that occured. Call evt.getKey() to get the WatchUi.KEY_* enum value.
- //! @return [Boolean] true if handled, false otherwise
- function onKeyPressed(evt) {}
- //! When a hard key is released, onKeyReleased() is called.
- //! @since 1.1.2
- //! @param [KeyEvent] evt The KeyEvent that occured. Call evt.getKey() to get the WatchUi.KEY_* enum value.
- //! @return [Boolean] true if handled, false otherwise
- function onKeyReleased(evt) {}
- //! When a screen release event occurs, onRelease() is called. This is only sent
- //! after an onHold event when the user stops touching the screen.
- //! @since 1.0.0
- //! @param [ClickEvent] evt A ClickEvent object containing information about the release
- //! @return [Boolean] true if handled, false otherwise
- function onRelease(evt) {}
- //! When a swipe event occurs, onSwipe() is called. This is sent when the user
- //! swipes the screen.
- //! @since 1.0.0
- //! @param [SwipeEvent] evt A SwipeEvent object containing information about the swipe
- //! @return [Boolean] true if handled, false otherwise
- function onSwipe(evt) {}
- //! When a screen tap event occurs, onTap() is called. This is sent if the user taps
- //! (quickly presses and releases) the screen.
- //! @since 1.0.0
- //! @param [ClickEvent] evt A ClickEvent object containing information about the tap
- //! @return [Boolean] true if handled, false otherwise
- function onTap(evt) {}
- }
- //! KeyEvent is an object sent to InputDelegate when a hard key is pressed on the
- //! device.
- //! @since 1.0.0
- class KeyEvent {
- //! Constructor
- //! @since 1.0.0
- //! @param keyValue A Toybox.WatchUi.KEY_* value
- //! @param keyPressType The PRESS_TYPE for this event (since 1.1.2)
- function initialize(keyValue, keyPressType) {}
- //! Use getKey() to get the key value of this event.
- //! @since 1.0.0
- //! @return A Toybox.WatchUi.KEY_* value
- function getKey() {}
- //! Get the type of click event.
- //! @since 1.1.2
- //! @return The WATCH_UI.PRESS_TYPE_* value
- function getType() {}
- }
- //! Menu is a representation of an on-screen menu. The look-and-feel of the menu
- //! will be device specific. It presents the user with a list of options and after
- //! the user chooses one, the registered MenuInputDelegate.onMenuItem() will be
- //! called. While a Menu can be generated programatically, in general they should be
- //! created as a resource. Menus are pushed using WatchUi.pushView(), providing a
- //! MenuInputDelegate for the input delegate.
- //! @since 1.0.0
- class Menu {
- //! The maximum number of entries in a Menu
- //! @since 1.0.0
- const MAX_SIZE = 16;
- //! Add an entry to a Menu with addItem().
- //! @since 1.0.0
- //! @param [String] name The item text or the Rez ID of a string resource
- //! @param [Symbol] id A symbol representing the Menu item value
- function addItem(name, id) {}
- //! Set a title for the menu.
- //! @since 1.0.0
- //! @param [String] title The title text or the Rez ID of a string resource
- function setTitle(title) {}
- }
- //! MenuInputDelegate responds to a Menu selection. This class should be extended to
- //! get the chosen Menu item.
- //! @since 1.0.0
- class MenuInputDelegate {
- //! When a Menu item is chosen, onMenuItem() is called.
- //! @since 1.0.0
- //! @param [Symbol] item The id of the chosen Menu item
- function onMenuItem(item) {}
- }
- //! @deprecated The NumberPicker class will be dropped in Connect IQ 3.0.0
- //! The NumberPicker class will be dropped in Connect IQ 3.0.0
- //!
- //! This is the
- //! on-screen representation of number picker. The look-and-feel will be device
- //! specific. NumberPickers are pushed using WatchUi.pushView(), providing a
- //! NumberPickerDelegate for the input delegate. There are minimum and maximum
- //! values enforced by the product for each mode. The initial value will be modified
- //! to be within these bounds.
- //! @since 1.0.0
- class NumberPicker {
- //! Constructor
- //! @since 1.0.0
- //! @param mode An enum value of type NUMBER_PICKER_*
- //! @param initialValue The initial value for the Number Picker, type depends on mode
- function initialize(mode, initialValue) {}
- }
- //! @deprecated The NumberPickerDelegate class will be dropped in Connect IQ 3.0.0
- //! The NumberPickerDelegate class will be dropped in Connect IQ
- //! 3.0.0
- //!
- //! NumberPickerDelegate responds to a number being chosen. This class should
- //! be extended to get the chosen number.
- //! @since 1.0.0
- class NumberPickerDelegate {
- //! When a number is chosen, onNumberPicked() is called, passing the chosen value.
- //! @since 1.0.0
- //! @param value The chosen number, type depends on the NumberPicker mode
- function onNumberPicked(value) {}
- }
- //! This is the on-screen representation of a generic picker. The look-and-feel will
- //! be device specific, although every device will have the same general layout. A
- //! Picker will consist of one or more choosable objects, a title, a next and
- //! previous arrow, and a confirm button. The next and previous arrows and the
- //! confirm button are device specific but can be overwritten if desired. Pickers
- //! are pushed using WatchUi.pushView(), providing a PickerDelegate for the input
- //! delegate. A PickerFactory is required to indicate what should be displayed for
- //! each pickable value.
- //!
- //! A Picker uses a PickerFactory to decide what to display to
- //! the user. It is capable of displaying any number of entries for the user to
- //! choose from. For instance, if the PickerFactory was [new NumberFactory(), new
- //! Ui.Text(:text=>“-”), new NumberFactory()] then the Picker will have three
- //! entries: a choosable number, a non-choosable “-”, and another choosable number.
- //! @since 1.2.0
- class Picker extends View {
- //! Constructor
- //! @since 1.2.0
- //! @param [Dictionary] options @see Picker#setOptions
- function initialize(options) {}
- //! Set the options for the Picker.
- //! @since 1.2.0
- //! @param [Dictionary] options the options for the Picker
- //! @option [Drawable] :title the title for the Picker. Required.
- //! @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.
- //! @option [Array] :defaults an Array of [Number] indicating the starting index for each entry in :pattern. Optional.
- //! @option [Drawable] :nextArrow a custom next icon for the Picker. Optional.
- //! @option [Drawable] :previousArrow a custom previous icon for the Picker. Optional.
- //! @option [Drawable] :confirm a custom confirm icon for the Picker. Optional.
- function setOptions(options) {}
- }
- //! PickerDelegate responds to a confirm or cancel. The Picker does not
- //! automatically call popView. event from a [Picker].
- //! @since 1.2.0
- class PickerDelegate {
- //! Handle a confirm event from a [Picker]
- //! @since 1.2.0
- //! @param [Array] values The chosen values from the Picker. For [Drawable] entries, null will be returned for that value.
- function onAccept(values) {}
- //! Handle a cancel event from a [Picker]
- //! @since 1.2.0
- function onCancel() {}
- }
- //! A PickerFactory is used by a Picker to display Drawables to be chosen.
- //! @since 1.2.0
- class PickerFactory {
- //! Generate a Drawable instance for a given item
- //! @since 1.2.0
- //! @param [Number] item Item index
- //! @param [Boolean] isSelected true if the current item is the selected item, false otherwise
- //! @return [Drawable] object to be rendered
- function getDrawable(item, isSelected) {}
- //! Get the number of items in the factory
- //! @since 1.2.0
- //! @return [Number] number of items in the factory
- function getSize() {}
- //! Return a representative value for this item
- //! @since 1.2.0
- //! @param [Number] item Item index
- //! @return [Object] Representative item for the given index
- function getValue(item) {}
- }
- //! This is the on-screen representation of a progress bar. The look-and-feel will
- //! be device specific. ProgressBars are pushed using WatchUi.pushView(), providing
- //! either null or a behavior delegate. If a behavior delegate is provided, the
- //! onBack method will be called if the user presses the back button from the
- //! progressBar view. This can display a string and either a progress bar from
- //! 0-100% or a busy bar.
- //! @since 1.0.0
- class ProgressBar {
- //! Constructor
- //! @since 1.0.0
- //! @param [String] displayString The string to display on the progress bar view
- //! @param [Float] startValue The initial value for the progress bar (0-100), null for “busy”
- function initialize(displayString, startValue) {}
- //! Use setDisplayString() to set the string displayed on the progress bar view.
- //! @since 1.0.0
- //! @param [String] displayString The string to display on the progress bar view
- function setDisplayString(displayString) {}
- //! Use setProgress() to set the value of the progress bar.
- //! @since 1.0.0
- //! @param [Float] progressValue The value for the progress bar (0-100), null for “busy”
- function setProgress(progressValue) {}
- }
- //! The SimpleDataField class is used for creating simple data fields. In a
- //! SimpleDataField, the developer is only required to implement a compute method.
- //! The compute method is passed an Activity.Info object, which contains all current
- //! workout information. The compute method should return a value to be displayed.
- //! Allowed types are Number, Float, Long, Double, Duration, and String. The
- //! SimpleDataField also contains a variable “label”. This variable should be
- //! assigned to a String label for the field.
- //! @since 1.0.0
- //! @device All devices
- class SimpleDataField extends DataField {
- //! @since 1.0.0
- var label;
- //! Constructor
- //! @since 1.0.0
- function initialize() {}
- //! To retrieve Activity.Info data for DataFields, it is necessary to override
- //! compute(). This is the method that is called to update the field information.
- //! @since 1.0.0
- //! @param [Activity.Info] info The updated Activity.Info object
- function compute(info) {}
- }
- //! SwipeEvent is an object sent to InputDelegate when the user swipes the touch
- //! screen.
- //! @since 1.0.0
- class SwipeEvent {
- //! Constructor
- //! @since 1.0.0
- //! @param direction The WatchUi.SWIPE_* value
- function initialize(direction) {}
- //! Get the direction of the swipe with getDirection().
- //! @since 1.0.0
- //! @return The WatchUi.SWIPE_* value
- function getDirection() {}
- }
- //! Text is the class representation of text from the resource compiler.
- //! @since 1.0.0
- //! @see Drawable
- class Text extends Drawable {
- //! Constructor
- //! @since 1.0.0
- //! @see Drawable#initializes
- //! @param [Dictionary] dictionary A Dictionary containing the settings
- //! @option [Object] :text The text string or the Rez ID of a string resource
- //! @option [Object] :color The text color of type Graphics.COLOR_*
- //! @option [Object] :font The font to use of type Graphics.FONT_*
- //! @option [Object] :justification The text justification of type Graphics.TEXT_JUSTIFY_*
- function initialize(dictionary) {}
- //! Draw the Text resource with draw().
- //! @since 1.0.0
- //! @param [Graphics.Dc] dc The draw context
- function draw(dc) {}
- //! Use setColor() to set the text color.
- //! @since 1.0.0
- //! @param color The text color of type Graphics.COLOR_*
- function setColor(color) {}
- //! Use setFont() to set the text font.
- //! @since 1.0.0
- //! @param font The font to use of type Graphics.FONT_* or from WatchUi.loadResource()
- function setFont(font) {}
- //! Use setJustification() to set the text justification.
- //! @since 1.0.0
- //! @param justification The text justification of type Graphics.TEXT_JUSTIFY_*
- function setJustification(justification) {}
- //! Use setText() to set the text string.
- //! @since 1.0.0
- //! @param [String] text The text string or the Rez ID of a string resource
- function setText(text) {}
- }
- //! This is the on-screen representation of text picker. The look-and-feel will be
- //! device specific. TextPickers are pushed using WatchUi.pushView(), providing a
- //! TextPickerDelegate for the input delegate. A default value can be provided and
- //! will be displayed as editable text with the cursor at the end.
- //! @since 1.1.0
- //! @device Forerunner 920XT
- //! @device fenix 3
- //! @device epix
- class TextPicker {
- //! Constructor
- //! @since 1.1.0
- //! @param initialText The initial text for the Number Picker, type depends on mode
- function initialize(initialText) {}
- }
- //! TextPickerDelegate responds to text being entered This class should be extended
- //! to get the chosen text.
- //! @since 1.1.0
- //! @device Forerunner 920XT
- //! @device fenix 3
- //! @device epix
- class TextPickerDelegate {
- //! When the user cancels entering text, onCancel() is called.
- //! @since 1.1.0
- function onCancel() {}
- //! When text is entered, onTextEntered() is called, passing the entered text.
- //! @since 1.1.0
- //! @param [String] text The entered text
- //! @param [Boolean] changed If the entered text was modified
- function onTextEntered(text, changed) {}
- }
- //! View is the base class for a drawable page. It handles the lifecycle of each
- //! View in an app. For widgets and watch-apps the lifecyle is onStart(),
- //! onLayout(), onShow(), onUpdate() and onHide(). For watchfaces and datafields the
- //! lifecycle is onLayout(), onShow() and onUpdate(). For datafields, if the size
- //! changed since the last onUpdate(), onLayout() will be called prior to
- //! onUpdate(). SimpleDataField objects don't have the same life cycle. onLayout(),
- //! onShow(), and onUpdate() aren't called for SimpleDataField objects.
- //! @since 1.0.0
- class View {
- //! Find a Drawable by its ID.
- //! @since 1.0.0
- //! @param [String] id The ID of the Drawable to find
- //! @return [WatchUi.Drawable] The Drawable if found, null otherwise
- function findDrawableById(id) {}
- //! Before the View is removed from the foreground, onHide() is called. Here you
- //! should free resources from memory if you are planning on leaving this view on
- //! the page stack.
- //! @since 1.0.0
- function onHide() {}
- //! The entry point for the View is onLayout(). This is called before the View is
- //! shown to load resources and set up the layout of the View.
- //! @since 1.0.0
- //! @param [Graphics.Dc] dc The drawing context
- //! @return [Boolean] true if handled, false otherwise
- function onLayout(dc) {}
- //! When the View is brought into the foreground, onShow() is called. This is where
- //! you should load resources into system memory for use in this view.
- //! @since 1.0.0
- //! @return [Boolean] true if handled, false otherwise
- function onShow() {}
- //! When a View is active, onUpdate() is used to update dynamic content. This
- //! function is called when the View is brought to the foreground. For widgets and
- //! watch-apps it is also called when WatchUi.requestUpdate() is called. For
- //! watchfaces it is called once a minute and for datafields it is called once a
- //! second. If a class that extends View does not implement this function then any
- //! Drawables contained in the View will automatically be drawn.
- //! @since 1.0.0
- //! @param [Graphics.Dc] dc The drawing context
- //! @return [Boolean] true if handled, false otherwise
- function onUpdate(dc) {}
- //! Use setLayout() to set the layout for the View. If the extending class does not
- //! override onUpdate(), then all Drawables contained in layout will automatically
- //! be drawn by the View.
- //! @since 1.0.0
- //! @param [Layout] layout An array of Drawables
- function setLayout(layout) {}
- }
- //! The WatchFace class is used for creating watch faces that support
- //! exiting/entering low power mode. The developer will use the WatchFace View to
- //! tie in to gestures. This will enable the watchface to update at a faster rate
- //! than once a minute when the user has brought the watch “up”, presumably to look
- //! at it. “Sleep” will be entered when the user looks away (lowers the watch) or
- //! the watch times out and automatically reenters sleep.
- //! @since 1.0.0
- class WatchFace extends View {
- //! Constructor
- //! @since 1.0.0
- function initialize() {}
- //! onEnterSleep() is called when the watch is entering sleep mode. Terminate any
- //! active timers and prepare for slow updates.
- //! @since 1.0.0
- function onEnterSleep() {}
- //! onExitSleep() is called when the watch is exiting sleep mode. Timers and
- //! animations may be started here.
- //! @since 1.0.0
- function onExitSleep() {}
- }
- //! Use animate() to animate a property over a given period of time. The animation
- //! starts after the call and runs the length of the specified period. During this
- //! time the View's draw callback will be called.
- //! @since 1.0.0
- //! @param [Drawable] drawable Drawable to animate
- //! @param [Symbol] property Symbol of property to animate over time
- //! @param type Toybox.WatchUi.ANIM_TYPE_* value
- //! @param [Number] start Initial value of property
- //! @param [Number] stop Final value of property after animation
- //! @param [Float] period Time in seconds for animation to run
- //! @param [Method] callback Method object to call when complete, or null
- function animate(drawable, property, type, start, stop, period, callback) {}
- //! @since 1.0.0
- function initResources() {}
- //! Load a resource from the executable with loadResource().
- //! @since 1.0.0
- //! @param [Symbol] resource Rez identifier from resources.xml to load
- //! @return A Font, Bitmap, or String resource
- function loadResource(resource) {}
- //! Pop a View from the View stack with popView().
- //! @since 1.0.0
- //! @param transition View transition of type SLIDE_*
- function popView(transition) {}
- //! Push a View onto the View stack with pushView().
- //! @since 1.0.0
- //! @param [View] view View to push
- //! @param delegate The input delegate to handle input for the View
- //! @param transition View transition of type SLIDE_*
- function pushView(view, delegate, transition) {}
- //! Use requestUpdate() to request that onUpdate() method be called for the current
- //! View.
- //! @since 1.0.0
- function requestUpdate() {}
- //! Use switchToView() to pop the current View and push the new one. Native views
- //! (e.g. progress bars, confirmation dialogues, number pickers, etc.) may not be
- //! passed as an input parameter. switchToView() only supports switching to
- //! non-native views.
- //! @since 1.0.0
- //! @param [View] view View object to push
- //! @param delegate the input delegate to handle input for the View
- //! @param transition View transition of type SLIDE_*
- function switchToView(view, delegate, transition) {}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment