-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from pmnxis/dev/23_disp_rom_read_tid_serial_re…
…facto #23 `card-terminal-adapter` for new features and KICC spec
- Loading branch information
Showing
31 changed files
with
1,024 additions
and
974 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
[package] | ||
name = "serial-arcade-pay-impl" | ||
name = "billmock-plug-card" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["Jinwoo Park <[email protected]>"] | ||
|
@@ -15,7 +15,7 @@ description = "Example implementation of serial arcade payment method for billmo | |
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
serial-arcade-pay = { path = "../serial-arcade-pay" } # Import generic interface for billmock-app-rs | ||
card-terminal-adapter = { path = "../card-terminal-adapter" } # Import generic interface for billmock-app-rs | ||
|
||
defmt = "0.3" | ||
defmt-test = "0.3.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* SPDX-FileCopyrightText: © 2023 Jinwoo Park ([email protected]) | ||
* | ||
* SPDX-License-Identifier: MIT OR Apache-2.0 | ||
*/ | ||
|
||
pub(crate) const KICC_STX: u8 = 0x02; | ||
pub(crate) const KICC_ACK: u8 = 0x06; | ||
pub(crate) const KICC_NACK: u8 = 0x15; | ||
pub(crate) const KICC_ETX: u8 = 0x03; | ||
|
||
pub(crate) const RAW_DATA_ACK: [u8; 3] = [KICC_ACK, KICC_ACK, KICC_ACK]; | ||
pub(crate) const RAW_DATA_NACK: [u8; 3] = [KICC_NACK, KICC_NACK, KICC_NACK]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
/* | ||
* SPDX-FileCopyrightText: © 2023 Jinwoo Park ([email protected]) | ||
* | ||
* SPDX-License-Identifier: MIT OR Apache-2.0 | ||
*/ | ||
|
||
#![no_std] | ||
#![feature(const_trait_impl)] | ||
|
||
#[cfg(test)] // for the print out internnal log in test code | ||
extern crate std; | ||
|
||
#[allow(unused)] | ||
mod common; | ||
|
||
use card_terminal_adapter::types::*; | ||
use card_terminal_adapter::*; | ||
|
||
// #[cfg(any(build, test))] | ||
// mod helper; | ||
|
||
pub struct KiccEd785Plug {} | ||
|
||
impl CardTerminalConst for KiccEd785Plug { | ||
fn is_nda() -> bool { | ||
false | ||
} | ||
} | ||
|
||
impl CardTerminalRxParse for KiccEd785Plug { | ||
fn pre_parse_common(&self, _raw: &[u8]) -> Result<CardTerminalRxCmd, CardTerminalError> { | ||
// implement me for actual usage | ||
Err(CardTerminalError::UnsupportedSpec) | ||
} | ||
|
||
fn post_parse_response_sale_slot_info( | ||
&self, | ||
_raw: &[u8], | ||
) -> Result<CardReaderPortBackup, CardTerminalError> { | ||
// implement me for actual usage | ||
Err(CardTerminalError::UnsupportedSpec) | ||
} | ||
|
||
fn post_parse_response_terminal_info( | ||
&self, | ||
_raw: &[u8], | ||
) -> Result<(TerminalVersion, RawTerminalId), CardTerminalError> { | ||
// implement me for actual usage | ||
Err(CardTerminalError::UnsupportedSpec) | ||
} | ||
} | ||
|
||
impl CardTerminalTxGen for KiccEd785Plug { | ||
fn response_ack<'a>(&self, _buffer: &'a mut [u8]) -> &'a [u8] { | ||
// KICC common ACK spec | ||
&common::RAW_DATA_ACK | ||
} | ||
|
||
fn response_nack<'a>(&self, _buffer: &'a mut [u8]) -> &'a [u8] { | ||
// KICC common NACK spec | ||
&common::RAW_DATA_NACK | ||
} | ||
|
||
fn response_device_info<'a>( | ||
&self, | ||
buffer: &'a mut [u8], | ||
_model_version: &'a [u8; FW_VER_LEN], | ||
_serial_number: &'a [u8; DEV_SN_LEN], | ||
) -> &'a [u8] { | ||
// implement me for actual usage | ||
&buffer[0..0] | ||
} | ||
|
||
fn alert_coin_paper_acceptor_income<'a>( | ||
&self, | ||
buffer: &'a mut [u8], | ||
_income: RawU24IncomeArcade, | ||
) -> &'a [u8] { | ||
// implement me for actual usage | ||
&buffer[0..0] | ||
} | ||
|
||
fn push_sale_slot_info<'a>( | ||
&self, | ||
buffer: &'a mut [u8], | ||
_port_backup: &'a CardReaderPortBackup, | ||
) -> &'a [u8] { | ||
// implement me for actual usage | ||
&buffer[0..0] | ||
} | ||
|
||
fn push_sale_slot_info_partial_inhibit<'a>( | ||
&self, | ||
buffer: &'a mut [u8], | ||
_port_backup: &'a CardReaderPortBackup, | ||
) -> &'a [u8] { | ||
// implement me for actual usage | ||
&buffer[0..0] | ||
} | ||
|
||
fn request_sale_slot_info<'a>(&self, buffer: &'a mut [u8]) -> &'a [u8] { | ||
// implement me for actual usage | ||
&buffer[0..0] | ||
} | ||
|
||
fn request_terminal_info<'a>(&self, buffer: &'a mut [u8]) -> &'a [u8] { | ||
// implement me for actual usage | ||
&buffer[0..0] | ||
} | ||
|
||
fn display_rom<'a>( | ||
&self, | ||
buffer: &'a mut [u8], | ||
_git_hash: &'a [u8; GIT_HASH_LEN], | ||
_terminal_id: &[u8; TID_LEN], | ||
_p1_card: u32, | ||
_p2_card: u32, | ||
_p1_coin: u32, | ||
_p2_coin: u32, | ||
) -> &'a [u8] { | ||
// implement me for actual usage | ||
&buffer[0..0] | ||
} | ||
|
||
fn display_hw_info<'a>( | ||
&self, | ||
buffer: &'a mut [u8], | ||
_model_version: &'a [u8; FW_VER_LEN], | ||
_serial_number: &'a [u8; DEV_SN_LEN], | ||
_terminal_id: &[u8; TID_LEN], | ||
_hw_boot_cnt: u32, | ||
_uptime_minutes: u32, | ||
) -> &'a [u8] { | ||
// implement me for actual usage | ||
&buffer[0..0] | ||
} | ||
|
||
fn display_warning<'a>( | ||
&self, | ||
buffer: &'a mut [u8], | ||
_warn_kind: CardTerminalDisplayWarning, | ||
) -> &'a [u8] { | ||
// implement me for actual usage | ||
&buffer[0..0] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 4 additions & 7 deletions
11
serial-arcade-pay/Cargo.toml → card-terminal-adapter/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
# SPDX-FileCopyrightText: © 2023 Jinwoo Park ([email protected]) | ||
# | ||
# SPDX-License-Identifier: CC0-1.0 | ||
|
||
[package] | ||
name = "serial-arcade-pay" | ||
name = "card-terminal-adapter" | ||
version = "0.1.0" | ||
edition = "2021" | ||
authors = ["Jinwoo Park <[email protected]>"] | ||
license = "MIT OR Apache-2.0" | ||
description = "Common arcade serial type payment method interface for billmock-app-rs" | ||
description = "Card terminal interface adapte for billmock-app-rs" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
defmt = "0.3" | ||
static_assertions = "1.1.0" | ||
defmt = "0.3" | ||
zeroable = "0.2.0" |
Oops, something went wrong.