FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Pocket PC Connecting to a bluetooth device from within PPC
Posts: 229
Joined: Wed Oct 12, 2005 05:32 PM
Connecting to a bluetooth device from within PPC
Posted: Sat Jul 25, 2009 06:59 PM

Hi all,

I am facing some problems in developing classes to manage bluetooth devices.

I think this api can improve our FWPPC applications.

Does someone experience in BT api ??

Please... contact to me and I'll share code.

Posts: 94
Joined: Fri Aug 10, 2007 01:47 AM
Re: Connecting to a bluetooth device from within PPC
Posted: Wed Jul 29, 2009 08:53 PM
Hello

The only way I was doit is this way:
(Maybe is not the most elegant way but it works to me..)

Code (fw): Select all Collapse
STATIC FUNCTION SENDBLUE2(cDbfFileWTxt) 
LOCAL i, hOut, nLineVal:=40, nLineIncr:=50, ctext
local nCom := 5, nBauds := 57600, nParity := NOPARITY, nDataByt := 8,;
      lIRmode := .f., nStopBits := ONESTOPBIT 


hOut := CreateFile( "COM5:",GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL ) 
IF hOut==-1 
    MsgStop("Port Not Found") 
    return nil
endif

use (cDbfFileWTxt) alias DBFPrn NEW
dbgotop()
do while !eof()
    if !ComSend( hOut, trim(DBFPrn->C1) + CRLF ) 
        exit
    endif
    skip
enddo
USE

ComClose( hOut )

return nil


This way is already probed to send large tickets with WM5.
Note that I must be print record by record because I dont know another way to control flow of data.
Com 5 is usualy the com port number taked for BT in WMobile.

Please let us know when you made something in a class way !!
Saludos a todos.
Arturo LS
Posts: 229
Joined: Wed Oct 12, 2005 05:32 PM
Re: Connecting to a bluetooth device from within PPC
Posted: Thu Jul 30, 2009 07:57 PM

Arturo,

Gracias por responder.

Si... ya estamos utilizando la impresi贸n mediante un puerto virtual (tal como lo muestras) pero... tiene problemas. Como bien dices no hay control de flujo por lo que no puedes, a priori, saber si el buffer est谩 listo para recibir.

Por eso quiero cambiar la forma de mandar la informaci贸n a una impresora bluetooth: mediante conexi贸n sockets. Este tema, para la versi贸n que se utiliza de evc no es muy sencillo por que no est谩n todas las libs con las funciones que hay en los ejemplos que muestra el msdn.

De momento ya tengo funciones para el descubrimiento de dispositivos bluetooth. Y espero poder emparejarlos dentro de poco.

Thanks for answer.

Yes, we already are printing using a virtual port (as you've showed) but it has problems. As you've said it very well there is no way to control the communication flow... so you can not know (for example) if a buffer printer is ready to receive data.

This is why I want to change the way to print to a bluetooth printer: throught sockets. Bluetooth communications, for the evc version we are using now, is not so easy as because there aren't all the libs (and functions) needed by msdn samples.

At this point I have some functions for discovering bluetooth devices. I hope in short time pair bt devices.

Continue the discussion