AM6
info
- AM6 is a low-power activity tracker. It can track activity, sleep, heart rate and Blood oxygen.
- First use requires charging until the dial of watch displays a QR code.
- After the user successfully bound, AM6 will enter the dial activity UI, if the user unbound will return to the QR code UI.
Connection to device
1.Listen to device notify and init
/**
AM6Discover
{
BindStatus = 0; //0: The watch is not bound (QR code state) 1: The watch is bound (normal state)
DeviceName = "AM6 1BD2DB";
RSSI = "-64";
SerialNumber = 004D321BD2DB;
}
*/
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceDiscover:) name:AM6Discover object:nil];
/**
AM6ConnectFailed
{
AM6ConnectErrorID = 0;
DeviceName = AM6;
ProtocolString = "com.jiuan.AM6V10";
SerialNumber = 004D321BD2DC;
}
typedef NS_ENUM(NSUInteger, AM6DeviceConnectError) {
/// Communication error
AM6DeviceConnectError_OverTime = 0,
/// You did not receive a response within a certain period of time, usually clogged Bluetooth
AM6DeviceConnectError_NoRespond,
AM6DeviceConnectError_AuthError,
AM6DeviceConnectError_AuthKeyError,
AM6DeviceConnectError_SystemError,//AM6SystemErrorDetail If this error occurs, you can read detailed system error information
/// AM disconnect
AM6DeviceConnectError_Disconnect,
};
*/
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceConnectFail:) name:AM6ConnectFailed object:nil];
/**
AM6ConnectNoti
{
DeviceName = AM6;
ID = "0A757F50-1508-A265-FCC6-8278888FDC4F";
ProtocolString = "com.jiuan.AM6V10";
SerialNumber = 004D321BD2DE;
}
*/
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceConnect:) name:AM6ConnectNoti object:nil];
/**
AM6DisConnectNoti
{
DeviceName = AM6;
ProtocolString = "com.jiuan.AM6V10";
SerialNumber = 004D321BD2DE;
}
*/
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(DeviceDisConnect:) name:AM6DisConnectNoti object:nil];
/**
Please initialize the Am6 configuration before scanning the device, otherwise the connection cannot be successfully scanned.
*/
[[AM6Controller shareAM6Controller] configAM6DeviceBleParameters];
2.Scan for AM6 devices
[[ScanDeviceController commandGetInstance] commandScanDeviceType:HealthDeviceType_AM6];
3.Connect to AM6 devices
///deviceMac is the mac of Am6, which can be obtained from the successful connection notification dictionary key is SerialNumber,
[[ConnectDeviceController commandGetInstance] commandContectDeviceWithDeviceType:HealthDeviceType_AM6 andSerialNub:deviceMac];
API reference
How to bind user with AM6
info
- AM6 is used for the first time or is in an unbound state, and AM6 displays a QR code.
- Call the API sendStartBindWithSuccess, AM6 enters the binding state.
- Call the API sendSuccessBindWithUserId and pass user id to AM6, AM6 will save user id, and then wiil display UI of successful binding.
- Call the API sendFailBindWithSuccess, AM6 will display UI of failure binding, and then fall back to UI of QR code.
Bind user
Am6 enters the binding state.
/**
* App sends StartBind to device
*@param success After calling this API, AM6 will display the pairing interface
*@param fail fail
*/
- (void)sendStartBindWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Bind user success
/**
* The app sends the binding success to the device
*@param userId we recommend use user id's md5-16 value, 16 bytes length
*@param success After calling this API, AM6 will display the binding successful interface
*@param fail fail
*/
- (void)sendSuccessBindWithUserId:(NSData*)userId
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Bind user fail
/**
* The app sends the binding fail to the device
*@param success After calling this API, AM6 will display the binding fail interface
*@param fail fail
*/
- (void)sendFailBindWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Unbind user
/**
* App sends unbind to device
*@param userId we recommend use user id's md5-16 value, 16 bytes length
*@param success success
*@param fail fail
*/
- (void)sendUnbindWithUserId:(NSData*)userId
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
How to get started with AM6
Get AM6 information and sync time
/**
* Query device information and synchronize time to the device
*
*The device must call this API every time it is connected, so that the latest time can be synchronized to AM6.
*
*@param success You can get data by reading: battery, isCharging,firmwareVersion,sdkFirmwareVersion,hardwareVersion,bindStatus
*{
* battery = 100; Power 0-100
* isCharging = 0; 0:NO Charging 1:Charging
* firmwareVersion = "0.1.1"; FirmwareVersion
* hardwareVersion = "1.0.0"; HardwareVersion
* sdkFirmwareVersion = "1.0.0"; sdkFirmwareVersion
* bindStatus = 1; 0: The watch is not bound (QR code state) 1: The watch is bound (normal state)
}
*@param fail fail
*/
- (void)queryDeviceInfoAndSyncTimeWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Set user information of the device
/**
* Set user info
* Setting user information to AM6 is to calculate parameters such as step length, exercise sleep and so on.
*@param userId we recommend use user id's md5-16 value, 16 bytes length
*@param gender 0: male 1: female
*@param age age
*@param height height, in cm 1-255(Please set strictly according to this range, and the data beyond the range will be assigned according to the upper and lower limits.)
*@param weight Weight, in kg 1-300(Please set strictly according to this range, and the data beyond the range will be assigned according to the upper and lower limits.)
*@param success success
*@param fail fail
*/
- (void)setUserInfoWithUserIdMD5:(NSData*)userId
gender:(uint8_t)gender
age:(uint8_t)age
height:(uint8_t)height
weight:(double)weight
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
## Set Notification
:::info
Before setting nofication information, please set the mobile platform type.
:::
### Set phone platform
```java
/**
* Set platform to iOS
* @param success The platform is set so that AM6 can normally receive notifications on the phone.After calling this API, the system will pop up a pop-up window asking whether to pair uniformly. If you choose to agree, then AM6 will perform Bluetooth pairing with the mobile phone, and next time AM6 will automatically connect to the mobile phone via Bluetooth. If you choose not to agree, then the AM6 and mobile phone Bluetooth will not be automatically connected.
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)setPlatformWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Query notification switch
/**
* Query notification switch
* @param success notificationEnable 0:close 1:open
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)queryNotificationStateWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Set notification switch
/**
* Set notification switch
* @param enable YES:open NO:close
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)setNotificationStatus:(BOOL)enable
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Query whether ANCS has been authorized(Only in iOS)
/**
* Query whether ANCS has been authorized
*
*The purpose of Apple Notification Center Service (ANCS) is to provide a simple and convenient way for Bluetooth peripherals to obtain notification information of ios devices.
*
*If the query authorization is turned off, it will affect your normal receiving notifications.
*/
- (BOOL)queryAncsAuthorizedStatus NS_AVAILABLE_IOS(13);
Device settings
Find device
/**
* findDevice
* @param flag 0: start 1: end
* @param success If you call the search device interface, AM6 will keep vibrating
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)findDevice:(uint8_t)flag
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Find phone
info
When the mobile phone is connected, click AM6 to find the function of the mobile phone, and the SDK will receive the message.
/**
*Start FindPhone
*
*If you want to use this feature, please listen to this notification:
*
*AM6StartFindPhoneNoti
*
*/
/**
* Stop FindPhone
*
*If you want to use this feature, please listen to this notification:
*
*AM6StopFindPhoneNoti
*
*/
Reboot device
info
After calling this API, AM6 will be disconnected.
/**
* rebootDevice
* @param success Call this API, AM6 will disconnect from the phone and restart
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)rebootDeviceWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Set wearing hand
/**
* setWearHand
* @param hand 0x00: left 0x01: right
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)setWearHand:(uint8_t)hand
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Get wearing hand
/**
* queryWearHand
* @param success wristHand: 0 left 1 right
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)queryWearHandWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Set target reminder
/**
* setGoalReminder
* @param enable YES:open,NO:close
* @param calorie Calorie Goal (0-65535 Cal)
* @param steps step goal(0-65534)
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)setGoalReminderEnable:(BOOL)enable
calorie:(uint32_t)calorie
steps:(uint32_t)steps
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Get target reminder
/**
* queryGoalReminder
* @param success : isActivityGoalOn(YES or NO),caloGoal,stepsGoal
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)queryGoalReminderWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Set sedentary reminder
/**
* setStretchReminder
* @param enable YES:open,NO:close
* @param start Minute to start (24-hour format, minimum 0 minutes)
* @param end Ending minute (24-hour format, max 1439 minutes)
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)setStretchReminderEnable:(BOOL)enable
start:(NSInteger)start
end:(NSInteger)end
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Get sedentary reminder
/**
* queryStretchReminder
* @param success : isStretchReminderOn(YES or NO) ,stretchReminderStartTime(24-hour format, minimum 0 minutes),stretchReminderEndTime((24-hour format, max 1439 minutes)
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)queryStretchReminderWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Set raise to light
/**
* setRaiseWake
* @param enable YES:open,NO:close
* @param start Minute to start (24-hour format, minimum 0 minutes)
* @param end Ending minute (24-hour format, max 1439 minutes)
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)setRaiseWakeEnable:(BOOL)enable
start:(NSInteger)start
end:(NSInteger)end
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Get raise to light
/**
* queryRaiseWake
* @param success : isRaiseToWakeOn(YES or NO) ,raiseToWakeStartTime (24-hour format, minimum 0 minutes),raiseToWakeEndTime(24-hour format, max 1439 minutes)
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)queryRaiseWakeWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Set do not disturb mode
/**
* setNotDisturb
* @param enable YES:open,NO:close
* @param start Minute to start (24-hour format, minimum 0 minutes)
* @param end Ending minute (24-hour format, max 1439 minutes)
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)setNotDisturbEnable:(BOOL)enable
start:(NSInteger)start
end:(NSInteger)end
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Get do not disturb mode
/**
* queryNotDisturb
* @param success : isDoNotDisturbOn(YES or NO) ,doNotDisturbStartTime (24-hour format, minimum 0 minutes), doNotDisturbEndTime(24-hour format, max 1439 minutes)
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)queryNotDisturbWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Set Alarm
/**
* setAlartList
* @param alarmArray AM6AlarmModel Array
*
*AM6AlarmModel
*
// Switch Status
@property (assign, nonatomic) BOOL isOn;
/// Alarm Repeat Mode, randge: 0x00~0x7F, bit0-bit6 refer to Sunday to Staturday, 1: repeat 0: not repeat. For example, 0x41(0100 0001) means repeat at weekends, 0x3E(0011 1110) means repeat on weekdays and 0x00(0000 00000) means no repeat.
@property (assign, nonatomic) uint8_t repeatMode;
/// Only hour and minute Available
@property (assign, nonatomic) struct AM6DateStruct date;
- (nullable NSData*)commandData;
- (instancetype)initWithData:(NSData*)data;
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)setAlartList:(NSArray<AM6AlarmModel*> *)alarmArray
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Get Alarm
/**
* queryAlarmList
* @param success alarmList(AM6AlarmModel)
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)queryAlarmListWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
How to sync data with AM6
Prepare sync data (This API must be called before synchronizing all data)
/**
* Prepare the synchronization command. Before synchronizing data, you need to call this command once!!!!
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)prepareSyncWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Delete specified historical data
/**
* Delete specified historical data
* @param type in order bit0: steps and calories bit1: sleep bit2: heart rate bit3: blood oxygen bit4: daily bit5: multi-sports, the highest bit is 1 all delete all the corresponding data on the above bits If you need to delete, it is 1 If you don’t need to delete is 0
*
* type example
* 0x0010 deleteDailyActivityReport
* 0x0001 deleteDailyStepsCalorieDistance
* 0x0002 deleteSleepData
* 0x0004 deleteDailyHeartRate
* 0x0008 deleteOfflineBloodOxygen
* 0x0020 deleteSport
* 0x8000 deleteAllData
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)deleteDataWithType:(uint16_t)type
success:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Daily data
info
The daily report is a summary of the data for the day.
/**
* Sync daily, up to 15 days
* @param success :NSArray<AM6DeviceDailyActivityReportModel*> *reportArray
{
calorie = 0; // The calorie of daily report
dateString = 2020-02-29 00:00:00; // The date of daily report
effectiveStand = 0; //Effective standing mark 24bits to mark whether there is effective standing from 0~1 point, 1~2 point, ... to 23~24 point
functionEnable = 2047;
heartRate = 0; // The heart rate of daily report
heartRateAve = 0; ;// The ave heart rate of daily report
heartRateMax = 0;// The max heart rate of daily report
heartRateMaxTime = 2020-02-29 00:00:00; // The time of day when your maximum heart rate occurs
heartRateMin = 0; // The min heart rate of daily report
heartRateMinTime = 2020-02-29 00:00:00; // The time of day when the minimum heart rate occurs
heartRateResting = 0; // The rest heart rate of daily report
spo2 = 0; // The blood oxygen of daily report
steps = 0; // The step of daily report
}
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)syncDailyActivityReportWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
DailyStepsCalorieDistance
/**
* Synchronize daily records of steps, calories, distance details, up to 15 days, 1 set of values per hour
* @param success :NSArray<AM6DeviceDailyStepModel*> *dailyStepsArray;
( {
calorieArray = (
2850............
);
dateString = 2020-02-29 00:00:00;
distanceArray = (
2850.............
);
stepsArray = (
2850.................
);
},
)
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)syncDailyStepsCalorieDistanceWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Sleep data
info
This API returns sleep detail data in the form of sleep segments. Each sleep segment contains start date and sleep details. The start date starts at 0:00 of the current day. The sleep details include the sleep mode and the start time of this mode. For example, a person goes to bed at 2023-06-27 23:11 in the evening and wakes up at 2023-06-28 02:19 o'clock the next morning.
/**
* Synchronized sleep, up to 15 days
*
*One sleep data per day. When the sleep state changes, add an item data point.
*
* @param success :NSArray<AM6DeviceSleepModel*> *sleepArray;
( {
dataArray = (
{
status = 1;//0x01 enter sleep 0x02 light sleep 0x03 deep sleep 0x04 wake up 0x05 exit sleep 0x06 rapid eye movement (REM)
timeString = 2201; //Sleep time 22:hour 01:minute
},
);
dateString = 2020-02-29 00:00:00;//Sleep date
},
)
* @param fail Communication error codes, see AM6 error descriptions.
*/
| Sleep status | |
| ---- | ---- |
| 1 | start to sleep |
| 2 | light sleep |
| 3 | deep sleep |
| 4 | wake |
| 5 | exit sleep |
| 6 | rapid eye movement (REM) |
- (void)syncSleepWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Blood oxygen data
/**
* Synchronous offline blood oxygen, 8
* @param success :NSArray<AM6DeviceOffineBloodOxygenModel*> *bloodOxygenArray;
(
{
dateString = 2020-02-29 00:00:00; //date
value = 15; //For each measurement, increment the value by 1.
},
)
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)syncOfflineBloodOxygenWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Daily Heart Rate
/**
* Synchronize daily heart rate, up to 15 days
* One value every 5 minutes, a total of 288 values per day.
* @param success :NSArray<AM6DeviceHeartRateModel*> *dailyHeartRateArray;
(
{
dataArray = ( // The value of heart rate
0..........
);
dateString = 2020-02-29 00:00:00;//date
},
)
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)syncDailyHeartRateWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Activity data
/**
* Synchronize sports data (dotted data and report data)
*
*The device uploads the daily data management results to the mobile phone, and counts the data every hour, including the number of steps, calories, and distance.
* @param success :
NSArray<AM6DeviceIndoorRun*> *indoorRunArray
(
{
dataArray = (
{
calorieArray = ( //calorieArray
61,
61,..............
)
dateString = 2020-02-29 00:00:00; //date
distanceArray = ( //distanceArray
28,
28,.................
)
stepArray= ( //stepArray
28,
28,.................
)
}
)
}
)
NSArray<AM6DeviceIndoorRunReport*> *indoorRunReportArray;
(
{
anaerobicTime = 20; // The anaerobic endurance duration, the unit is second
aveHeartRate = 178; // The average heart rate
bodyEnergyCost = 0; // The body energy expenditure, the range is 0 ~ 100
cardioTime = 20; // The aerobic endurance duration, the unit is second
dataType = 0; //dataType
endDateString = 2020-02-29 00:00:00; // The end time of activity
estimatedRecoveryTime = 0; // The estimated recovery time
fatReductionTime = 20; // The fat burning duration, the unit is second
maxHeartRate = 255; // The max heart rate
maxOxygenUptake = 0; // The max oxygen uptake, the unit is milliliter/minute
maxPace = 320; // The max running pace, the unit is second / 100 meter
maxStepFrequency = 336; // The max freguency of step
minHeartRate = 0; // The min heart rate
minPace = 400; // The min running pace, the unit is second / 100 meter
peakTime = 20; // The ultimate heart rate duration, the unit is second
startDateString = 2020-02-29 00:00:00; // The start time of activity
timeZone = 0; //timeZone
totalCalorie = 65535; //Current total active calories
totalDistance = 30000; //Current total Distance
totalStep = 60000; //Current total steps
totalTime = 10800; //Current total Time
trainingEffect = 0; // The training effect
type = 0; //type
typeDescription = 0; //typeDescription
version = 0; //version
warmUpTime = 20; // The warm up time, the unit is secode
},
)
* @param fail Communication error codes, see AM6 error descriptions.
*/
- (void)syncSportWithSuccess:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;
Disconnect AM6 connection
/**
* Disconnect AM6 connection.
* @param success success
* @param fail Communication error codes, see AM6 error descriptions.
*/
-(void)commandAM6Disconnect:(DisposeAM6SuccessBlock)success
fail:(DisposeAM6ErrorBlock)fail;