handlePwd_login_verificationWithData function

void handlePwd_login_verificationWithData(
  1. List<int> value
)

处理 密码登录验证 返回的数据

Implementation

void handlePwd_login_verificationWithData(List<int> value) async {
  // 0xFE 0X08 LEN TYPE NID ID password ERR_CODE checksum
  // 获取有效数据的长度
  int len = value[2];

  String cmdName = '密码登录验证';
  //获取解密后的有效数据
  List<int> dataDecrypt = await decryptTemp(value);

  // ERR_CODE为0x00时表示创建用户成功,为其他字段时则表示创建用户失败,其中为0X0B时表示用户已经重复
  int ERR_CODE = dataDecrypt[len - 1];
  if (ERR_CODE != 0) {
    print('密码登录验证,错误码:$ERR_CODE');
    ZygBluetoothTool.cmdMsgHandle(
        '密码登录验证,错误码:$ERR_CODE', {'cmd': cmdName, 'ERR_CODE': ERR_CODE});
    if (ERR_CODE == 0xa) {
      print('密码不存在');
      ZygBluetoothTool.cmdMsgHandle(
          '密码不存在', {'cmd': cmdName, 'ERR_CODE': ERR_CODE});
    }

    if (ERR_CODE == 0xc) {
      print('密码错误');
      ZygBluetoothTool.cmdMsgHandle(
          '密码错误', {'cmd': cmdName, 'ERR_CODE': ERR_CODE});
    }
    return;
  }

  // TYPE ,密码类型
  int TYPE = dataDecrypt[0];
  String typeStr = BluetoothCmdTypeName.getCmdName(TYPE);
  // NID ,密码对应用户的ID
  int NID = dataDecrypt[1];
  // ID ,密码对应的ID
  int ID = dataDecrypt[2];
  print('验证密码成功,成功');
  ZygBluetoothTool.cmdMsgHandle('验证密码成功,成功。NID:$NID,密码ID:$ID,密码类型:$typeStr', {
    'cmd': cmdName,
    'TYPE': typeStr,
    'NID': NID,
    'ID': ID,
    'msg': 'TYPE ,密码类型; NID ,密码对应用户的ID;ID ,密码对应的ID'
  });
}