tse 0.0.2
tse: ^0.0.2 copied to clipboard
Swissbit Tse plugin for flutter
// ignore_for_file: avoid_print
import 'package:flutter/material.dart';
import 'package:tse/models/send/SendPartitionModel.dart';
import 'package:tse/models/send/client_parameter_model.dart';
import 'package:tse/models/send/login_parameter_model.dart';
import 'package:tse/models/send/logout_parameter_model.dart';
import 'package:tse/models/send/transection_parameter.dart';
import 'package:tse/models/send/tse_setup_parameter_model.dart';
import 'package:tse/tse.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter App',
debugShowCheckedModeBanner: false,
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final _tsePlugin = Tse();
String drive = "E";
String initResult = '''
''';
@override
void initState() {
super.initState();
}
void _showMyDialog(BuildContext context, String title, String data) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(title),
content: Text(data),
actions: <Widget>[
TextButton(
child: Text('Kapat'),
onPressed: () {
Navigator.of(context).pop(); // Dialogu kapatır
},
),
],
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
title: const Text(
'Demo WORM',
textAlign: TextAlign.left,
style: TextStyle(color: Colors.black),
),
backgroundColor: const Color(0xfff9f2ec),
),
body: ListView(padding: EdgeInsets.all(8.0), children: [
TextButton(
onPressed: () async {
var q1 = await _tsePlugin.getMahmut();
print(q1?.toJson() ?? "null");
_showMyDialog(context, "Mahmut Test", q1?.toJson() ?? "null");
},
child: const Text("Mahmut Test")),
TextButton(
onPressed: () async {
var q1 = await _tsePlugin.getPartitions();
print(q1?.toJson() ?? "null");
_showMyDialog(context, "getPartitions", q1?.toJson() ?? "null");
},
child: const Text("getPartitions")),
TextButton(
onPressed: () async {
var q1 = await _tsePlugin
.setDrive(SendPartitionModel(partition: "E"));
print(q1?.toJson() ?? "null");
_showMyDialog(context, "setDrive E", q1?.toJson() ?? "null");
},
child: const Text("setDrive E")),
TextButton(
onPressed: () async {
var q1 = await _tsePlugin
.setDrive(SendPartitionModel(partition: "X"));
print(q1?.toJson() ?? "null");
_showMyDialog(context, "setDrive X", q1?.toJson() ?? "null");
},
child: const Text("setDrive X")),
TextButton(
onPressed: () async {
var q1 = await _tsePlugin
.checkPartitions(SendPartitionModel(partition: "E"));
print(q1?.toJson() ?? "null");
_showMyDialog(
context, "checkPartitions E", q1?.toJson() ?? "null");
},
child: const Text("checkPartitions E")),
TextButton(
onPressed: () async {
var q1 = await _tsePlugin
.checkPartitions(SendPartitionModel(partition: "Z"));
print(q1?.toJson() ?? "null");
_showMyDialog(
context, "checkPartitions Z", q1?.toJson() ?? "null");
},
child: const Text("checkPartitions Z")),
TextButton(
onPressed: () async {
var q1 = await _tsePlugin.checkStore();
print(q1?.toJson() ?? "null");
_showMyDialog(context, "CheckStore", q1?.toJson() ?? "null");
},
child: const Text("CheckStore")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.init();
print(q);
_showMyDialog(context, "init", q?.toJson() ?? "null");
},
child: const Text("init")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.tse_initialize();
print(q);
_showMyDialog(context, "tse_initialize", q?.toJson() ?? "null");
},
child: const Text("tse_initialize")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.version();
print(q);
_showMyDialog(context, "version_helper", q?.toJson() ?? "null");
},
child: const Text("version_helper")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.isOnlineSdk();
print(q);
_showMyDialog(context, "isOnlineSdk", q?.toJson() ?? "null");
},
child: const Text("isOnlineSdk")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.signatureAlgorithm();
print(q);
_showMyDialog(
context, "signatureAlgorithm", q?.toJson() ?? "null");
},
child: const Text("signatureAlgorithm")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.logTimeFormat();
print(q);
_showMyDialog(context, "logTimeFormat", q?.toJson() ?? "null");
},
child: const Text("logTimeFormat")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.GetLogMessageCertificate();
print(q);
_showMyDialog(
context, "GetLogMessageCertificate", q?.toJson() ?? "null");
},
child: const Text("GetLogMessageCertificate")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.tse_ctss_enable();
print(q);
_showMyDialog(
context, "tse_ctss_enable", q?.toJson() ?? "null");
},
child: const Text("tse_ctss_enable")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.tse_ctss_disable();
print(q);
_showMyDialog(
context, "tse_ctss_disable", q?.toJson() ?? "null");
},
child: const Text("tse_ctss_disable")), // TextButton(
TextButton(
onPressed: () async {
var q = await _tsePlugin.tse_updateTime();
print(q?.toJson());
_showMyDialog(context, "tse_updateTime", q?.toJson() ?? "null");
},
child: const Text("tse_updateTime")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.infoFull();
print(q?.toJson());
_showMyDialog(context, "infoFull", q?.toJson() ?? "null");
},
child: const Text("infoFull")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.infoCustom();
print(q?.toJson());
_showMyDialog(context, "infoCustom", q?.toJson() ?? "null");
},
child: const Text("infoCustom")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.tse_listRegisteredClients();
print(q);
_showMyDialog(context, "tse_listRegisteredClients",
q?.toJson() ?? "null");
},
child: const Text("tse_listRegisteredClients")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.tse_registerClient(
ClientParameterModel(clientId: "Hasancik"));
print(q);
_showMyDialog(
context, "tse_registerClient", q?.toJson() ?? "null");
},
child: const Text("tse_registerClient")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.tse_deregisterClient(
ClientParameterModel(clientId: "Hasancik"));
print(q);
_showMyDialog(
context, "tse_deregisterClient", q?.toJson() ?? "null");
},
child: const Text("tse_deregisterClient")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.tse_runSelfTest(
ClientParameterModel(clientId: "Hasancik"));
print(q);
_showMyDialog(
context, "tse_runSelfTest", q?.toJson() ?? "null");
},
child: const Text("tse_runSelfTest")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.flashHealthSummary();
print(q);
_showMyDialog(
context, "flashHealthSummary", q?.toJson() ?? "null");
},
child: const Text("flashHealthSummary")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.tse_setup(TseSetupParameterModel(
credentialSeed: "SwissbitSwissbit",
adminPuk: "123456",
adminPin: "12345",
timeAdminPin: "98765",
clientId: "Hasancik",
));
print(q);
_showMyDialog(context, "tse_setup", q?.toJson() ?? "null");
},
child: const Text("tse_setup")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.user_login(LoginParameterModel(
wormUserId: LoginParameterModel.WORM_USER_ADMIN,
pin: "12345"));
print(q);
_showMyDialog(context, "user_login", q?.toJson() ?? "null");
},
child: const Text("user_login")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.user_logout(LogoutParameterModel(
wormUserId: LogoutParameterModel.WORM_USER_ADMIN,
));
print(q);
_showMyDialog(context, "user_logout", q?.toJson() ?? "null");
},
child: const Text("user_logout")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.transaction_start(TransectionParameter(
clientId: "Hasancik",
transactionNumber: "0",
processData: "",
processType: "Mahmut"));
print(q);
_showMyDialog(
context, "transaction_start", q?.toJson() ?? "null");
},
child: const Text("transaction_start")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.transaction_listStartedTransactions(
ClientParameterModel(clientId: "Hasancik"));
print(q);
_showMyDialog(context, "transaction_listStartedTransactions",
q?.toJson() ?? "null");
},
child: const Text("transaction_listStartedTransactions")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.transaction_lastResponse(
ClientParameterModel(clientId: "Hasancik"));
print(q);
_showMyDialog(
context, "transaction_lastResponse", q?.toJson() ?? "null");
},
child: const Text("transaction_lastResponse")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.transaction_update(
TransectionParameter(
clientId: "Hasancik",
transactionNumber: "1",
processData: "",
processType: "Mahmut"));
print(q);
_showMyDialog(
context, "transaction_update", q?.toJson() ?? "null");
},
child: const Text("transaction_update")),
TextButton(
onPressed: () async {
var q = await _tsePlugin.transaction_finish(
TransectionParameter(
clientId: "Hasancik",
transactionNumber: "6",
processData: "120s2s2ad1a2sd1a2s1dasd",
processType: "Mahmut"));
print(q);
_showMyDialog(
context, "transaction_finish", q?.toJson() ?? "null");
},
child: const Text("transaction_finish")),
// TextButton(
// onPressed: () async {
// var q = await _tsePlugin.worm_transaction_start(
// "Mahmut-2223322232", "200_22_222^300.33Bar", "Beleg");
// print(q);
// },
// child: const Text("worm_transaction_start")),
// TextButton(
// onPressed: () async {
// var q = await _tsePlugin
// .worm_transaction_listStartedTransactions(
// "Mahmut-2223322232");
// print(q);
// },
// child:
// const Text("worm_transaction_listStartedTransactions")),
// TextButton(
// onPressed: () async {
// var q = await _tsePlugin.worm_transaction_update(
// "Mahmut-2223322232",
// _textEditingController.text,
// "200_22_222^300.33Bar",
// "Beleg");
// print(q);
// },
// child: const Text("worm_transaction_update0")),
// TextButton(
// onPressed: () async {
// var q = await _tsePlugin.worm_transaction_finish(
// "Mahmut-2223322232",
// _textEditingController.text,
// "200_22_222^300.33Bar",
// "Beleg");
// print(q);
// },
// child: const Text("worm_transaction_finish0")),
]));
}
}