Skip to content

Commit

Permalink
feat: count for tsc command
Browse files Browse the repository at this point in the history
  • Loading branch information
YannMancel committed Sep 19, 2023
1 parent a6c1583 commit a24f4ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public static Vector<Byte> mapToReceipt(Map<String,Object> config, List<Map<Stri
public static Vector<Byte> mapToLabel(Map<String,Object> config, List<Map<String,Object>> list) {
LabelCommand tsc = new LabelCommand();

int count = (int)(config.get("count")==null?1:config.get("count"));
int width = (int)(config.get("width")==null?60:config.get("width")); // 单位:mm
int height = (int)(config.get("height")==null?75:config.get("height")); // 单位:mm
int gap = (int)(config.get("gap")==null?0:config.get("gap")); // 单位:mm
Expand Down Expand Up @@ -170,7 +171,7 @@ public static Vector<Byte> mapToLabel(Map<String,Object> config, List<Map<String
}

// 打印标签
tsc.addPrint(1, 1);
tsc.addPrint(1, count);
// 打印标签后 蜂鸣器响
tsc.addSound(2, 100);
//开启钱箱
Expand Down
5 changes: 3 additions & 2 deletions ios/Classes/BluetoothPrintPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
-(NSData *)mapToTscCommand:(NSDictionary *) args {
NSDictionary *config = [args objectForKey:@"config"];
NSMutableArray *list = [args objectForKey:@"data"];


NSNumber *count = ![config objectForKey:@"count"]?@"1" : [config objectForKey:@"count"];
NSNumber *width = ![config objectForKey:@"width"]?@"48" : [config objectForKey:@"width"];
NSNumber *height = ![config objectForKey:@"height"]?@"80" : [config objectForKey:@"height"];
NSNumber *gap = ![config objectForKey:@"gap"]?@"2" : [config objectForKey:@"gap"];
Expand Down Expand Up @@ -177,7 +178,7 @@ -(NSData *)mapToTscCommand:(NSDictionary *) args {

}

[command addPrint:1 :1];
[command addPrint:1 :count];
return [command getCommand];
}

Expand Down
4 changes: 3 additions & 1 deletion lib/bluetooth_print_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ class LineText {

/// ['text'] double
final int? weight;
final int? width;
final int? height;

/// ['text','image'] double
final int? width;

/// ['text'] absolute position from line begin
final int? absolutePos;

Expand Down

0 comments on commit a24f4ce

Please sign in to comment.