getEditqueryUserNameData function

Future<List<int>> getEditqueryUserNameData(
  1. int NID,
  2. String name
)

获取 查询/编辑用户名 的数据

Implementation

Future<List<int>> getEditqueryUserNameData(int NID, String name) async {
  // 0xFE 0X03 LEN SNO NID USERNAME checksum
  // 指令
  int cmd = 0x03;
  if (name.length > 10) {
    ZygBluetoothTool.cmdMsgHandle('用户名长度必须小于等于10', {'cmdCode': cmd});
    return [];
  }
  // 获取SNO
  final List<int> snoList = await getSNOList();
  // 获取NID
  // int NID = 2;
  // 获取USERNAME  将 abc123之类的用户名转为ascii码,注意:用户长度不能超过10
  // List<int> userNameAsciiList = userNameToAscii('abc000');
  // 如果用户名为空,则为查询
  List<int> userNameAsciiList = name.codeUnits;

  //有效数据
  List<int> subData = [...snoList, NID, ...userNameAsciiList];
  return tempEncrypt(cmd, subData);
}