FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC bluetooth print trouble brother mw 140 bt
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
bluetooth print trouble brother mw 140 bt
Posted: Fri Sep 15, 2006 07:44 PM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
bluetooth print trouble brother mw 140 bt
Posted: Sat Sep 16, 2006 07:48 PM
Richard,

Try this change:
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
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
bluetooth print trouble brother mw 140 bt
Posted: Sat Sep 16, 2006 07:56 PM
Antonio Linares wrote:Richard,

Try this change:
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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
bluetooth print trouble brother mw 140 bt
Posted: Sat Sep 16, 2006 08:24 PM
Richard,

Try closing the handle after sending the bytes:
@ 2, 2 BUTTON "Send" ; 
ACTION ( SendText( hOut, "Hello world!" ), CloseHandle( hOut ) ) SIZE 80, 20 

ACTIVATE WINDOW oWnd
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
bluetooth print trouble brother mw 140 bt
Posted: Sat Sep 16, 2006 08:28 PM
Antonio Linares wrote:Richard,

Try closing the handle after sending the bytes:
@ 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
bluetooth print trouble brother mw 140 bt
Posted: Sat Sep 16, 2006 11:18 PM

Richard,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
bluetooth print trouble brother mw 140 bt
Posted: Sun Sep 17, 2006 06:42 AM
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
Posts: 42
Joined: Sun Oct 09, 2005 11:47 AM
bluetooth print trouble brother mw 140 bt
Posted: Thu Oct 12, 2006 01:33 AM

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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
bluetooth print trouble brother mw 140 bt
Posted: Thu Oct 12, 2006 07:18 AM

Richard,

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
bluetooth print trouble brother mw 140 bt
Posted: Thu Oct 12, 2006 01:05 PM
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
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
bluetooth print trouble brother mw 140 bt
Posted: Thu Oct 12, 2006 01:07 PM
Antonio Linares wrote:Richard,

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


Antonio :-)

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
Posts: 42
Joined: Sun Oct 09, 2005 11:47 AM
bluetooth print trouble brother mw 140 bt
Posted: Tue Oct 17, 2006 03:48 AM

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

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
bluetooth print trouble brother mw 140 bt
Posted: Tue Oct 17, 2006 06:52 PM
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
Posts: 42
Joined: Sun Oct 09, 2005 11:47 AM
bluetooth print trouble brother mw 140 bt
Posted: Wed Oct 18, 2006 06:59 AM

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.

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
bluetooth print trouble brother mw 140 bt
Posted: Wed Oct 18, 2006 08:53 AM
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