Posts tagged ‘bluetooth’

Development: Windows 10 UWP Wireless Label/Receipt printer demo

As I already wrote the small demo apps for wireless printing of Label and Receipts for Android and Windows Phone 8, I now wrote such demo now for Windows UWP. The applciation was tested on a Windows 10 Phone running Windows 10 Iot Enterprise Edition.

The code is based on the Windows Universal Sample app BTRFCommChat, but uses a different, single page layout.

layout_designer     wp_ss_20160811_0001   wp_ss_20160811_0003   wp_ss_20160811_0005

Continue reading ‘Development: Windows 10 UWP Wireless Label/Receipt printer demo’ »

Android development: btPrint4 prints demos and files to Bluetooth receipt and label printers

This is an update to my btPrint4 android application. The app now supports ‘printing’ of files. You are no longer tied to the provided demo files. ‘Printing’ here means it sends the file as is to the printer. So, watch your step and do not send files that your printer does not understand.

btprin4_file_main  btprint4_file_selected  btprint4_file_browse

Added a file browser activity: a class named item to hold file informations, a FileChooser class and a FileArrayAdapter. Then the needed layout files are added.

Continue reading ‘Android development: btPrint4 prints demos and files to Bluetooth receipt and label printers’ »

Windows Phone 8: print demo for bluetooth label/receipt printers

This is the description of my btPrint demo app to print demo files to portable bluetooth label/receipt printers. I already did the same app for android and now wanted to do the same for windows phone 8.

The app starts with the main screen where you select a bluetooth printer, connect, select a demo file and let it print.

btprint_main_start_bt_and_file_selected btprint_demolist
Continue reading ‘Windows Phone 8: print demo for bluetooth label/receipt printers’ »

Android development: a Bluetooth label/receipt printing demo

BtPrint4

A Bluetooth Label printer demo

This is my first Android project and I had to learn how to get an Android activity working. I am a Windows Mobile C# developer and had to learn that you have to do many handwritten code in compare to what Visual Studio for SmartDevice development does automatically.

An Android activity consists of many, many files with references to each other. Fortunately an IDE helps you creating and finding all the files and references.

I started with Eclipse and ADT but went over to use Android Studio. Eclipse showed very strange behaving when designing the GUI of my activities.

functions

To print to a bluetooth printer we need several functions:

  • A reference to the printer, the BT MAC address
  • A socket to communicate with the printer
  • A set of demo data

Make the activity more user friendly

  • provide a list of Bluetooth devices nearby to be used as target
  • move the communication part to a background thread
  • a list with demo data

implementation

The UI has an EditText holding the BT MAC address and a TextView to hold the demo data reference. Buttons for BT discovery, Connect/Disconnect, Demo select and a Print button. There are two list activities (separate windows or forms): the BT device list and a demo data list. The BT MAC address is filled either manually or by selecting a BT device from the list.

btprint4_main

I always try to keep code re-useable and so I implemented some helper classes. Continue reading ‘Android development: a Bluetooth label/receipt printing demo’ »