Page 1
Blue Bamboo P25 Development Guide Firmware version: 1.0.58 Document version: V 3.9 Document date: 2012-12-31 Products: P25 / P25-M / P25i / P25i-M...
Page 2
No part of this publication may be copied, distributed, stored in a retrieval system, translated into any human or computer language, transmitted, in any form or by any means, without the prior written consent of BLUE BAMBOO. All other brand names and trademarks in this guide are the property of Blue Bamboo.
P25 Development Guide Table of Contents Introduction ..........................1 Purpose .......................... 1 Scope ..........................1 ESC commands ........................2 Print Commands......................3 Line Space Commands ....................6 Character Commands ....................7 Keypad Button Commands ..................13 Print Position Commands ..................... 14 Bit-Image Commands ....................
Page 4
3.9.3 MSR Operation ......................65 3.9.4 Set the Time to Power Off ..................66 3.10 P25i/P25i-M Communication Protocol (Applies only to P25 Made for iPhone version)67 3.10.1 Operation Commands Format ................67 3.10.2 Operation Commands Data Dump ..............70 3.11 p25_prop_get and p25_prop_set Command ...............
P25 Development Guide 1 Introduction 1.1 Purpose This document is a guide for the basic application development of the P25 Printer product family. 1.2 Scope This document consists of the communication options and software protocols for communication with the P25.
P25 Development Guide 2 ESC commands Support command list: Customers can click page number directly to view detail command information. Instruction set Description Page LF, CR Print and line feed ESC J Print and feed paper ESC d Print and feed n lines...
P25 Development Guide ESC w Enter/Quit Bridge mode Commands 2.1 Print Commands The P25 printer supports the following commands for printing characters and feeding paper: Command LF, CR Print and feed line ESC J Print and feed paper ESC d...
Page 8
P25 Development Guide www.bluebamboo.com...
Page 9
P25 Development Guide GS k d1...dn [Name] Print bar code(one dimension) d1 … dn [Format] ASCII d1 … dn d1 … dn Decimal 0 ≤ m ≤ 4 , m = 0x49 [Range] if m=2 then n=0x0d (ean-13) if m=3 then n=0x08 (ean-8)
P25 Development Guide 2.2 Line Space Commands The P25 printer supports the following commands for setting line space. These commands can only be used for specifying line space, not actually feeding paper. The line space set through these commands affects the results of LF and ESC d and paper feeding by using FEED.
P25 Development Guide 2.3 Character Commands The printer supports the following commands for setting character font and size: Command ESC K Select ACP or UTF8 coding ESC R Select an international character set ESC ! Select print mode ESC- Turn underline mode on/off...
Page 12
Decimal 27 82 [Range] 0 , 30,65 [Description] Select an international character set n from the following table. n(hex) Character set (ISO/IEC 8859-15)Latin Character (include English, France, Germany, Spain…) Simplified Chinese UTF8(Since P25 Version S1.0.41) [Default] n = 0 www.bluebamboo.com...
Page 13
P25 Development Guide ESC ! [Name] Select print mode. [Format] ASCII ESC Decimal 0 ≤ n ≤ 255 [Range] [Description] Select print mode(s) using n as follows. Off/On Value Function Select font char/per line) eg. 1B 21 00 Select font char/per line) eg.
Page 14
P25 Development Guide GS ! can also select character size. However, the setting of the last received command is effective. This command should be placed previous than any normal printing characters in a line. [Reference] ESC -, GS ! ESC –...
Page 15
P25 Development Guide GS ! [Name] Select character size [Format] ASCII Decimal 0 ≤ n ≤ 255 [Range] [Description] Select the character height using bits 0 to 3, and select the character width using bits 4 to 7, as follows;...
Page 16
P25 Development Guide [Note] Only the lowest bit of n is valid. This command is available for built-in and user-defined characters. When white/black reverse printing mode is on, it also applies to character space set by ESC SP. This command does not affect the space between lines.
When the LSB is 1, it disables the keypad button [Note] If keypad buttons are disabled, all buttons in panel are disabled (including POWER button, in other words, user could not press key to power off P25, but user could use command to power off P25). www.bluebamboo.com...
P25 Development Guide 2.5 Print Position Commands The printer supports the following commands for setting the print position. Command ESC $ Set absolute print position ESC a Select justification Horizontal tab ESC D Set horizontal tab positions GS L Set left margin...
Page 19
P25 Development Guide ESC a [Name] Select justification [Format] ASCII ESC a 1B 61 Decimal 27 97 0≤ n ≤ 2 , 48 ≤ n ≤ 50 [Range] [Description] Aligns all the data in one line to the specified position, n selects the type of...
Page 20
P25 Development Guide [Note] The command is enabled only when processed at the beginning of the line. This command formats the justification in the printing area. This command justifies the space area according to HT, ESC $ or ESC \ [Default]...
Page 21
P25 Development Guide This command cancels the previous horizontal tab settings. If you set n=8, the print position is moved to column 9 by sending HT. Up to 32 tab positions (k=32) can be set. Data exceeding 32 tab positions is processed as normal data.
P25 Development Guide GS Q Set print direction and align [Name] Set print direction and align. [Format] ASCII GS Q n 1D 51 n [Range] n=0x00,0x01,0x02,0x10,0x11,0x12 [Description] Set the left margin using nL and nH. 00: left to right, align to left...
Page 23
P25 Development Guide Number of Dots Dot Density Dot Density Number of Data 8 dot single nL+nH x256 double nL+nH x256 0x20, 24 dot single 180DPI (nL+nHx256)x 0x32 0x21, double (nL+n Hx256 0x33 www.bluebamboo.com...
Page 24
P25 Development Guide [Note] If the values of m are out of the specified range, nL and data following are processed as normal data. The nL and nH indicate the number of dots of the bit image in the horizontal direction.
Page 25
P25 Development Guide www.bluebamboo.com...
Page 26
P25 Development Guide X 1 x y d1…dk ESC X X 4 x y d1…dk [Name] Print bit-image horizon mode [Format] ASCII ESC 1 x y d1...dk 4 x y d1...dk 1B 58 31 x y d1…dk 1B 58 34 x y d1…dk Decimal 27 88 49 x y d1…dk...
Page 27
P25 Development Guide ESC f [Name] Print downloaded bit-image. [Format] ASCII Decimal [Range] n = 0, 1, 48, 49 [Description] ESC f prints a downloaded bit image specified by n as follows: Print a downloaded bit image1 when n = 0 or n = 48, Print a downloaded bit image2 when n = 1 or n = 49.
P25 Development Guide 2.7 Miscellaneous Function Commands The P25 printer supports the following miscellaneous function commands: Command GS P Set horizontal and vertical motion units GS P x y [Name] Set horizontal and vertical motion units. [Format] ASCII GS 50 x...
Set enter power off mode time, unit is minute, after P25 enter sleep mode(ref above cmd), if no operation occurs, P25 will auto power off after this time, set to 0xFF means disable this feature( never auto power off), default setting is 15 minutes.
Page 30
This command only support those P25 equipt with new version BlueTooth module, set result save to flash, customer could display it by self test printing. If P25 equipt with old BT module, self print would display “Inctrl BT”, its act like “One Connect”...
Page 31
The default Baud rate in the bootloader firmware is 115200, and it can not be changed. These commands are only used to adjust the Baud rate in the application of the P25. Furthermore, the change will be affect only after you restart the printer.
P25 Development Guide 2.9 ESC/GS Commands with Respond Info GS I [Name] Transmit printer ID [Format] ASCII Decimal [Range] Ref following Description field Hex Decimal n Printer ID Specification [Description] 41 65 Firmware version 42 66 Manufacturer name “BlueBamboo” 43 67 Printer model...
(serial port) and Bluetooth port which connects with other device. Power on the P25 printer, it is in the normal mode by default. You can send the printer the commands of ENTER_BRIDGE_MODE to enter bridge mode, and send the commands of QUIT_BRIDGE_MODE to quit bridge mode.
P25 Development Guide 2.11 Realtime Commands OVERVIEW Character Data and Normal Commands The printer stores data sent from the host computer in the receive buffer temporarily, and then the printer interprets the data and classifies them into commands or character data sequentially. If the data from the receive buffer is a normal command, the printer processes the command corresponding to its function;...
Page 35
P25 Development Guide Binary Decimal Status Not used. Fixed to Off. Not used. Fixed to On. Not used. Not used. Online. Offline. Not used. Fixed to On. Not waiting for online recovery. Waiting for online recovery. Paper is not being fed by the paper feed button.
Page 36
P25 Development Guide • If recoverable error (bit 2) or autocutter error (bit 3) occurs due to paper jams or the like, it is possible to recover by correcting the cause of the error and executing DLE ENQ (n = 2).
Page 37
P25 Development Guide The transmitted battery status from this printer is constructed by [Header ~ NUL] as shown in the following table. Transmitted data Decimal Amount of data Header 1 byte Identifier 1 byte Power source (*1) 1 byte Battery remaining amount (*2)
“Hyper terminal” in Windows to the P25, and type something to make the printer print. If using the plain text protocol to print text, no data will be sent from the P25, so the user will have to wait until the P25 finishes printing, and the waiting time depends on the contents that are printed.
P25 Development Guide 3.2 Framing Protocol Communication Frame Structure DATA (Start Of Frame) (Type Of Frame) (End Of Frame) 1 Byte 1 Byte Variable 1Byte Type of Frame Value Field 0x06 NACK 0x15 0x05 „D‟ (0x44) DATA „E‟ (0x45) FLASH Erase „F‟...
P25 Development Guide 3.3 Process of Getting the Printer Status Figure 1 Process of getting the printer status It is recommended that the host send the same inquiry up to 5 times with 400ms time interval in case of no response from the printer.
P25 Development Guide 3.4 Printing Data Figure 2 Process of printing data Note: The “Sending ENQ frame” is optional, it just let app know whether print is working normally, customer could print data without sending this frame (that is only sending data frame). And sending EOT frame is also optional.
Data Length: “0001” ~ “3000”. Each number must be an ASCII code, the highest byte of Data Length should be transmitted first, P25 does not support printing more than 3000 characters per frame. Checksum: 2 bytes. The first byte is the result of XORing the even parts of data in the Print Data field and the second byte is from doing the same to the odd numbers.
P25 Development Guide 3.4.2 Format of ENQ Frame C0H(SOF) 0x05(TOF) C1H(EOF) It is recommended that the host send the same ENQ frame up to 10 times with 400ms time interval pauses in case there is no response from the printer.
P25 Development Guide 3.5 Downloading Data for Updating Flash P25 need update its firmware, font, and picture resource. It could be done by P25DeviceMgr. 3.5.1 Process of Software Update Figure 3 Process of software update www.bluebamboo.com...
P25 Development Guide 3.5.2 Resource Files and Their Format There are several resource files for update. Resource File Type File extension name Destination address Description Fixed destination *.app 0x80008000 Firmware File address *.font 0x80040000 Font File, Deprecated *.pic 0x801e0000 Pic File, Deprecated Variable destination *.ap2...
It means enter dowload operation. It send to P25, P25 would reply a ACK package. „F‟(0x46) (SOF) (TOF) (EOF) C. Flash Erase Package It send to P25, P25 would replay EOT and ETX package, just like reply of Printing package. Format of Flash Erase Frame „E‟(0x45) DATA ID DATA CHECK...
P25 Development Guide 3.6 MSR Not Encrypted MSR operation support both ISO card and JIS2 card. There is 3 tracks data in ISO card, there is only 1 tracks data in JIS2 card, JIS2 card is a Japanese standard card.
P25 Development Guide 3.6.2 MSR Response Frame Format DATA in clear text „H‟(0x48) DATA ID DATA CHECK (SOF) (TOF) Number Length DATA (EOF) The „DATA‟ field contains the three tracks of MSR data, the format of each track is: Track No...
P25 Development Guide 3.7 MSR DUKPT P25 support several type of DUKPT encrypt method: Name Algor Key Type Padding Mode P25EncryptApp command TriDes Pin TriDes PKCS7 msr_dukpt(_iphone) TriDes data TriDes data Zero Padding msr_dukpt_jp(_iphone) AES data data Zero Padding msr_dukpt_aes(_iphone) 3.7.1 Format of Set DUKPT KSN and Initial Key (Request)
P25 Development Guide 3.7.2 Format of Set DUKPT KSN and Initial Key (Response) This Data is respond from P25 to program like Device Manager. (0x9C) DATA ID DATA Versio Algor Reserved Result (SOF) Number Length (EOF) C0 9C 36 30 30 30 34 01 04 00 00 01 04 C1...
Page 52
Specify the data encryption protocol version. It should be 0x02 Key ID (RFU) Specify which key is used to encrypt data. P25 supports only one key right now. Its value should be 0x00. Alg ID Specify the type of data encryption and key management...
P25 Development Guide 3.7.5 MSR TriDes Data Encryption Request Please ref readme.txt of P25EncryptApp package. 3.7.6 MSR TriDes Data Encryption Respond ISO card and JIS2 card‟s respond format is different. Detail please ref readme.txt of P25EncryptApp package. 3.7.7 MSR AES Data Encryption Request Please ref readme.txt of P25EncryptApp package.
P25 Development Guide 3.8 MK/SK Encrypted The purpose to set MK and SK is to ensure the printing commands in P25 safer than before. The user can set MK/SK according to their request. 3.8.1 Encrypt Algorism MK/SK only use 3Des algorism, Make message padding to multiple of 8 bytes first then using pkcs#5, for eg: data:...
Page 55
P25 Development Guide REQUEST: Eg Data Content Length Explain start of frame CMD_SET_MASTER_KEY_DOWN_REQ data id 30 30 35 31 data len Version Algor, ENCRYPT_ALG_3DES key id 12 34..34 56 master key 08 E1 frame end RESPONSE: Eg Data Content Length...
The customer can encrypt the card information by setting session key which length is 24 bytes in P25 printer. Session key only in ram, if customer begin new session, better renew it, Sync session key: Use command "./P25EncryptApp sync_session_key_down"...
Page 57
P25 Development Guide CT_ENCRYPT_WITH_MASTER data id 30 30 33 data len Version key id Algor, ENCRYPT_ALG_3DES ENCRYPTED_WITH_MASTER_KEY(CMD_SET_SESSION_KEY,SE SSION_KEY,CRC,PADDING) after decrypt, it would be: 87...B6 Eg data content Length Explain CMD_SYNC_SESSION_KEY_DOWN_ ??...?? 24 bytes session_key 2F 06 end of frame RESPONSE:...
3.8.5 Print Encrypted Information by Session Key The following operation is a combined operation. Sync session key for the encrypted information first then print it out through P25 printer. This paragraph only explains the format of printing encrypted information. Sync session key and print string "abc"...
Length: 0003, Data: C0 05 C1 [00000023] IRP_MJ_READ Length: 0006, Data: 00 C0 06 C1 0D 0A Just confirm P25 works OK, or following send msr command may timeout for long time, it would confuse user, but this command is option [00000024] IRP_MJ_WRITE...
Page 61
P25 Development Guide ??...?? timeout, eg "32 30" means msr timeout would be 20 second D4 73 end of frame [00000435] IRP_MJ_READ Length: 0136 Data: C0 81 37 30 31 32 33 01 01 01 FD 78 C8 99 42 BA 7F 2B E8 5D E5 89 EB 4A 77...
P25 Development Guide 3.8.7 Attention When define protocol format, because carelessness, in those MK/SK commands format, those encrypt format and those not encrypt format's ALGOR and keyid order reversed. In Encrypted Package: Keyid, ALGOR In Non-Encrypted Package: ALGOR, Keyid (include SET_MASTER_KEY_REQUEST, SET_MASTER_KEY_RESPONSE, SYNC SESSION_KEY_RESPONSE) www.bluebamboo.com...
Note: Step 1. Query P25 Status Step 2. P25 report no error, The 00 Byte indicates no error Step 3. P25 report no paper, The 01 Byte indicates no paper or cover open Error Indicate Byte Meaning: 00 ----------- No error 01 ----------- No paper or cover open 04 ----------- Printer header‟s temperature too high...
Page 64
P25 Development Guide Description: C0: start tag 44: print command 32: frame sequence 30 30 31 37: 17 bytes data 1d 6b 02 0d: barcode format 36..32: barcode data 23: odd check 66: even check C1: end tag b) print 2D barcode Barcode content: Hello, world! A PDF417 example.
Page 65
P25 Development Guide Description: C0: start tag 44: print command 34: frame sequence 30 30 33 33: 33 bytes data 1b 4b 31: UTF-8 1b 21 11: double width double height based on small font size 1b 2d 00: underline off 1d 42 00: reverse off 57..6f: text content...
Page 66
P25 Development Guide d) print Chinese text (use UTF-8 which is often used in phone) print content:欢迎使用蓝竹打印机\n d1) small font size: Frame Content: c0 44 37 30 30 34 31 1b 4b 31 1b 21 01 1b 52 30 ef bb bf e6 ac a2 e8 bf...
Page 67
P25 Development Guide 1b 52 30: Chinese language ef..0a: text data df: odd check ea: even check C1: end tag d4) double big font size: Frame Content: c0 44 30 30 30 34 31 1b 4b 31 1b 21 18 1b 52 30...
Page 68
P25 Development Guide 1B 58 31 07 2C ----------------------------command itself, every dotline has 0x07 Bytes, total 0x2c dot lines. 00 00 07 E0 00 00 00 -----------------------------fist dotline data 00 00 78 1F 00 00 00 -----------------------------second dotline data 00 01 80 C0 C0 00 00...
Set enter power off mode time, unit is minute, after P25 enter sleep mode(ref above cmd), if no operation occurs, P25 will auto power off after this time, set to 0xFF means disable this feature( never auto power off), default setting is 15 minutes.
Page 71
P25 Development Guide 3.10 P25i/P25i-M Communication Protocol (Applies only to P25 Made for iPhone version) Depending on printer model, P25i/P25i-M is a special Printer that can working with iPhone/iPod Touch through Bluetooth or special serial cable. It has two operations, Print receipt and read MSR read protocolString "com.bluebamboo.p25i", protocolIndex 1...
Page 72
P25i/P25i-M need(s) to wait when MSR Read is processing. 3.10.1.4 MSR Result Command Direction: P25i/P25i-M printer(s)--to-->iPhone If MSR read has been already processed, P25 will send a print response message to iPhone with process result. For example:...
Page 73
P25 Development Guide 31 30 31 30 30 31 30 3D 31 30 31 32 32 30 31 31 31 34 33 38 37 38 30 38 39 3F 33 30 30 30 The above example means MSR Read operation is succeed. In the Command “55 66 77 88” is Operation flag,“84”...
Length: 0010 Data: FF 55 06 00 41 00 03 00 40 76 3.11 p25_prop_get and p25_prop_set Command Application could ask P25‟s property, and got reply. It support both BlueBamboo protocol (C0..C1) and iPhone protocol. Following list some property that supported:...
Developers can copy and modify this code to accelerate their development. Please see the Software license agreement at the end of this text which applies to all Blue Bamboo software products. When using this software, you are agreeing to the Software license agreement.
P25 Development Guide Instructions 1. This Source Code consists of: two code samples located in folders‟P25_Console_Demo‟ and „P25_Console_Msr‟, P25_Print_Demo.bat and P25_Print_Demo.txt files described above. 2. This demo should be compiled in Visual C++ Studio, users of other development tools can print string and test ESC command.
This code has been extended from Blue Bamboo's Developer Network as a reference for customer use. Blue Bamboo is not the author of this code and takes no liability in warranting/supporting it. Please review the Blue Bamboo Software License Agreement packaged with this source code.
P25 Development Guide 4.4.4 Procedure Using the Reference Code: 1. When the application is started it first appears minimized in the tray. a. If the application was previously run and a device bonded to the virtual port, the connection will automatically reestablish.
(the P25 Reference Code). In consideration for BLUE BAMBOO allowing you to access the P25 Reference Code, you are agreeing to be bound by the terms of this Agreement. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, DO NOT INSTALL THE P25 Reference Code.
BLUE BAMBOO shall be under no obligation to assist Licensee to use, execute, perform or copy the P25 Reference Code, or to provide support to Licensee of the P25 Reference Code, or to provide maintenance, correction, modification, enhancement, or upgrades to the P25 Reference Code.
BLUE BAMBOO P25 Reference Code. 4.5.12 Intellectual Property Ownership BLUE BAMBOO shall retain title to and ownership of all proprietary rights with respect to the P25 Reference Code and copies thereof. LICENSEE shall retain title to and ownership of all...
3. If the last device that P25 connected with was an iOS device, it would try to connect to the last iOS device twice when P25 is power on. It will take about 1 minute. At this time, Led of P25 would flash and other mobile phone cannot connect to P25.
Need help?
Do you have a question about the P25 and is the answer not in the manual?
Questions and answers