[go: up one dir, main page]

CN110515570B - Picture data compression transmission printing method based on BLE technology - Google Patents

Picture data compression transmission printing method based on BLE technology Download PDF

Info

Publication number
CN110515570B
CN110515570B CN201910809715.4A CN201910809715A CN110515570B CN 110515570 B CN110515570 B CN 110515570B CN 201910809715 A CN201910809715 A CN 201910809715A CN 110515570 B CN110515570 B CN 110515570B
Authority
CN
China
Prior art keywords
ble
picture
data terminal
mobile data
bluetooth
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910809715.4A
Other languages
Chinese (zh)
Other versions
CN110515570A (en
Inventor
鲁霖
童方园
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamenshi C Chip Co ltd
Original Assignee
Xiamenshi C Chip Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamenshi C Chip Co ltd filed Critical Xiamenshi C Chip Co ltd
Priority to CN201910809715.4A priority Critical patent/CN110515570B/en
Publication of CN110515570A publication Critical patent/CN110515570A/en
Application granted granted Critical
Publication of CN110515570B publication Critical patent/CN110515570B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1278Dedicated interfaces to print systems specifically adapted to adopt a particular infrastructure
    • G06F3/1292Mobile client, e.g. wireless printing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/005Discovery of network devices, e.g. terminals
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Editing Of Facsimile Originals (AREA)

Abstract

The invention belongs to the field of Bluetooth printing methods, and particularly relates to a picture data compression transmission printing method based on BLE technology, which comprises the following steps that firstly, a mobile data terminal searches Bluetooth printing equipment, and BLE connection is established and data is transmitted; step two, a user selects a digital picture to be printed through the mobile data terminal; the mobile data terminal converts the digital picture into hexadecimal character strings; step three, the mobile data terminal compresses the character string converted into hexadecimal character string and converts the hexadecimal character string into binary data; and step four, the mobile data terminal transmits binary data to the Bluetooth printing equipment through BLE to carry out paper picture printing operation. The beneficial effects are that: the data compressed by the method reduces half of data volume and greatly improves BLE transmission efficiency.

Description

Picture data compression transmission printing method based on BLE technology
Technical Field
The invention belongs to the field of Bluetooth printing methods, and particularly relates to a picture data compression transmission printing method based on BLE technology.
Background
With the gradual development and popularization of bluetooth photo printing technology, mobile data terminals generally use two characters (16 bits) to transmit 8-bit graphic data to a bluetooth printing device for photo printing, but the method has disadvantages: when the amount of the print picture data is large, the time consumption is long, the efficiency is low, and the user experience is affected.
Disclosure of Invention
In order to solve the technical problems, the invention provides a picture data compression transmission printing method based on BLE technology, which compresses printing data by optimizing the step flow of the method, thereby improving printing efficiency and user experience.
The specific technical scheme is as follows: a picture data compression transmission printing method based on BLE technology comprises a mobile data terminal and a Bluetooth printing device;
the mobile data terminal comprises a BLE unit;
the Bluetooth printing device comprises a BLE module and a printing module;
the method comprises the following steps:
step one (S101), a mobile data terminal searches Bluetooth printing equipment, and BLE connection is established and data is transmitted;
step two (S102), a user selects a digital picture to be printed through a mobile data terminal; the mobile data terminal converts the digital picture into hexadecimal character strings;
step three (S103), the mobile data terminal compresses the hexadecimal character strings and converts the hexadecimal character strings into binary data;
and step four (S104), the mobile data terminal transmits the binary data to the Bluetooth printing equipment through BLE to carry out paper picture printing operation.
Preferably, the method for compressing, transmitting and printing picture data based on BLE technology specifically comprises the following steps: a user starts a mobile data terminal BLE unit to scan and acquire UUIDs of peripheral Bluetooth devices; and the BLE unit automatically judges the Bluetooth printing equipment according to the agreed UUID characteristic value and is connected with the BLE module and performs data interaction.
Preferably, the second step in the picture data compression transmission printing method based on BLE technology specifically comprises: the printing picture is a black-white picture, so that the conversion of hexadecimal character strings is black-white processing; taking the color value of each point of the picture, comparing the color value with a 128 intermediate value, and if the value is more than 128 and is set to be 1, setting the value to be less than 128 and 0; the algorithm code is as follows:
+ (NSMutableString *)hexFromImage:(UIImage *)image {
NSMutableString *str = [[NSMutableString alloc] init];
...
CGImageRef inImage = image.CGImage;
A g size_t w = CGImageGetWidth(inImage);
size_t h = CGImageGetHeight(inImage);
CGContextRef cgctx = [self createARGBBitemapContextFromImage];
Unsigned char *data = CGBitmapContextGetData(cgctx);
for (int y=0; y<image.size.height; y++){
int bit =128;
int currentValue = 0;
NSMutableString *sb = [[NSMutableString alloc] init];
for (int x = 0; x < image.size.width; x++) {
NSInteger intensity = 0;
int offset = 4*((w*round(y))+round(x));
int alpha = data[offset];
int red = data[offset+1];
int green = data[offset+2];
int blue = data[offset+3];
if (alpha == 0) {
intensity = 0;
}else{
intensity = 255 - (alpha + red + green + blue) / 4;
}
if (intensity >= 128) {
currentValue |= bit;
bit = bit >> 1;
[sb appendString:@"1"];
}else{
currentValue &= ~bit;
bit = bit >> 1;
[sb appendString:@"0"];
}
if (bit == 0) {
[str appendFormat:@"%@",[self ToHex:currentValue]];
bit = 128;
currentValue = 0;
}
}
}
...
return str;
}
and splicing the values obtained from each point of the picture into a character string, and providing the character string for compression in the third step.
Preferably, the method for compressing, transmitting and printing picture data based on BLE technology comprises the following steps: the mobile data terminal compresses and converts the obtained hexadecimal character strings into binary;
the algorithm code is as follows:
compression of 8-bit graphic data of two character string representations into 1 character string representation
- (NSdata *)compressImgString:(NSString *)str {
for (int i=0; i<istr.length/2; i++) {
NSString *str = [str substringWithRange:NSMakeRange(i*2, 2)];
NSString *str1 = [str substringWithRange:NSMakeRange(0, 1)];
NSString *str2 = [str substringWithRange:NSMakeRange(1, 1)];
int i = [self intFromStr:str1];
int j = [self intFromStr:str2];
int value = (i<<4) + j;
Byte byte[1] = {value};
[encodeData appendBytes:byte length:1];
}
}
Serial string conversion int of// 16 system
- (int) intFromStr:(NSString *)str {
if ([str isEqualToString:@"0"]) {
return 0;
} else if ([str isEqualToString:@"1"]) {
return 1;
} else if ([str isEqualToString:@"2"]) {
return 2;
...
}
else if ([str isEqualToString:@"9"]) {
return 9;
} else if ([str isEqualToString:@"A"]) {
return 10;
}
...
else if ([str isEqualToString:@"F"]) {
return 15;
}
return 0;
}
Preferably, the mobile data terminal related to the picture data compression transmission printing method based on the BLE technology is a smart phone, a tablet computer, a notebook computer, a smart watch or smart glasses; the Bluetooth printing device is a handheld Bluetooth printer.
Preferably, in the picture data compression transmission printing method based on the BLE technology, a user controls the mobile data terminal by controlling the APP.
After the technical scheme is adopted, the invention has the beneficial effects that:
compared with the disclosed technical scheme, the technical scheme solves the problems of long picture data transmission time, low efficiency, poor user experience and the like in the picture data transmission method in the prior art by using the picture data Bluetooth transmission printing system and method. The data compressed by the method reduces half of data volume and greatly improves BLE transmission efficiency; through actual measurement contrast, the example of the compression algorithm is added, the printing speed is obviously improved, the picture effect can also reach the customer requirement, and the user experience is greatly improved.
Drawings
Fig. 1 is a schematic diagram of a system involved in a picture data compression transmission printing method based on BLE technology;
fig. 2 is a flowchart illustrating steps of a picture data compression transmission printing method based on BLE technology.
Detailed Description
The system shown in fig. 1 comprises a mobile data terminal and a bluetooth printing device;
the mobile data terminal comprises a BLE unit;
bluetooth printing device includes BLE module, print module.
The mobile data terminal can be a smart phone, a tablet computer, a notebook computer, a smart watch, smart glasses and the like; in the mobile data terminal of the embodiment, a part of smart phone is taken as an example; the bluetooth printing apparatus is exemplified by a hand-held bluetooth printer.
Please refer to fig. 2, which is a picture data compression transmission printing method based on BLE technology, which mainly includes the following steps:
step one (S101), searching a handheld Bluetooth printer by using a smart phone APP, establishing BLE connection and transmitting data; a user starts a BLE unit of the smart phone to scan and acquire UUIDs of peripheral Bluetooth devices; and the BLE unit automatically judges the handheld Bluetooth printer according to the agreed UUID characteristic value and is connected with the BLE module and performs data interaction.
Step two (S102), a user selects a digital picture to be printed through a smart phone APP; the intelligent mobile phone APP converts the digital picture into hexadecimal character strings; the printing picture is a black-white picture, so that the conversion of hexadecimal character strings is black-white processing; taking the color value of each point of the picture, comparing the color value with a 128 intermediate value, and if the value is more than 128 and is set to be 1, setting the value to be less than 128 and 0; the algorithm code is as follows:
+ (NSMutableString *)hexFromImage:(UIImage *)image {
NSMutableString *str = [[NSMutableString alloc] init];
...
CGImageRef inImage = image.CGImage;
A g size_t w = CGImageGetWidth(inImage);
size_t h = CGImageGetHeight(inImage);
CGContextRef cgctx = [self createARGBBitemapContextFromImage];
Unsigned char *data = CGBitmapContextGetData(cgctx);
for (int y=0; y<image.size.height; y++){
int bit =128;
int currentValue = 0;
NSMutableString *sb = [[NSMutableString alloc] init];
for (int x = 0; x < image.size.width; x++) {
NSInteger intensity = 0;
int offset = 4*((w*round(y))+round(x));
int alpha = data[offset];
int red = data[offset+1];
int green = data[offset+2];
int blue = data[offset+3];
if (alpha == 0) {
intensity = 0;
}else{
intensity = 255 - (alpha + red + green + blue) / 4;
}
if (intensity >= 128) {
currentValue |= bit;
bit = bit >> 1;
[sb appendString:@"1"];
}else{
currentValue &= ~bit;
bit = bit >> 1;
[sb appendString:@"0"];
}
if (bit == 0) {
[str appendFormat:@"%@",[self ToHex:currentValue]];
bit = 128;
currentValue = 0;
}
}
}
...
return str;
}
and splicing the values obtained from each point of the picture into a character string, and providing the character string for compression in the third step.
Step three (S103), the smart phone APP converts the hexadecimal character strings into hexadecimal character strings to be compressed and converted into binary data;
the algorithm code is as follows:
compression of 8-bit graphic data of two character string representations into 1 character string representation
- (NSdata *)compressImgString:(NSString *)str {
for (int i=0; i<istr.length/2; i++) {
NSString *str = [str substringWithRange:NSMakeRange(i*2, 2)];
NSString *str1 = [str substringWithRange:NSMakeRange(0, 1)];
NSString *str2 = [str substringWithRange:NSMakeRange(1, 1)];
int i = [self intFromStr:str1];
int j = [self intFromStr:str2];
int value = (i<<4) + j;
Byte byte[1] = {value};
[encodeData appendBytes:byte length:1];
}
}
Serial string conversion int of// 16 system
- (int) intFromStr:(NSString *)str {
if ([str isEqualToString:@"0"]) {
return 0;
} else if ([str isEqualToString:@"1"]) {
return 1;
} else if ([str isEqualToString:@"2"]) {
return 2;
}
...
else if ([str isEqualToString:@"9"]) {
return 9;
} else if ([str isEqualToString:@"A"]) {
return 10;
...
}
else if ([str isEqualToString:@"F"]) {
return 15;
}
return 0;
}
And step four (S104), the smart phone APP transmits binary data to the handheld Bluetooth printer through BLE to carry out paper picture printing operation.
It is known from the technical knowledge that the present technical solution can be implemented by other embodiments without departing from the spirit or essential characteristics thereof. Accordingly, the above disclosed embodiments are illustrative in all respects, and not exclusive. All changes that come within the scope of the invention or equivalents thereto are intended to be embraced therein.

Claims (4)

1. A picture data compression transmission printing method based on BLE technology comprises a mobile data terminal and a Bluetooth printing device;
the mobile data terminal comprises a BLE unit;
the Bluetooth printing device comprises a BLE module and a printing module;
the method is characterized by comprising the following steps of:
step one (S101), a mobile data terminal searches Bluetooth printing equipment, and BLE connection is established and data is transmitted;
step two (S102), a user selects a digital picture to be printed through a mobile data terminal; the mobile data terminal converts the digital picture into hexadecimal character strings;
step three (S103), the mobile data terminal compresses the hexadecimal character strings and converts the hexadecimal character strings into binary data;
step four (S104), the mobile data terminal transmits binary data to the Bluetooth printing equipment through BLE to carry out paper picture printing operation;
the second step is specifically as follows: the print picture is a black-and-white picture; converting hexadecimal character strings into black and white processing; taking the color value of each point of the picture, comparing the color value with a 128 intermediate value, and if the value is more than 128 and is set to be 1, setting the value to be less than 128 and 0; the algorithm code is as follows:
splicing the values obtained from each point of the picture into a character string, and providing the character string for compression in the third step;
the third step is specifically as follows: the mobile data terminal compresses and converts the obtained hexadecimal character strings into binary;
the algorithm code is as follows:
2. the method for compressing, transmitting and printing picture data based on BLE technology according to claim 1, wherein the first step is as follows: a user starts a mobile data terminal BLE unit to scan and acquire UUIDs of peripheral Bluetooth devices; and the BLE unit automatically judges the Bluetooth printing equipment according to the agreed UUID characteristic value and is connected with the BLE module and performs data interaction.
3. The BLE technology-based picture data compression transmission printing method according to claim 1, wherein: the mobile data terminal is a smart phone, a tablet personal computer, a notebook computer, a smart watch and smart glasses; the Bluetooth printing device is a handheld Bluetooth printer.
4. The BLE technology-based picture data compression transmission printing method according to claim 1, wherein: the user controls the mobile data terminal by manipulating the APP.
CN201910809715.4A 2019-08-29 2019-08-29 Picture data compression transmission printing method based on BLE technology Active CN110515570B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910809715.4A CN110515570B (en) 2019-08-29 2019-08-29 Picture data compression transmission printing method based on BLE technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910809715.4A CN110515570B (en) 2019-08-29 2019-08-29 Picture data compression transmission printing method based on BLE technology

Publications (2)

Publication Number Publication Date
CN110515570A CN110515570A (en) 2019-11-29
CN110515570B true CN110515570B (en) 2024-02-13

Family

ID=68628150

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910809715.4A Active CN110515570B (en) 2019-08-29 2019-08-29 Picture data compression transmission printing method based on BLE technology

Country Status (1)

Country Link
CN (1) CN110515570B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119342080A (en) * 2024-12-19 2025-01-21 国网山东省电力公司莒县供电公司 Directional movement automatic control method and device for substation switch cabinet placement

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1137649A (en) * 1995-02-09 1996-12-11 佳能株式会社 Printing system, printing apparatus, information processing apparatus and storage medium storing font download control program
US6166824A (en) * 1997-01-22 2000-12-26 Brother Kogyo Kabushiki Kaisha Print data processing and compression apparatus
CN101498996A (en) * 2008-02-02 2009-08-05 艾威梯软件技术(北京)有限公司 Method and equipment for printing based on Bluetooth communication
EP2565775A2 (en) * 2011-09-01 2013-03-06 Heidelberger Druckmaschinen AG Method for producing a printed product

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070247655A1 (en) * 2006-04-21 2007-10-25 Microsoft Corporation Dynamic printer system
JP4953905B2 (en) * 2007-04-27 2012-06-13 キヤノン株式会社 Image processing apparatus, image processing method, and program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1137649A (en) * 1995-02-09 1996-12-11 佳能株式会社 Printing system, printing apparatus, information processing apparatus and storage medium storing font download control program
US6166824A (en) * 1997-01-22 2000-12-26 Brother Kogyo Kabushiki Kaisha Print data processing and compression apparatus
CN101498996A (en) * 2008-02-02 2009-08-05 艾威梯软件技术(北京)有限公司 Method and equipment for printing based on Bluetooth communication
EP2565775A2 (en) * 2011-09-01 2013-03-06 Heidelberger Druckmaschinen AG Method for producing a printed product

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
NSMakeRange用法;贴身护卫;《CSDN》;20141126;第1页 *
将RGBA颜色转换为16进制的颜色;前端精髓;《CSDN》;20180811;第1页 *

Also Published As

Publication number Publication date
CN110515570A (en) 2019-11-29

Similar Documents

Publication Publication Date Title
CN101990095A (en) Method and apparatus for generating compressed file, camera module associated therewith, and terminal including the same
CN101341731A (en) Image transmission method and system
CN110515570B (en) Picture data compression transmission printing method based on BLE technology
CN103716505A (en) Image recognition system and method
CN111654721A (en) Video processing method, system, electronic device and storage medium
CN116016693A (en) A method and system for compressing and processing print data of a portable printer
CN1302149A (en) Image communication equipment and method
EP1555621A1 (en) Device, communication system and method for data format conversion for wire/wireless local-area communication between wireless portable terminal and wire communication device
CN101651958B (en) Method and device for transmitting and receiving wireless G3 analog facsimile business
CN101587373A (en) Method, system and device for displaying input information
CN101515964A (en) Mobile telephone integrating functions of receiving and sending fax
US7164792B2 (en) Method and apparatus for compressing images using color palettes and rare colors
CN102118493A (en) Smart phone with master device and slave device and application method thereof
KR20000059275A (en) MGMS; Multiple Graphic Message System and Service
TW200713006A (en) Mobile printing interface apparatus using wireless communication between mobile terminal and printing device and printing method using the same
US20090122373A1 (en) Image Processing Apparatus
CN100420283C (en) Image sensor and computer system utilizing the same image sensor
US7058308B2 (en) Method for communicating multimedia data between electronic devices by means of IR ray
CN110515571A (en) A kind of image data Bluetooth transmission print system and method based on dither algorithm
US8090362B2 (en) Mobile electronic device and method for displaying characters on a bluetooth device
CN107734345B (en) Picture datamation transmission method and system
US20050070224A1 (en) Method of using external electronic device on fixed platform to operate short messages through mobile communication device
CN111601292A (en) Wearable device image transmission system and method based on close-range broadcasting
CN221127359U (en) Satellite internet of things transmission terminal with picture compression function
CN105306139A (en) Transmission device, system and method for electronic document

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant