getCreateUserData function
获取 创建用户指令 的数据
Implementation
Future<List<int>> getCreateUserData(String userName) async {
// 0xFE 0X02 LEN SNO USERNAME checksum
int cmd = 0x02;
if (userName.length > 10) {
print('用户长度不能超过10');
ZygBluetoothTool.cmdMsgHandle('用户长度不能超过10', {'cmdCode': cmd});
return [];
}
// 获取SNO
final List<int> snoList = await getSNOList();
// 获取USERNAME 将 abc123之类的用户名转为ascii码,注意:用户长度不能超过10
// List<int> userNameAsciiList = userNameToAscii('abc123cj');
List<int> userNameAsciiList = userNameToAscii(userName);
//有效数据
List<int> subData = [...snoList, ...userNameAsciiList];
return tempEncrypt(cmd, subData);
}