bluetooth print trouble brother mw 140 bt

User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

bluetooth print trouble brother mw 140 bt

Post by Richard Chidiak »

Hello

I have purchased a bluetooth standalone printer Brother MW-140 BT

The communication is established between my pocket pc , hp ipaq 6515 and the printer and i can print any text documment or word document from the ppc.
The com ports are : Input 4, and Output 5
all params are ok

I can not print via fwppc (bluetooth program changing the correct ports), nothing happens. The handle is returned ok at opening com device but nothing prints... I can not figure out what an be wrong, any help will be welcome.

Tia

Richard

Sample of the code :

#include "FWCE.ch"

#define GENERIC_READ 0x80000000
#define GENERIC_WRITE 0x40000000
#define OPEN_EXISTING 3
#define FILE_ATTRIBUTE_NORMAL 0x00000080
#define FILE_FLAG_OVERLAPPED 0x40000000

function Main()

/*
hCom = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // must be opened with exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
*/
local oWnd
local hOut := CreateFile( "COM5:",GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL )
// local hIn := CreateFile( "COM4:", GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL )

DEFINE WINDOW oWnd TITLE "BlueTooth"

@ 2, 2 BUTTON "Send" ;
ACTION SendText( hOut, "Hello world!" ) SIZE 80, 20

ACTIVATE WINDOW oWnd

CloseHandle( hOut )
// CloseHandle( hIn )

return nil

function SendText( hOut, cText )

local n

for n = 1 to Len( cText )
WriteByte( hOut, Asc( SubStr( cText, n, 1 ) ) )
next

return nil
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Richard,

Try this change:

Code: Select all

for n = 1 to Len( cText ) 
   MsgInfo( WriteByte( hOut, Asc( SubStr( cText, n, 1 ) ) ) ) 
next 
You should get .T. on each WriteByte() call
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Antonio Linares wrote:Richard,

Try this change:

Code: Select all

for n = 1 to Len( cText ) 
   MsgInfo( WriteByte( hOut, Asc( SubStr( cText, n, 1 ) ) ) ) 
next 
You should get .T. on each WriteByte() call
Antonio

I get .t. on each call but nothing prints

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Richard,

Try closing the handle after sending the bytes:

Code: Select all

@ 2, 2 BUTTON "Send" ; 
ACTION ( SendText( hOut, "Hello world!" ), CloseHandle( hOut ) ) SIZE 80, 20 

ACTIVATE WINDOW oWnd 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Antonio Linares wrote:Richard,

Try closing the handle after sending the bytes:

Code: Select all

@ 2, 2 BUTTON "Send" ; 
ACTION ( SendText( hOut, "Hello world!" ), CloseHandle( hOut ) ) SIZE 80, 20 

ACTIVATE WINDOW oWnd 
Anotonio

Same behaviour, no change.

Does not print

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Richard,

You may use free http://www.symcod.com/BillSerialMonitor.zip to monitor the communication.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Antonio Linares wrote:Richard,

You may use free http://www.symcod.com/BillSerialMonitor.zip to monitor the communication.
Antonio

The link is for win32 , not for wince

How can i monitor the communication between the ppc and the printer ?

Thanks

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Jon Munro
Posts: 42
Joined: Sun Oct 09, 2005 11:47 am
Location: Brisbane Australia
Contact:

Post by Jon Munro »

Richard
My application writes out via BT using similar code. Except I always use:
#define GENERIC_REWRITE 0xC0000000
instead.
Monitoring is a problem - the emulator is flaky and BillSerialMonitor doesn't like BT ports...
hth
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Richard,

Sorry, we don't know how to monitorize it yet.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Jon Munro wrote:Richard
My application writes out via BT using similar code. Except I always use:
#define GENERIC_REWRITE 0xC0000000
instead.
Monitoring is a problem - the emulator is flaky and BillSerialMonitor doesn't like BT ports...
hth
Jon

Thank you for the reply, but still with GENERIC_REWRITE this printer will not print from fwppc.... I really do not know why ! I can print the txt file from the print panel without problems but not from my app.

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Antonio Linares wrote:Richard,

Sorry, we don't know how to monitorize it yet.
Antonio :D

Not a problem for the moment, i am just puzzled why it does not want to print.

I will try next week on another type of BT printer.

Regards

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Jon Munro
Posts: 42
Joined: Sun Oct 09, 2005 11:47 am
Location: Brisbane Australia
Contact:

Post by Jon Munro »

Richard,
Perhaps its a flow control issue - is it using Xon/Xoff ?
hth
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Jon Munro wrote:Richard,
Perhaps its a flow control issue - is it using Xon/Xoff ?
hth
Jon

I do not know how to control if it is using xon/xoff

Where can i check this ?

Tia

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
User avatar
Jon Munro
Posts: 42
Joined: Sun Oct 09, 2005 11:47 am
Location: Brisbane Australia
Contact:

Post by Jon Munro »

Richard,
Printing directly from FWPPC I presume that you will need to send all the necessary printer control commands - just like the old days. By using the Windows 'save to file' feature you may be able to pre-generate and capture what you need and then merge printer control fragments with your data and write it from FWPPC. Depending on printer memory and print volume you may not even need flow-control. Just a suggestion...hth.
User avatar
Richard Chidiak
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France
Contact:

Post by Richard Chidiak »

Jon Munro wrote:Richard,
Printing directly from FWPPC I presume that you will need to send all the necessary printer control commands - just like the old days. By using the Windows 'save to file' feature you may be able to pre-generate and capture what you need and then merge printer control fragments with your data and write it from FWPPC. Depending on printer memory and print volume you may not even need flow-control. Just a suggestion...hth.
Jon

Well actually what i do is write to a txt file and then manually print it with the print control panel, it works ok so far

Thanks for the help

Richard
http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Post Reply