You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// id: user id, the range is 0~0x7fffffffAM4Module.setUserId(mac,id);// responsenotifyListener=DeviceEventEmitter.addListener(AM4Module.Event_Notify,(event)=>{if(event.action===AMProfileModule.ACTION_SET_USERID_SUCCESS_AM){console.log('set success');}});
setAlarmClock
/** * id: alarm clock id, you can set up to 3 alarm clocks * hour: clock hour * min: clock minates * isRepeat: one time or repeat * weeks: available on the day of the week * isOn: open or close */AM4Module.setAlarmClock(mac,1,12,0,true,[1,1,1,1,1,0,0],false);// responsenotifyListener=DeviceEventEmitter.addListener(AM4Module.Event_Notify,(event)=>{if(event.action===AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM){console.log('set success');}});
get alarm clock ids
AM4Module.getAlarmClockNum(mac);// responsenotifyListener=DeviceEventEmitter.addListener(AM4Module.Event_Notify,(event)=>{if(event.action===AMProfileModule.ACTION_SET_ALARMINFO_SUCCESS_AM){console.log(event[AMProfileModule.GET_ALARMNUM_AM]);// e.g. 3console.log(event[AMProfileModule.GET_ALARMNUM_ID_AM]);// e.g. [1, 2, 3]}});
get alarm clock detail
AM4Module.getAlarmClockDetail(mac,[1,3,2]);// responsenotifyListener=DeviceEventEmitter.addListener(AM4Module.Event_Notify,(event)=>{if(event.action===AMProfileModule.ACTION_GET_ALARMINFO_AM){letdataArray=event[BPProfileModule.GET_ALARM_CLOCK_DETAIL];if(dataArray==undefined){result="There is not offline data in device"}else{for(leti=0;i<dataArray.length;i++){letofflineData=dataArray[i];console.log(offlineData[AMProfileModule.GET_ALARM_ID_AM]);console.log(offlineData[AMProfileModule.GET_ALARM_TIME_AM]);console.log(offlineData[AMProfileModule.GET_ALARM_ISREPEAT_AM]);console.log(offlineData[AMProfileModule.GET_ALARM_WEEK_AM]);console.log(offlineData[AMProfileModule.GET_ALARM_ISON_AM]);}}}});
/** * hour * min * isOn: open or close */AM4Module.setActivityRemind(mac,0,30,false);// responsenotifyListener=DeviceEventEmitter.addListener(AM4Module.Event_Notify,(event)=>{if(event.action===AMProfileModule.ACTION_SET_ACTIVITYREMIND_SUCCESS_AM){console.log('set success');}});
// The user id range is from 0 to 0x7fffffffAM4Module.setUserId(mac,8);// responsenotifyListener=DeviceEventEmitter.addListener(AM4Module.Event_Notify,(event)=>{if(event.action===AMProfileModule.ACTION_SET_USERID_SUCCESS_AM){console.log('set success');}});
set user information to the am4 device
/** * age * height(cm) * weight(lbs) * gender 0: female, 1: male * unit 0: miles, 1: kilometre * target the goal of steps, the range is from 4 ~ 65535 * activityLevel 1: sedentary, 2: active, 3: very active */AM4Module.setUserInfo(mac,25,183,80,AMProfileModule.AM_SET_MALE,AMProfileModule.AM_SET_UNIT_METRIC,10000,1,30);// responsenotifyListener=DeviceEventEmitter.addListener(AM4Module.Event_Notify,(event)=>{if(event.action===AMProfileModule.ACTION_SET_USERINFO_SUCCESS_AM){console.log('set success');}});
AM4Module.syncActivityData(mac);// responsenotifyListener=DeviceEventEmitter.addListener(AM4Module.Event_Notify,(event)=>{if(event.action===AMProfileModule.ACTION_SYNC_ACTIVITY_DATA_AM){letdataArray=event[AMProfileModule.SYNC_ACTIVITY_EACH_DATA_AM];if(dataArray==undefined){result="There is not offline data in device"}else{for(leti=0;i<dataArray.length;i++){letofflineData=dataArray[i];console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_TIME_AM]);console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_AM]);console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_CALORIE_AM]);console.log(offlineData[AMProfileModule.SYNC_ACTIVITY_DATA_STEP_LENGTH_AM]);console.log(offlineData[AMProfileModule.DATAID]);}}}});
AM4Module.syncSleepData(mac);// responsenotifyListener=DeviceEventEmitter.addListener(AM4Module.Event_Notify,(event)=>{if(event.action===AMProfileModule.ACTION_SYNC_SLEEP_DATA_AM){letdataArray=event[AMProfileModule.SYNC_SLEEP_DATA_AM];if(dataArray==undefined){result="There is not offline data in device"}else{for(leti=0;i<dataArray.length;i++){letofflineData=dataArray[i];console.log(offlineData[AMProfileModule.SYNC_SLEEP_EACH_DATA_AM]);console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_TIME_AM]);console.log(offlineData[AMProfileModule.SYNC_SLEEP_DATA_LEVEL_AM]);console.log(offlineData[AMProfileModule.DATAID]);}}}});