csafe_fitness library

Support for doing something awesome.

More dartdocs go here.

Classes

ByteSerializable
A simple interface representing anything that can be turned into bytes
Csafe
CsafeCmdSetDate
Set current date.
CsafeCmdSetHorizontal
Horizontal distance goal
CsafeCmdSetPower
Power goal
CsafeCmdSetProgram
Machine program and level
CsafeCmdSetTime
Set current time of day
CsafeCmdSetWorkoutTime
Set Workout time goal
CsafeCmdUserCfg1
Server depended configuration information
CsafeCommand
Represents a CSAFE command with all the parameters needed to send to a device
CsafeCommandIdentifier
A CSAFE identifier byte representing a particular command
CsafeCommandResponse
Represents the response to one or many CSAFE commands
CsafeDataStructure
Represents a structure containing an identifier (command), and a single data element with a known length.
CsafeIntegerWithUnits
Represents a "Integer plus Unit specifier" type from the CSAFE spec
CsafeStatus
Represents a CSAFE status byte
IntegerWithUnits<T>
Represents an Integer with an associated unit.

Enums

CsafeCommandType
CsafePreviousFrameState
CsafeServerState
CsafeUnits
UnitType
An emum used to designate which type of number a particular unit is for unit conversion purposes.

Properties

cmdGoFinished CsafeCommand
go to Finished State
getter/setter pair
cmdGoIdle CsafeCommand
go to Idle State, reset variables to Idle state
getter/setter pair
cmdGoInUse CsafeCommand
go to InUse State
getter/setter pair
cmdGoReady CsafeCommand
go to Ready State
getter/setter pair

Functions

validate(bool condition(ByteSerializable), Error error(ByteSerializable)) Validator
Creates a validator function
validateBoolean() Validator
Shortcut for a validator to assert that the data is a single byte equal to 1 or 0
validateCsafeDate() Validator
Shortcut for a validator to assert that the data represents a CsafeDate
validateCsafeTime() Validator
Shortcut for a validator to assert that the data represents a CsafeTime
validateLength(int expectedLength) Validator
Shortcut for a validator to assert that the data has a specific length
validateTimeValue(int minSeconds, int maxSeconds) Validator
Shortcut for a validator that ensures that a time is within certain bounds
validateType<T>() Validator
Shortcut for a validator to assert that the data has a specific type
validateUnitType(UnitType expectedType) Validator
Shortcut for a validator to assert that the data is a unit with a specific type (i.e. distance, force)

Typedefs

Validator = bool Function(ByteSerializable, {bool shouldThrow})
An alias to describe functions that take in a ByteSerializable and perform some validation check on it