@@ -148,7 +148,7 @@ pub fn map_response(frame: &Frame) -> Result<DeviceResponseType, ProtocolError>
|
|||||||
return Err(ProtocolError::new("Missing authentication result"));
|
return Err(ProtocolError::new("Missing authentication result"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if payload[1] != 0x00 && payload[1] != 0x01 {
|
if payload[0] != 0x00 && payload[1] != 0x01 {
|
||||||
return Err(ProtocolError::new(format!(
|
return Err(ProtocolError::new(format!(
|
||||||
"Invalid authentication flag: {:#04x}",
|
"Invalid authentication flag: {:#04x}",
|
||||||
payload[1]
|
payload[1]
|
||||||
|
|||||||
@@ -99,7 +99,11 @@ pub fn build_get_device_flags() -> Vec<u8> {
|
|||||||
pub fn build_unlock_device(password: &[u8]) -> Result<Vec<u8>, ValidationError> {
|
pub fn build_unlock_device(password: &[u8]) -> Result<Vec<u8>, ValidationError> {
|
||||||
validate_raw_password(password)?;
|
validate_raw_password(password)?;
|
||||||
|
|
||||||
Ok(build_frame(0x2d, password))
|
let mut payload = Vec::with_capacity(1 + password.len());
|
||||||
|
payload.push(0x00);
|
||||||
|
payload.extend_from_slice(password);
|
||||||
|
|
||||||
|
Ok(build_frame(0x2d, &payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command 0x2F
|
// Command 0x2F
|
||||||
|
|||||||
Reference in New Issue
Block a user