bluetooth print trouble brother mw 140 bt
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
bluetooth print trouble brother mw 140 bt
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Richard,
Try this change:
You should get .T. on each WriteByte() call
Try this change:
Code: Select all
for n = 1 to Len( cText )
MsgInfo( WriteByte( hOut, Asc( SubStr( cText, n, 1 ) ) ) )
next
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
AntonioAntonio Linares wrote:Richard,
Try this change:You should get .T. on each WriteByte() callCode: Select all
for n = 1 to Len( cText ) MsgInfo( WriteByte( hOut, Asc( SubStr( cText, n, 1 ) ) ) ) next
I get .t. on each call but nothing prints
Richard
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Richard,
Try closing the handle after sending the bytes:
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
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
AnotonioAntonio 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
Same behaviour, no change.
Does not print
Richard
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
AntonioAntonio Linares wrote:Richard,
You may use free http://www.symcod.com/BillSerialMonitor.zip to monitor the communication.
The link is for win32 , not for wince
How can i monitor the communication between the ppc and the printer ?
Thanks
Richard
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
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 Munro
www.bscan456.com
www.bscan456.com
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
JonJon 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
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
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
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.
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 Munro
www.bscan456.com
www.bscan456.com
- Richard Chidiak
- Posts: 946
- Joined: Thu Oct 06, 2005 7:05 pm
- Location: France
- Contact:
JonJon 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.
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