From 3fc9f826e6cb20d29d7d08f83f828931193c27ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Fri, 15 Sep 2023 16:20:42 +0200 Subject: [PATCH] Make consts public --- src/response.rs | 2 +- src/response/status.rs | 121 +++++++++++++++++++++-------------------- 2 files changed, 62 insertions(+), 61 deletions(-) diff --git a/src/response.rs b/src/response.rs index c7da6ef..b11fa69 100644 --- a/src/response.rs +++ b/src/response.rs @@ -1,4 +1,4 @@ -mod status; +pub mod status; pub use status::Status; use crate::Data; diff --git a/src/response/status.rs b/src/response/status.rs index b0ee522..47e8459 100644 --- a/src/response/status.rs +++ b/src/response/status.rs @@ -98,124 +98,125 @@ pub enum Status { } /// `0x9000` -const SUCCESS: u16 = 0x9000; +pub const SUCCESS: u16 = 0x9000; -const MORE_AVAILABLE_LOWER: u16 = 0x6100; -const MORE_AVAILABLE_UPPER: u16 = 0x61FF; -const MORE_AVAILABLE_MASK: u16 = 0x00FF; +pub const MORE_AVAILABLE_LOWER: u16 = 0x6100; +pub const MORE_AVAILABLE_UPPER: u16 = 0x61FF; +pub const MORE_AVAILABLE_MASK: u16 = 0x00FF; -const WRONG_LE_FIELD_LOWER: u16 = 0x6C00; -const WRONG_LE_FIELD_UPPER: u16 = 0x6CFF; -const WRONG_LE_FIELD_MASK: u16 = 0x00FF; +pub const WRONG_LE_FIELD_LOWER: u16 = 0x6C00; +pub const WRONG_LE_FIELD_UPPER: u16 = 0x6CFF; +pub const WRONG_LE_FIELD_MASK: u16 = 0x00FF; /// `0x6200` -const DATA_UNCHANGED_WARNING: u16 = 0x6200; -const WARNING_TRIGGERING_LOWER: u16 = 0x6202; -const WARNING_TRIGGERING_MASK: u16 = 0x00FF; -const WARNING_TRIGGERING_UPPER: u16 = 0x6280; -const ERROR_TRIGGERING_LOWER: u16 = 0x6402; -const ERROR_TRIGGERING_MASK: u16 = 0x00FF; -const ERROR_TRIGGERING_UPPER: u16 = 0x6480; +pub const DATA_UNCHANGED_WARNING: u16 = 0x6200; +pub const WARNING_TRIGGERING_LOWER: u16 = 0x6202; +pub const WARNING_TRIGGERING_MASK: u16 = 0x00FF; +pub const WARNING_TRIGGERING_UPPER: u16 = 0x6280; +pub const ERROR_TRIGGERING_LOWER: u16 = 0x6402; +pub const ERROR_TRIGGERING_MASK: u16 = 0x00FF; +pub const ERROR_TRIGGERING_UPPER: u16 = 0x6480; /// `0x6281` -const CORRUPTED_DATA: u16 = 0x6281; +pub const CORRUPTED_DATA: u16 = 0x6281; /// `0x6282` -const UNEXPECTED_EOF: u16 = 0x6282; +pub const UNEXPECTED_EOF: u16 = 0x6282; /// `0x6283` -const SELECTED_FILE_DEACTIVATED: u16 = 0x6283; +pub const SELECTED_FILE_DEACTIVATED: u16 = 0x6283; /// `0x6284` -const FILE_CONTROL_INFO_BADLY_FORMATTED: u16 = 0x6284; +pub const FILE_CONTROL_INFO_BADLY_FORMATTED: u16 = 0x6284; /// `0x6285` -const SELECTED_FILE_IN_TERMINATION_STATE: u16 = 0x6285; +pub const SELECTED_FILE_IN_TERMINATION_STATE: u16 = 0x6285; /// `0x6286` -const NO_INPUT_DATA_FROM_SENSOR: u16 = 0x6286; +pub const NO_INPUT_DATA_FROM_SENSOR: u16 = 0x6286; /// 0x6400 -const EXECUTION_ERROR: u16 = 0x6400; +pub const EXECUTION_ERROR: u16 = 0x6400; /// 0x6401 -const IMMEDIATE_RESPONSE_REQUIRED: u16 = 0x6401; +pub const IMMEDIATE_RESPONSE_REQUIRED: u16 = 0x6401; /// `0x6300` -const DATA_CHANGED_WARNING: u16 = 0x6300; +pub const DATA_CHANGED_WARNING: u16 = 0x6300; /// `0x6381` -const FILLED_BY_LAST_WRITE: u16 = 0x6381; -const WARNING_COUNTER_LOWER: u16 = 0x63C0; -const WARNING_COUNTER_UPPER: u16 = 0x63CF; -const WARNING_COUNTER_MASK: u16 = 0x000F; +pub const FILLED_BY_LAST_WRITE: u16 = 0x6381; +pub const WARNING_COUNTER_LOWER: u16 = 0x63C0; +pub const WARNING_COUNTER_UPPER: u16 = 0x63CF; +pub const WARNING_COUNTER_MASK: u16 = 0x000F; /// `0x6500` -const DATA_CHANGED_ERROR: u16 = 0x6500; +pub const DATA_CHANGED_ERROR: u16 = 0x6500; /// `0x6581` -const MEMORY_FAILURE: u16 = 0x6581; +pub const MEMORY_FAILURE: u16 = 0x6581; /// `0x6700` -const WRONG_LENGTH: u16 = 0x6700; +pub const WRONG_LENGTH: u16 = 0x6700; /// `0x6800` -const CLA_NOT_SUPPORTED: u16 = 0x6800; +pub const CLA_NOT_SUPPORTED: u16 = 0x6800; /// `0x6881` -const LOGICAL_CHANNEL_NOT_SUPPORTED: u16 = 0x6881; +pub const LOGICAL_CHANNEL_NOT_SUPPORTED: u16 = 0x6881; /// `0x6882` -const SECURE_MESSAGING_NOT_SUPPORTED: u16 = 0x6882; +pub const SECURE_MESSAGING_NOT_SUPPORTED: u16 = 0x6882; /// `0x6883` -const LAST_COMMAND_OF_CHAIN_EXPECTED: u16 = 0x6883; +pub const LAST_COMMAND_OF_CHAIN_EXPECTED: u16 = 0x6883; /// `0x6884` -const COMMAND_CHAINING_NOT_SUPPORTED: u16 = 0x6884; +pub const COMMAND_CHAINING_NOT_SUPPORTED: u16 = 0x6884; /// `0x6900` -const COMMAND_NOT_ALLOWED: u16 = 0x6900; +pub const COMMAND_NOT_ALLOWED: u16 = 0x6900; /// `0x6981` -const COMMAND_INCOMPATIBLE_FILE_STRUCTURE: u16 = 0x6981; +pub const COMMAND_INCOMPATIBLE_FILE_STRUCTURE: u16 = 0x6981; /// `0x6982` -const SECURITY_STATUS_NOT_SATISFIED: u16 = 0x6982; +pub const SECURITY_STATUS_NOT_SATISFIED: u16 = 0x6982; /// `0x6983` -const AUTHENTICATION_METHOD_BLOCKED: u16 = 0x6983; +pub const AUTHENTICATION_METHOD_BLOCKED: u16 = 0x6983; /// `0x6984` -const REFERENCE_DATA_NOT_USABLE: u16 = 0x6984; +pub const REFERENCE_DATA_NOT_USABLE: u16 = 0x6984; /// `0x6985` -const CONDITIONS_OF_USE_NOT_SATISFIED: u16 = 0x6985; +pub const CONDITIONS_OF_USE_NOT_SATISFIED: u16 = 0x6985; /// `0x6986` -const COMMAND_NOT_ALLOWED_NO_EF: u16 = 0x6986; +pub const COMMAND_NOT_ALLOWED_NO_EF: u16 = 0x6986; /// `0x6987` -const EXECTED_SECURE_MESSAGING_DATA_OBJECTS_MISSING: u16 = 0x6987; +pub const EXECTED_SECURE_MESSAGING_DATA_OBJECTS_MISSING: u16 = 0x6987; /// `0x6988` -const INCORRECT_SECURE_MESSAGING_DATA_OBJECTS: u16 = 0x6988; +pub const INCORRECT_SECURE_MESSAGING_DATA_OBJECTS: u16 = 0x6988; /// `0x6A00` -const WRONG_PARAMETERS_NO_INFO: u16 = 0x6A00; +pub const WRONG_PARAMETERS_NO_INFO: u16 = 0x6A00; /// `0x6A80` -const INCORRECT_PARAMETERS: u16 = 0x6A80; +pub const INCORRECT_PARAMETERS: u16 = 0x6A80; /// `0x6A81` -const FUNCTION_NOT_SUPPORTED: u16 = 0x6A81; +pub const FUNCTION_NOT_SUPPORTED: u16 = 0x6A81; /// `0x6A82` -const FILE_OR_APP_NOT_FOUND: u16 = 0x6A82; +pub const FILE_OR_APP_NOT_FOUND: u16 = 0x6A82; /// `0x6A83` -const RECORD_NOT_FOUND: u16 = 0x6A83; +pub const RECORD_NOT_FOUND: u16 = 0x6A83; /// `0x6A84` -const NOT_ENOUGH_MEMORY_IN_FILE: u16 = 0x6A84; +pub const NOT_ENOUGH_MEMORY_IN_FILE: u16 = 0x6A84; /// `0x6A85` -const NC_INCONSISTENT_WITH_TLV: u16 = 0x6A85; +pub const NC_INCONSISTENT_WITH_TLV: u16 = 0x6A85; /// `0x6A86` -const INCORRECT_P1P2: u16 = 0x6A86; +pub const INCORRECT_P1P2: u16 = 0x6A86; /// `0x6A87` -const NC_INCONSISTENT_WITH_P1P2: u16 = 0x6A87; +pub const NC_INCONSISTENT_WITH_P1P2: u16 = 0x6A87; /// `0x6A88` -const REFERENCE_NOT_FOUND: u16 = 0x6A88; +pub const REFERENCE_NOT_FOUND: u16 = 0x6A88; /// `0x6A89` -const FILE_ALREADY_EXISTS: u16 = 0x6A89; +pub const FILE_ALREADY_EXISTS: u16 = 0x6A89; /// `0x6A8A` -const DF_NAME_ALREADY_EXISTS: u16 = 0x6A8A; +pub const DF_NAME_ALREADY_EXISTS: u16 = 0x6A8A; /// `0x6B00` -const WRONG_PARAMETERS: u16 = 0x6B00; +pub const WRONG_PARAMETERS: u16 = 0x6B00; /// `0x6D00` -const INSTRUCTION_NOT_SUPPORTED_OR_INVALID: u16 = 0x6D00; +pub const INSTRUCTION_NOT_SUPPORTED_OR_INVALID: u16 = 0x6D00; /// `0x6E00` -const CLASS_NOT_SUPPORTED: u16 = 0x6E00; +pub const CLASS_NOT_SUPPORTED: u16 = 0x6E00; /// `0x6F00` -const CHECKING_ERROR: u16 = 0x6F00; +pub const CHECKING_ERROR: u16 = 0x6F00; impl Status { + pub const CHECKING_ERROR: u16 = 0x6F00; pub const fn from_u16(sw: u16) -> Self { match sw { SUCCESS => Status::Success,