This commit is contained in:
2025-12-23 16:23:11 +00:00
parent 7941e2065e
commit 975707de4c
3 changed files with 24 additions and 6 deletions
+4 -4
View File
@@ -69,7 +69,7 @@ var (
}
)
func checkStatus(statusResp []byte) (string, error) {
func checkStatus(statusResp []byte) ([]string, error) {
if len(statusResp) > 3 {
statusBytes := statusResp[7:11] // Extract the relevant bytes from the response
// For each position, get the ASCII character, hex value, and mapped meaning.
@@ -84,17 +84,17 @@ func checkStatus(statusResp []byte) (string, error) {
{pos: 4, value: statusBytes[3], mapper: statusPos3},
}
result := ""
result := make([]string, len(posStatus))
for _, p := range posStatus {
statusMsg, exists := p.mapper[p.value]
if !exists {
statusMsg = "Unknown status"
}
if p.value != 0x30 {
result += fmt.Sprintf("Status: %s; ", statusMsg)
result = append(result, fmt.Sprintf("Status: %s; ", statusMsg))
}
if p.pos == 4 && p.value == 0x38 {
return result, fmt.Errorf("Card well empty")
return nil, fmt.Errorf("Card well empty")
}
}
return result, nil