Set alarm command
Alarm clock model description
- IDOSetAlarmInfoBluetoothModel
Parameter | Description | Remark |
---|---|---|
isOpen | Alarm is on | bool |
isSync | Whether to sync to the bracelet | No assignment is required, the alarm will be automatically assigned after the alarm is set successfully |
isDelete | Delete or not | DefaultYES |
type | Type | 0:Get up, 1:Sleep, 2:Exercise, 3:Take medicine, 4:Dating, 5:Reunion, 6:Meeting,7:Other
8:Eat, 9:Brush teeth,10 :Rest 11 : Course 12: Shower 13:Study 14: Play 42:Custom name |
hour | 分 | int |
minute | Second | int |
repeat | Repeat set | [Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday] |
tsnoozeDuration | Snooze duration | int |
alarmId | AlarmID | int |
setTimeStamp | The timestamp of the alarm modification | No assignment is required, it will be automatically assigned after the alarm is set successfully |
repeatTime | Repeat alarm times Repeat alarm times | v3 alarm clock only works |
shockOnOff | Vibration switch | v3 alarm clock only works |
delayMinute | Delay minutes | v3 alarm clock only works |
alarmName | alarm clock name | The length is limited to 23 bytes, and the v3 alarm clock is valid |
- IDOSetExtensionAlarmInfoBluetoothModel
Parameter | Description | Remark |
---|---|---|
alarmVersion | Alarm version number | int |
alarmCount | Number of alarm clocks | int |
items | Alarm clock collection | Initialize the bracelet alarm when syncing the configuration |
Command code
- Set v2 alarm
Objc:
//All alarms
NSArray * alarms = [IDOSetAlarmInfoBluetoothModel queryAllAlarms];
//Unfired or deleted alarms
NSArray * alarms = [IDOSetAlarmInfoBluetoothModel queryAllNoOpenAlarms];
[IDOFoundationCommand setAllAlarmsCommand:alarms
callback:^(int errorCode) {
if (errorCode == 0) {
//Set successfully
}else if (errorCode == 6) {
//Device not supported
}else {
//Setup failed
}
}];
Swift:
let alarms = IDOSetAlarmInfoBluetoothModel.queryAllAlarms();
let alarms = IDOSetAlarmInfoBluetoothModel.queryAllNoOpenAlarms();
IDOFoundationCommand.setAllAlarms(alarms) { (errorCode) in
if errorCode == 0 {
//Set successfully
}else if errorCode == 6{
//Device does not support this method
}else {
//Wrong setting
}
};
- Set v3 alarm
Objc:
IDOSetExtensionAlarmInfoBluetoothModel * alarmModel = [IDOSetExtensionAlarmInfoBluetoothModel currentModel];
[IDOFoundationCommand setV3AllAlarmsCommand:alarmModel callback:^(int errorCode) {
if (errorCode == 0) {
//Set successfully
}else if (errorCode == 6) {
//Device not supported
}else {
//Setup failed
}
}];
Swift:
let model = IDOSetExtensionAlarmInfoBluetoothModel.current();
IDOFoundationCommand.setV3AllAlarms(model) { (errorCode) in
if errorCode == 0 {
//Set successfully
}else if errorCode == 6{
//Device does not support this method
}else {
//Wrong setting
}
};