Page 1 of 2

bluetooth print trouble brother mw 140 bt

PostPosted: Fri Sep 15, 2006 7:44 pm
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

PostPosted: Sat Sep 16, 2006 7:48 pm
by Antonio Linares
Richard,

Try this change:
Code: Select all  Expand view
for n = 1 to Len( cText )
   MsgInfo( WriteByte( hOut, Asc( SubStr( cText, n, 1 ) ) ) )
next

You should get .T. on each WriteByte() call

PostPosted: Sat Sep 16, 2006 7:56 pm
by Richard Chidiak
Antonio Linares wrote:Richard,

Try this change:
Code: Select all  Expand view
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

PostPosted: Sat Sep 16, 2006 8:24 pm
by Antonio Linares
Richard,

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

ACTIVATE WINDOW oWnd

PostPosted: Sat Sep 16, 2006 8:28 pm
by Richard Chidiak
Antonio Linares wrote:Richard,

Try closing the handle after sending the bytes:
Code: Select all  Expand view
@ 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

PostPosted: Sat Sep 16, 2006 11:18 pm
by Antonio Linares
Richard,

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

PostPosted: Sun Sep 17, 2006 6:42 am
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

PostPosted: Thu Oct 12, 2006 1:33 am
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

PostPosted: Thu Oct 12, 2006 7:18 am
by Antonio Linares
Richard,

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

PostPosted: Thu Oct 12, 2006 1:05 pm
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

PostPosted: Thu Oct 12, 2006 1:07 pm
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

PostPosted: Tue Oct 17, 2006 3:48 am
by Jon Munro
Richard,
Perhaps its a flow control issue - is it using Xon/Xoff ?
hth

PostPosted: Tue Oct 17, 2006 6:52 pm
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

PostPosted: Wed Oct 18, 2006 6:59 am
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.

PostPosted: Wed Oct 18, 2006 8:53 am
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