Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
¿Por qué no puedo ver ninguna notificación cuando envío datos al dispositivo a través de BLE?

Estoy tratando de crear una aplicación que envíe comandos a un dispositivo BLE y no puedo obtener ningún comentario. Estoy usando una biblioteca llamada ble.plx que tiene una opción para monitorear las características, pero no genera nada para mí. Necesito leer los valores de las notificaciones para usarlos más tarde en mi código. Esta es la primera vez que trabajo con BLE en general, así que no tengo idea de lo que estoy haciendo mal. Sé que serviceUUID y characterUUID son correctos. Se me acabaron las ideas.

Aquí está mi código:

 function scanAndConnect() {
BLTManager.startDeviceScan(null, null, (error, device) => {
 if (error) {
 // Handle error (scanning will be stopped automatically)
 return
 }

 // Check if it is a device you are looking for based on advertisement data
 // or other criteria.
 if (device.name=='Audio PCM Streamer') {
 console.log(device.name);
 // Stop scanning as it's not necessary if you are scanning for one device.
 BLTManager.stopDeviceScan();

 device.connect()
 .then((device) => {
 return device.discoverAllServicesAndCharacteristics()
 })
 .then( (device) => {
 device.monitorCharacteristicForService(SERVICE_UUID,CHARACTERISTIC_UUID,(err,result)=>{
 if(err) {
 console.log(err)
 return;
 }
 console.log(result);
 }); Subscription 
 device.requestMTU(251)
 let data = Uint8Array(9);
 data[0]=0xA5;
 data[1]=0xA5;
 data[2]=0xA5;
 data[3]=0xA5;
 var b64encoded = btoa(decoder.decode(data));
 device.writeCharacteristicWithoutResponseForService(SERVICE_UUID,CHARACTERISTIC_UUID,b64encoded);

 
 })
 .catch((error) => {
 // Handle errors
 });

 }
 });

}

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Hice esto completamente mal, no lo use ni intente arreglarlo, es simplemente malo.

almost 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!