Page 1 of 1

Connecting to a bluetooth device from within PPC

Posted: Sat Jul 25, 2009 6:59 pm
by jlcapel
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.

Re: Connecting to a bluetooth device from within PPC

Posted: Wed Jul 29, 2009 8:53 pm
by Arturo Lopesoria
Hello

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

Code: Select all


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.

Re: Connecting to a bluetooth device from within PPC

Posted: Thu Jul 30, 2009 7:57 pm
by jlcapel
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.