Seguimos buscando a Arshak. Ayudanos compartiendo!
Encuesta no oficial de docentes
Resultados de la encuesta no oficial de docentes
Probaste el SIGA Helper?

Donar $100 Donar $200 Donar $500 Donar mensualmente


Enviar respuesta 
 
Calificación:
  • 0 votos - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
Buscar en el tema
BlueTooth, problem danger riiing riiiing (?)
Autor Mensaje
sebasthian777 Sin conexión
Presidente del CEIT
mi propio camino NINGA
********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 1.919
Agradecimientos dados: 43
Agradecimientos: 22 en 20 posts
Registro en: Nov 2011
Mensaje: #1
BlueTooth, problem danger riiing riiiing (?)
Despues de un titulo tan descriptivo como el que puse, paso a explicar mi problema...

Estoy desarrollando una App en VisualC++ para poder manejar el puerto DienteAzul =P... cuestion que teoricamente con la API de windows sobra... aca un codigo:
Spoiler: Mostrar



// test2blue.cpp: define el punto de entrada de la aplicación de consola.
// If you have 1 or more bluetooth dongles attached to the system.

// this will select the first one, then it will perform a scan for

// all devices within range of that dongle and print out all the

// information available about each device. then move on to the next

// dongle and repeat the process, etc. doesn't actually DO much apart

// from find devices and display their information.



#include <stdlib.h>

#include <stdio.h>

// Link to ws2_32.lib

#include <Winsock2.h>

#include <Ws2bth.h>

// Link to Bthprops.lib

#include <BluetoothAPIs.h>



BLUETOOTH_FIND_RADIO_PARAMS m_bt_find_radio = {sizeof(BLUETOOTH_FIND_RADIO_PARAMS)};



BLUETOOTH_RADIO_INFO m_bt_info = {sizeof(BLUETOOTH_RADIO_INFO),0,};



BLUETOOTH_DEVICE_SEARCH_PARAMS m_search_params = {

sizeof(BLUETOOTH_DEVICE_SEARCH_PARAMS),

1,

0,

1,

1,

1,

15,

NULL

};



BLUETOOTH_DEVICE_INFO m_device_info = {sizeof(BLUETOOTH_DEVICE_INFO),0,};



// Note:

// Radio - is the thing plugged in/attached to the local machine.

// Device - is the thing that is connected to via the Bluetooth connection.



int main(int argc, char **args)

{

HANDLE m_radio = NULL;

HBLUETOOTH_RADIO_FIND m_bt = NULL;

HBLUETOOTH_DEVICE_FIND m_bt_dev = NULL;

int m_radio_id;

int m_device_id;

DWORD mbtinfo_ret;



// Iterate for available bluetooth radio devices in range

// Starting from the local

while(TRUE)

{

m_bt = BluetoothFindFirstRadio(&m_bt_find_radio, &m_radio);



if(m_bt != NULL)

printf("BluetoothFindFirstRadio() is OK!\n");

else

printf("BluetoothFindFirstRadio() failed with error code %d\n", GetLastError());



m_radio_id = 0;



do {

// Then get the radio device info....

mbtinfo_ret = BluetoothGetRadioInfo(m_radio, &m_bt_info);

if(mbtinfo_ret == ERROR_SUCCESS)

printf("BluetoothGetRadioInfo() looks fine!\n");

else

printf("BluetoothGetRadioInfo() failed wit herror code %d\n", mbtinfo_ret);



wprintf(L"Radio %d:\r\n", m_radio_id);

wprintf(L"\tInstance Name: %s\r\n", m_bt_info.szName);

wprintf(L"\tAddress: %02X:%02X:%02X:%02X:%02X:%02X\r\n", m_bt_info.address.rgBytes[5],

m_bt_info.address.rgBytes[4], m_bt_info.address.rgBytes[3], m_bt_info.address.rgBytes[2],

m_bt_info.address.rgBytes[1], m_bt_info.address.rgBytes[0]);

wprintf(L"\tClass: 0x%08x\r\n", m_bt_info.ulClassofDevice);

wprintf(L"\tManufacturer: 0x%04x\r\n", m_bt_info.manufacturer);



m_search_params.hRadio = m_radio;

ZeroMemory(&m_device_info, sizeof(BLUETOOTH_DEVICE_INFO));

m_device_info.dwSize = sizeof(BLUETOOTH_DEVICE_INFO);



// Next for every radio, get the device

m_bt_dev = BluetoothFindFirstDevice(&m_search_params, &m_device_info);



if(m_bt_dev != NULL)

printf("\nBluetoothFindFirstDevice() is working!\n");

else

printf("\nBluetoothFindFirstDevice() failed with error code %d\n", GetLastError());



m_radio_id++;

m_device_id = 0;



// Get the device info

do

{

wprintf(L"\n\tDevice %d:\r\n", m_device_id);

wprintf(L" \tInstance Name: %s\r\n", m_device_info.szName);

wprintf(L" \tAddress: %02X:%02X:%02X:%02X:%02X:%02X\r\n", m_device_info.Address.rgBytes[5],

m_device_info.Address.rgBytes[4], m_device_info.Address.rgBytes[3], m_device_info.Address.rgBytes[2],

m_device_info.Address.rgBytes[1], m_device_info.Address.rgBytes[0]);

wprintf(L" \tClass: 0x%08x\r\n", m_device_info.ulClassofDevice);

wprintf(L" \tConnected: %s\r\n", m_device_info.fConnected ? L"true" : L"false");

wprintf(L" \tAuthenticated: %s\r\n", m_device_info.fAuthenticated ? L"true" : L"false");

wprintf(L" \tRemembered: %s\r\n", m_device_info.fRemembered ? L"true" : L"false");

m_device_id++;



// Well, the found device information can be used for further socket

// operation such as creating a socket, bind, listen, connect, send, receive etc..

// If no more device, exit the loop

if(!BluetoothFindNextDevice(m_bt_dev, &m_device_info))

break;



} while(BluetoothFindNextDevice(m_bt_dev, &m_device_info));



// NO more device, close the device handle

if(BluetoothFindDeviceClose(m_bt_dev) == TRUE)

printf("\nBluetoothFindDeviceClose(m_bt_dev) is OK!\n");

else

printf("\nBluetoothFindDeviceClose(m_bt_dev) failed with error code %d\n", GetLastError());



} while(BluetoothFindNextRadio(&m_bt_find_radio, &m_radio));



// No more radio, close the radio handle

if(BluetoothFindRadioClose(m_bt) == TRUE)

printf("BluetoothFindRadioClose(m_bt) is OK!\n");

else

printf("BluetoothFindRadioClose(m_bt) failed with error code %d\n", GetLastError());



// Exit the outermost WHILE and BluetoothFindXXXXRadio loops if there is no more radio

if(!BluetoothFindNextRadio(&m_bt_find_radio, &m_radio))

break;



// Give some time for the 'signal' which is a typical for crap wireless devices

Sleep(1000);

}

return 0;

}

Si si, es un copy paste, pero como muchas APIs nativas de Windows, no hay muchas formas distintas de usarlas, pero volviendo al tema, a la hora de usar


m_bt = BluetoothFindFirstRadio(&m_bt_find_radio, &m_radio);


Me devuelve nuestro queridisimo amigo NULL, cuestion que revisando, en windows dice que si devuelve NULL, es porque hay un problema con:
Cita:Returns NULL upon failure. Call the GetLastError function for more information on the error. The following table describe common errors:

( http://msdn.microsoft.com/en-us/library/...85%29.aspx )

y navegando un poco mas, vi que algunos adaptadores BlueTooth, no son "tolerados" por la Api esta, para poder desarrollar :/ tonces estoy medio en bolas, y queria ver si alguno hizo algo de esto alguna vez =D

datos tecnicos:

Visual Studio 2010 + Dell Inspiron 1525 + Dell Wireless 355 module With BlueTooth 2.0 + EDR Technology

Desde ya gracias =)


(Si alguno tiene un SDK o API que pueda meter adentro de C++ (no importa el compilador, mando a hacer una DLL y a la lona) se lo agradeceria infinitamente *.* )
agrego, lo que me falto:

#define ERROR_NO_MORE_ITEMS 259L

DWORD a = GetLastError(); //<---- aca me tiro el 259

y ohhhh casualidad, tengo al radio prendida, y sin ningun dispotivo atachado...

(19-11-2013 11:48).py escribió:  
(19-11-2013 11:46)sebasthian777 escribió:  
(19-11-2013 11:43).py escribió:  Terminemos Hurd.
Prefiero dejarle ese laburo a gente sin vida social y que no tenga sexo.
Cuando te casas? Asi voy armando el Gannt.
(Este mensaje fue modificado por última vez en: 22-11-2012 22:26 por sebasthian777.)
22-11-2012 22:23
Visita su sitio web Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
gonnza Sin conexión
User Verde

*********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 17.356
Agradecimientos dados: 900
Agradecimientos: 887 en 356 posts
Registro en: Mar 2010
BlogSpot Google+ YouTube
Mensaje: #2
RE: BlueTooth, problem danger riiing riiiing (?)
uh que estas haciendo? me cago, yo habia tenido un par de ideas para hacer un proyectito con bluetooth en el verano, por mi cuenta

no me cagues la idea por adelantado (?)

[Imagen: v34BEFt.gif]
23-11-2012 00:37
Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
sebasthian777 Sin conexión
Presidente del CEIT
mi propio camino NINGA
********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 1.919
Agradecimientos dados: 43
Agradecimientos: 22 en 20 posts
Registro en: Nov 2011
Mensaje: #3
RE: BlueTooth, problem danger riiing riiiing (?)
Bueno, si no hay muchas personas que lo sepan, lo voy a tener que utilizar como un puerto RS232 y ya...

(19-11-2013 11:48).py escribió:  
(19-11-2013 11:46)sebasthian777 escribió:  
(19-11-2013 11:43).py escribió:  Terminemos Hurd.
Prefiero dejarle ese laburo a gente sin vida social y que no tenga sexo.
Cuando te casas? Asi voy armando el Gannt.
23-11-2012 06:29
Visita su sitio web Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
gonnza Sin conexión
User Verde

*********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 17.356
Agradecimientos dados: 900
Agradecimientos: 887 en 356 posts
Registro en: Mar 2010
BlogSpot Google+ YouTube
Mensaje: #4
RE: BlueTooth, problem danger riiing riiiing (?)
bueno espera, que queres que te contesten en menos de 1 dia xD

pregunta en stackoverflow =P

[Imagen: v34BEFt.gif]
23-11-2012 09:35
Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
sebasthian777 Sin conexión
Presidente del CEIT
mi propio camino NINGA
********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 1.919
Agradecimientos dados: 43
Agradecimientos: 22 en 20 posts
Registro en: Nov 2011
Mensaje: #5
RE: BlueTooth, problem danger riiing riiiing (?)
Gonnza deja de robar post, este sub foro, obviamente no es para vos, solo te metes a tirar comentarios a animaladas de codigo y esas cosas.. nunca te vi poner un aporte ni solucionar un solo codigo....

BASTA DE LA MENTIRA DE GONNZA

(19-11-2013 11:48).py escribió:  
(19-11-2013 11:46)sebasthian777 escribió:  
(19-11-2013 11:43).py escribió:  Terminemos Hurd.
Prefiero dejarle ese laburo a gente sin vida social y que no tenga sexo.
Cuando te casas? Asi voy armando el Gannt.
23-11-2012 12:30
Visita su sitio web Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
[-] sebasthian777 recibio 3 Gracias por este post
brunodiaz (23-11-2012), gonnza (23-11-2012), Brich (23-11-2012)
brunodiaz Sin conexión
The Dark Knight
Bla
**********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 7.707
Agradecimientos dados: 92
Agradecimientos: 384 en 135 posts
Registro en: May 2008
Mensaje: #6
RE: BlueTooth, problem danger riiing riiiing (?)
Disculpa, no estoy acostumbrado a laburar en Windows, y nunca labure con el BlueTooth.
Tendria q leer un poco para opinar y no ando con tiempo.
23-11-2012 12:31
Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
gonnza Sin conexión
User Verde

*********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 17.356
Agradecimientos dados: 900
Agradecimientos: 887 en 356 posts
Registro en: Mar 2010
BlogSpot Google+ YouTube
Mensaje: #7
RE: BlueTooth, problem danger riiing riiiing (?)
(23-11-2012 12:30)sebasthian777 escribió:  Gonnza deja de robar post, este sub foro, obviamente no es para vos, solo te metes a tirar comentarios a animaladas de codigo y esas cosas.. nunca te vi poner un aporte ni solucionar un solo codigo....

BASTA DE LA MENTIRA DE GONNZA


banana


que lastima, este post se esta desvirtuando



seria una lastima




que un moderador decida moverlo

[Imagen: v34BEFt.gif]
23-11-2012 14:32
Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
[-] gonnza recibio 1 Gracias por este post
sebasthian777 (23-11-2012)
sebasthian777 Sin conexión
Presidente del CEIT
mi propio camino NINGA
********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 1.919
Agradecimientos dados: 43
Agradecimientos: 22 en 20 posts
Registro en: Nov 2011
Mensaje: #8
RE: BlueTooth, problem danger riiing riiiing (?)
tres consejos:

1) Movelo, ya es viejo el Thread y encontre una solucion...
2) Deja de robar post al pedo...
3) Cuando hagas chiste, trata de que no sean los chistes "populares" del momento... Como hace un par de semanas que usan "Seria una lastima"... es muy showmatch hacer esos chistes...

PD: no es lo mismo Post que Thread, como administrador/moderador de un foro deberias saberlo, como programador tambien...

(19-11-2013 11:48).py escribió:  
(19-11-2013 11:46)sebasthian777 escribió:  
(19-11-2013 11:43).py escribió:  Terminemos Hurd.
Prefiero dejarle ese laburo a gente sin vida social y que no tenga sexo.
Cuando te casas? Asi voy armando el Gannt.
23-11-2012 15:24
Visita su sitio web Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
gonnza Sin conexión
User Verde

*********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 17.356
Agradecimientos dados: 900
Agradecimientos: 887 en 356 posts
Registro en: Mar 2010
BlogSpot Google+ YouTube
Mensaje: #9
RE: BlueTooth, problem danger riiing riiiing (?)
no es del momento, ya es viejo


hay gente que usa el underscore, porque no puedo equivocarme y decir post en vez de thread o topic?
y comparti la solucion si la encotnraste, tal vez me pueda servir en un futuro (?)

[Imagen: v34BEFt.gif]
(Este mensaje fue modificado por última vez en: 23-11-2012 15:35 por gonnza.)
23-11-2012 15:34
Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
sebasthian777 Sin conexión
Presidente del CEIT
mi propio camino NINGA
********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 1.919
Agradecimientos dados: 43
Agradecimientos: 22 en 20 posts
Registro en: Nov 2011
Mensaje: #10
RE: BlueTooth, problem danger riiing riiiing (?)
Cuando alguien este buscando como hacer esto, y el google le tire el link al foro, automaticamente va a sentir odio por vos = )

(19-11-2013 11:48).py escribió:  
(19-11-2013 11:46)sebasthian777 escribió:  
(19-11-2013 11:43).py escribió:  Terminemos Hurd.
Prefiero dejarle ese laburo a gente sin vida social y que no tenga sexo.
Cuando te casas? Asi voy armando el Gannt.
23-11-2012 15:43
Visita su sitio web Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
brunodiaz Sin conexión
The Dark Knight
Bla
**********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 7.707
Agradecimientos dados: 92
Agradecimientos: 384 en 135 posts
Registro en: May 2008
Mensaje: #11
RE: BlueTooth, problem danger riiing riiiing (?)
pochoclo
23-11-2012 15:51
Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
Brich Ausente
Colaborador
Why So Serious?
********

Ing. Mecánica
Facultad Regional General Pacheco

Mensajes: 6.320
Agradecimientos dados: 255
Agradecimientos: 2.432 en 416 posts
Registro en: May 2012
Mensaje: #12
RE: BlueTooth, problem danger riiing riiiing (?)
(23-11-2012 15:51)brunodiaz escribió:  pochoclo

[Imagen: crows-1.gif]
23-11-2012 15:56
Envíale un email Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
sebasthian777 Sin conexión
Presidente del CEIT
mi propio camino NINGA
********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 1.919
Agradecimientos dados: 43
Agradecimientos: 22 en 20 posts
Registro en: Nov 2011
Mensaje: #13
RE: BlueTooth, problem danger riiing riiiing (?)
Al final, lo use como si fuera un puerto serial, lo levante abriendo el COM4 (es el puerto virtual que se genera con el bluetooth) y leyendo... y aca esta el resultado:




notese que uso "A","S","W","D" y el vino viejo de anoche al costado de la notebook JAJAJA

(19-11-2013 11:48).py escribió:  
(19-11-2013 11:46)sebasthian777 escribió:  
(19-11-2013 11:43).py escribió:  Terminemos Hurd.
Prefiero dejarle ese laburo a gente sin vida social y que no tenga sexo.
Cuando te casas? Asi voy armando el Gannt.
(Este mensaje fue modificado por última vez en: 23-11-2012 16:49 por sebasthian777.)
23-11-2012 16:48
Visita su sitio web Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
brunodiaz Sin conexión
The Dark Knight
Bla
**********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 7.707
Agradecimientos dados: 92
Agradecimientos: 384 en 135 posts
Registro en: May 2008
Mensaje: #14
RE: BlueTooth, problem danger riiing riiiing (?)
Muy lindo.
Supongo que le proximo paso es usar el acelerometro no?
23-11-2012 16:51
Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
sebasthian777 Sin conexión
Presidente del CEIT
mi propio camino NINGA
********

Ing. en Sistemas
Facultad Regional Buenos Aires

Mensajes: 1.919
Agradecimientos dados: 43
Agradecimientos: 22 en 20 posts
Registro en: Nov 2011
Mensaje: #15
RE: BlueTooth, problem danger riiing riiiing (?)
Tal cual!

(19-11-2013 11:48).py escribió:  
(19-11-2013 11:46)sebasthian777 escribió:  
(19-11-2013 11:43).py escribió:  Terminemos Hurd.
Prefiero dejarle ese laburo a gente sin vida social y que no tenga sexo.
Cuando te casas? Asi voy armando el Gannt.
23-11-2012 16:58
Visita su sitio web Encuentra todos sus mensajes Agregar agradecimiento Cita este mensaje en tu respuesta
Buscar en el tema
Enviar respuesta 




Usuario(s) navegando en este tema: 1 invitado(s)