bluetooth print trouble brother mw 140 bt

bluetooth print trouble brother mw 140 bt

Postby Richard Chidiak » Fri Sep 15, 2006 7: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Antonio Linares » Sat Sep 16, 2006 7:48 pm

Richard,

Try this change:
Code: Select all  Expand view  RUN
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
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Richard Chidiak » Sat Sep 16, 2006 7:56 pm

Antonio Linares wrote:Richard,

Try this change:
Code: Select all  Expand view  RUN
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
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Antonio Linares » Sat Sep 16, 2006 8:24 pm

Richard,

Try closing the handle after sending the bytes:
Code: Select all  Expand view  RUN
@ 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
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Richard Chidiak » Sat Sep 16, 2006 8:28 pm

Antonio Linares wrote:Richard,

Try closing the handle after sending the bytes:
Code: Select all  Expand view  RUN
@ 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
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Richard Chidiak » Sun Sep 17, 2006 6: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Jon Munro » Thu Oct 12, 2006 1: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
User avatar
Jon Munro
 
Posts: 42
Joined: Sun Oct 09, 2005 11:47 am
Location: Brisbane Australia

Postby Antonio Linares » Thu Oct 12, 2006 7:18 am

Richard,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Richard Chidiak » Thu Oct 12, 2006 1: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Richard Chidiak » Thu Oct 12, 2006 1:07 pm

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
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Jon Munro » Tue Oct 17, 2006 3:48 am

Richard,
Perhaps its a flow control issue - is it using Xon/Xoff ?
hth
User avatar
Jon Munro
 
Posts: 42
Joined: Sun Oct 09, 2005 11:47 am
Location: Brisbane Australia

Postby Richard Chidiak » Tue Oct 17, 2006 6: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Postby Jon Munro » Wed Oct 18, 2006 6: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.
User avatar
Jon Munro
 
Posts: 42
Joined: Sun Oct 09, 2005 11:47 am
Location: Brisbane Australia

Postby Richard Chidiak » Wed Oct 18, 2006 8: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
User avatar
Richard Chidiak
 
Posts: 946
Joined: Thu Oct 06, 2005 7:05 pm
Location: France

Next

Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 41 guests