telpo_flutter_sdk

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

telpo flutter sdk

telpo_flutter_sdk #
A Flutter plugin for handling connection and communication with Telpo thermal printer devices.

💡 Motivation #
While developing MASHINPAY payment solution we've purchased Telpo thermal printers ("M1"s specifically) for printing invoice files after users' successful transaction. The Telpo devices come with a native SDK and documentation for it. Since there wasn't an official plugin for Flutter, we had to customize the plugin by ourselves. We've added so many useful methods for better handling exceptions, customizable print layout and etc.
⚙ī¸ Android setup #

Add url "https://jitpack.io" for maven to project level build.gradle file (android/build.gradle).

allprojects {
repositories {
...
maven { url "https://jitpack.io" }
...
}
}
copied to clipboard

Set the minSdkVersion as 19 in application level build.gradle file (android/app/build.gradle).

android {
defaultConfig {
...
minSdkVersion 19
...
}
}
copied to clipboard
🕹ī¸ Usage #
Initialization #
To get started, create an instance of TelpoFlutterChannel:
final _telpoFlutterChannel = TelpoFlutterChannel();
copied to clipboard
Connecting with Telpo:
final bool connected = await _telpoFlutterChannel.connect();
// Result: true, false.
copied to clipboard
Checking Telpo's status:
final TelpoStatus status = await _telpoFlutterChannel.checkStatus();
// Result: ok, noPaper, overHeat, cacheIsFull, unknown.
copied to clipboard
Checking connection status with Telpo:
final bool status = await _telpoFlutterChannel.isConnected();
// Result: true, false.
copied to clipboard
Printing a sheet:
// Creating an empty sheet
final sheet = TelpoPrintSheet();

// Creating a text element
const textData = PrintData.text(
'TelpoFlutterSdk',
alignment: PrintAlignment.center,
fontSize: PrintedFontSize.size34,
);

// Creating 8-line empty space
const spacing = PrintData.space(step: 8);

// Inserting previously created text element to the sheet.
sheet.addElement(textData);

// Inserting previously created spacing element to the sheet.
sheet.addElement(spacing);

final PrintResult result = await _telpoFlutterChannel.print(sheet);
// Result: success, noPaper, lowBattery, overHeat, dataCanNotBeTransmitted, other.
copied to clipboard
📝 Roadmap #
✅ Well-written documentation 🤓
✅ Document the platform-specific configurations.
✅ Add explanations for Enum values of PrintResult and TelpoStatus.
âŗ Print image file.
âŗ Toggle printing event via NFC. 🤩
âŗ Toggle printing event via BlueTooth, may be?
âŗ Checking if Telpo is available on the device?
🤓 Contributors #

🙏 Credits #
While we were trying to understand and port the Telpo device to the Flutter framework we got very inspiring code samples and examples from Efikas's plugin (flutter_telpo) for Flutter which can be considered as a basic version of our plugin and our plugin can be considered as more customized of his since both of us used the same native implementation of the Telpo's Android SDK which comes together with the Telpo device.
🐞 Bugs/Requests #
If you encounter any problems please open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and we'll look into it. Pull requests are welcome.
📃 License #
MIT License

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.