ps:因為設置模塊會涉及到N多藍牙指令,在每次發(fā)送指令時,都要檢測相關設備是否連接,若沒有連接 提示 : 辦公椅未連接藍牙 或者 辦公桌未連接藍牙,
需要保持數(shù)據(jù)同步一致的地方很多,具體如何達到效果自行解決,以下的相關同步方法僅供參考
-
設置主界面
01設置.png
1.進入設置界面 要同步個人信息數(shù)據(jù) 以及當前所連接硬件的設備數(shù)據(jù)
因為獲取接口數(shù)據(jù) 和通過藍牙協(xié)議獲取設備數(shù)據(jù) 所得到的數(shù)據(jù)的先后不確定,所以原則上是 通過藍牙獲取到的數(shù)據(jù)可以覆蓋更新接口返回的數(shù)據(jù) ,而接口返回的數(shù)據(jù)不能覆蓋藍牙反饋的數(shù)據(jù)
- 接口
通過接口listUserInfo獲取個人信息 參閱接口文檔
請求示例:
http://office.teammax.com.cn/client/office/app.do?method=listUserInfo&requestId=6997&platType=i&msgToken=dfanxL0+k95nP3tJabmt0GwA3ZJfIX2c
結果:
{
error = "";
id = 6997;
result = {
age = 29;
birthday = "1989-10-16";
dailySeat = 360;
department = "\U4f01\U4e1aA";
gender = "\U7537";
id = 1705;
isAdmin = 0;
isAutoLifting = "\U5f00";
isOpenHeight = "\U5f00";
isOpenPanel = "\U5f00";
isWeixin = 1;
lastSittingHeight = 777;
lastStandingHeight = 899;
maxHeight = 1250;
minHeight = 600;
minStandingTime = 0;
msgToken = "dfanxL0+k94cOo1E4t4cQKi5JCidysTm";
nickName = ceshi;
sittingRemindTime = 30;
userImg = "http://thirdwx.qlogo.cn/mmopen/vi_32/7c8smKMeOplhNLqJAu7ibibOYjGpZBD9jUf6z7rlERuU7lBXXibHe2yTAicCmv5qwpvBVlro3Qxg9lzmib62XdSnPoQ/132";
username = oQnuS1Hj6rIlYFNO5iyxDo72HomA;
vibrationIntensity = 9;
};
}
3.數(shù)據(jù)處理與顯示
每日久坐限制 取字段 dailySeat ,數(shù)據(jù)單位是秒 要對60取整 轉為分鐘顯示
4.每次進入設置主界面 都可以請求一下接口數(shù)據(jù) 和藍牙數(shù)據(jù) 以此保證個人信息數(shù)據(jù)的即時性
5.藍牙指令
久坐提醒 通過椅子協(xié)議讀寫久坐時間 指令來讀取
座椅震動強度 通過椅子協(xié)議21-設置電機震動等級-讀取震動 指令來讀取
最短站立時間 通過椅子協(xié)議最短站立時間 指令來讀取
辦公桌椅限值 通過桌子協(xié)議20 查詢上下限標志位 指令來讀取
桌自帶手控面板 通過桌子協(xié)議1F讀取手控器狀態(tài) 指令來讀取
自動升降模式 通過椅子協(xié)議提醒模式設置 指令來讀取
詳情參閱藍牙協(xié)議
- 退出登錄
清空本地保存數(shù)據(jù),跳轉到登錄頁面
7.右上角?按鈕
點擊進入web頁展示,標題諦明
url :http://www.teammax.com.cn
8.關于我們
點擊進入web頁展示,標題關于我們
url :http://www.teammax.com.cn/en/pages/3
個人信息

- 接口
獲取個人信息
通過接口listUserInfo獲取個人信息(設置頁已經請求國,可直接將結果傳入,不需重復請求)
獲取部門列表
接口方法名listDepartment
請求示例:
http://office.teammax.com.cn/client/office/app.do?method=listDepartment&requestId=6693&platType=i&msgToken=dfanxL0+k97vWhhXSquubqoJduIa7rzg
結果:
{
error = "";
id = 6693;
result = {
departments = (
{
departments = "<null>";
description = test;
id = 217;
name = tets;
pId = 191;
target = "<null>";
url = "<null>";
},
{
departments = "<null>";
description = test;
id = 192;
name = "\U9500\U552e\U90e8";
pId = 188;
target = "<null>";
url = "<null>";
},
{
departments = "<null>";
description = test;
id = 200;
name = "\U8d22\U52a1D";
pId = 188;
target = "<null>";
url = "<null>";
},
{
departments = "<null>";
description = "<null>";
id = 201;
name = "\U9500\U552eb";
pId = 188;
target = "<null>";
url = "<null>";
},
{
departments = "<null>";
description = "<null>";
id = 202;
name = "\U9500\U552eBBB";
pId = 188;
target = "<null>";
url = "<null>";
},
{
departments = "<null>";
description = "<null>";
id = 203;
name = "\U8d22\U52a1CC22";
pId = 188;
target = "<null>";
url = "<null>";
}
);
msgToken = "dfanxL0+k97vWhhXSquubqoJduIa7rzg";
};
}
保存?zhèn)€人信息
接口方法名 editUserInfo
修改頭像 上傳圖片等 均參閱接口文檔
2.個人信息展示有修改 : 微信用戶不需要顯示郵箱
根據(jù)獲取個人信息接口 isWeixin 字段布爾值,接口會給出此用戶是不是微信登錄用戶
3.部門顯示邏輯
根據(jù)獲取個人信息接口獲取部門department字段值 ,如果為空 則證明沒有部門,那么部門這一欄要隱藏
設備列表

- 獲取設備列表接口
接口方法名 :listDevice
請求示例:
http://office.teammax.com.cn/client/office/app.do?method=listDevice&requestId=6387&platType=i&msgToken=dfanxL0+k952abcrxr5sc3D8dFUL7TZy
結果:
{
error = "";
id = 6387;
result = {
chairDevices = (
{
department = {
departments = "<null>";
description = "<null>";
id = 188;
name = "<null>";
pId = 0;
target = "<null>";
url = "<null>";
};
deviceMac = "64:CF:D9:17:27:6A";
deviceModelId = 1666;
id = 1790;
name = "T51\U6905\U5b50";
titleImg = "http://office.teammax.com.cn/house/u/cms/www/201711/161009164g79.jpg";
type = "\U6905";
}
);
deskDevices = (
{
department = {
departments = "<null>";
description = "<null>";
id = 189;
name = "<null>";
pId = 0;
target = "<null>";
url = "<null>";
};
deviceMac = "C4:F3:12:3A:0B:AC";
deviceModelId = 1664;
id = 1769;
name = "T51\U684c\U5b50";
titleImg = "http://office.teammax.com.cn/house/u/cms/www/201711/16100846ed0t.jpg";
type = "\U684c";
}
);
deviceAndDevices = (
{
chair = {
department = {
departments = "<null>";
description = "<null>";
id = 188;
name = "<null>";
pId = 0;
target = "<null>";
url = "<null>";
};
deviceMac = "64:CF:D9:17:27:6A";
deviceModelId = 1666;
id = 1790;
name = "T51\U6905\U5b50";
titleImg = "http://office.teammax.com.cn/house/u/cms/www/201711/161009164g79.jpg";
type = "\U6905";
};
desk = {
department = {
departments = "<null>";
description = "<null>";
id = 189;
name = "<null>";
pId = 0;
target = "<null>";
url = "<null>";
};
deviceMac = "C4:F3:12:3A:0B:AC";
deviceModelId = 1664;
id = 1769;
name = "T51\U684c\U5b50";
titleImg = "http://office.teammax.com.cn/house/u/cms/www/201711/16100846ed0t.jpg";
type = "\U684c";
};
}
);
msgToken = "dfanxL0+k952abcrxr5sc3D8dFUL7TZy";
};
}
取消配對
消配對的邏輯,刪除桌子 或者 刪除配對 都要根據(jù)藍牙指令刪除配對 刪除配對是桌子74指令
取消配對方法名 :removeDevice,詳情參閱接口文檔添加
點擊添加跳轉 掃碼界面 ,進入掃碼流程
進入掃碼界面,如果同時成功連接了桌椅,點擊完成進入配對界面 ,進入下面設備配對流程,否則 返回設備列表設備配對
點擊設備配對判斷是否同時連接了桌子和椅子 ,沒連接提示:請掃碼連接桌子和椅子
如果都連接,就進入配對界面,配對完成 返回設置頁面
久坐提醒
默認顯示設置頁面的數(shù)據(jù) 例如設置頁面久坐提醒顯示 30m ,那么進入久坐提醒界面的默認選中也是30m
添加1分鐘測試模式 ,原藍牙協(xié)議中有此指令
- 保存
設置久坐提醒 : 椅子藍牙協(xié)議讀寫久坐時間中的寫入指令
保存設置成功返回設置頁,并調用接口editUserInfo同步更新久坐提醒數(shù)據(jù)
震動強度
默認選中數(shù)據(jù) 同步設置頁面的座椅震動強度數(shù)據(jù)

- 保存設置指令
椅子藍牙協(xié)議椅子命令21-設置電機震動等級-讀取震動中的設置指令,保保存設置成功返回設置頁,并調用接口editUserInfo同步更新震動強度數(shù)據(jù)
最短站立時間
默認選中數(shù)據(jù) 同步設置頁面的最短站立時間數(shù)據(jù)

- 保存設置指令
椅子藍牙協(xié)議最短站立時間中的設置指令
保存設置成功返回設置頁,并調用接口editUserInfo同步更新最短站立時間數(shù)據(jù)
每日久坐限制
默認選中數(shù)據(jù) 同步設置頁面的每日久坐限制數(shù)據(jù)
此界面 標題改為
每日久坐限制

- 保存
不需要藍牙協(xié)議
調用接口editUserInfo同步更新每日久坐限制數(shù)據(jù),并返回設置頁
記憶坐姿高度 & 記憶站立高度
這兩個條目沒有二級頁面,點擊不響應,但要注意數(shù)據(jù)的一致性,在控制會有相關設置,設置后注意調用 editUserInfo 同步到后臺數(shù)據(jù)
辦公桌椅限值
設置頁的開關開啟時 點擊才能進入子頁面

默認顯示的最高最低限值 同步個人信息數(shù)據(jù)中的限值, 在設置過程中切換最高最低限值,都會保留上次顯示 (最高限值在左邊,最低限值在右邊 此處和UI設計不一致,請注意)
例如 個人信息中最高1000 最低800 ,那么進去此界面 默認顯示的最高限值為1000 最低為800,然后滾動最高限值到900,切換到最低限制,在切換回最高,此時最高顯示的為900。
圖片上傳中...(08辦工桌升降限值_最高.png-81e6b3-1548920707853-0)]
- 保存
執(zhí)行桌子藍牙指令21 設置上限位置和22設置下限位置
保存成功,調用接口editUserInfo同步更新相應數(shù)據(jù),并返回設置頁
