-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
292 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
## 0.3.5 | ||
|
||
* Data Element (DE) for field 48. | ||
|
||
## 0.3.5 | ||
|
||
* Add partial field support. | ||
|
||
## 0.3.4 | ||
|
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
part of '../pos.dart'; | ||
|
||
/// Data Element (DE) for field 48 used for Private Additional data in all original specifications from 1987, 1993 and 2003 years. | ||
class DataElement { | ||
/// Constructor. | ||
const DataElement({ | ||
this.serialNumber, | ||
//this.protocolVersion, | ||
this.appVersion, | ||
this.language, | ||
this.connectionType, | ||
}); | ||
|
||
// Version of the protocol specifications. | ||
//final String? protocolVersion; | ||
|
||
/// Serial number of a component. | ||
final String? serialNumber; | ||
|
||
/// App version. | ||
final String? appVersion; | ||
|
||
/// Connection type. | ||
final int? connectionType; | ||
|
||
/// Language | ||
final int? language; | ||
|
||
List<int> _encode() { | ||
final buffer = <int>[]; | ||
|
||
final s = serialNumber; | ||
|
||
if (s != null) { | ||
final sub = [0x01, ...s.codeUnits]; | ||
|
||
buffer.addAll(_decimalAsHexBytes(sub.length, 2)); | ||
buffer.addAll(sub); | ||
} | ||
|
||
final v = appVersion; | ||
if (v != null) { | ||
final sub = [0x02, ...v.codeUnits]; | ||
|
||
buffer.addAll(_decimalAsHexBytes(sub.length, 2)); | ||
buffer.addAll(sub); | ||
} | ||
|
||
final l = language; | ||
if (l != null) { | ||
final sub = [0x03, l]; | ||
buffer.addAll(_decimalAsHexBytes(sub.length, 2)); | ||
buffer.addAll(sub); | ||
} | ||
|
||
final c = connectionType; | ||
if (c != null) { | ||
final sub = [0x15, c]; | ||
|
||
buffer.addAll(_decimalAsHexBytes(sub.length, 2)); | ||
buffer.addAll(sub); | ||
} | ||
|
||
buffer.insertAll(0, _decimalAsHexBytes(buffer.length, 4)); | ||
|
||
return buffer; | ||
} | ||
|
||
/// Converts this object into JSON. | ||
Map<String, Object> toJson() { | ||
final m = <String, Object>{}; | ||
|
||
return m; | ||
} | ||
} |
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
Oops, something went wrong.