Commit 889e7a75 authored by Andrey's avatar Andrey

Convert text to latin1. sendRaw(): added cancelKanji mode.

parent 11178e73
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
* See LICENSE for distribution and usage details. * See LICENSE for distribution and usage details.
*/ */
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:hex/hex.dart'; import 'package:hex/hex.dart';
...@@ -93,7 +94,6 @@ class Printer { ...@@ -93,7 +94,6 @@ class Printer {
// Cancel Kanji mode // Cancel Kanji mode
if (cancelKanji) { if (cancelKanji) {
_socket.write(cKanjiCancel); _socket.write(cKanjiCancel);
// TODO encode string
} }
// Set local code table // Set local code table
...@@ -104,11 +104,19 @@ class Printer { ...@@ -104,11 +104,19 @@ class Printer {
), ),
); );
} }
if (cancelKanji) {
_socket.add(latin1.encode(text));
} else {
_socket.write(text); _socket.write(text);
} }
}
/// Sens raw command(s) /// Sens raw command(s)
void sendRaw(List<int> cmd) { void sendRaw(List<int> cmd, {bool cancelKanji = true}) {
if (cancelKanji) {
_socket.write(cKanjiCancel);
}
_socket.add(Uint8List.fromList(List.from(cmd))); _socket.add(Uint8List.fromList(List.from(cmd)));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment