Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

104
Visualizações
read tempreture from bluetooth device with web bluetooth

I am facing some problems with web Bluetooth API. the problem is that I have a temperature and humidity recorder Bluetooth device, which recorded temperature and humidity data through the sensor. I want to fetch that data in my web app by using web Bluetooth in javascript. so how can I perform this task?

I have tried web Bluetooth but I only get device name and battery level but I am not able to fetch temperature & humidity data.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

If the Bluetooth device uses the GATT Environmental Sensing service (GATT Assigned Number 0x181A), you should be able to read and get notified of the Temperature (0x2A6E) and Humidity (0x2A6F) GATT characteristics.

Here's some code that should* work.

const serviceUuid = 0x181A;

// Requesting Bluetooth Device assuming it advertises
// the GATT Environmental Sensing Service...
const device = await navigator.bluetooth.requestDevice({
    filters: [{services: [serviceUuid]}]});

// Connecting to GATT Server...
const server = await device.gatt.connect();

// Getting Environmental Sensing Service...
const service = await server.getPrimaryService(serviceUuid);

// Getting Humidity Characteristic...
const characteristic = await service.getCharacteristic(0x2A6F);

// Reading Humidity...
const value = await characteristic.readValue();
console.log(value);

The sample at https://googlechrome.github.io/samples/web-bluetooth/notifications.html?characteristic=humidity&service=environmental_sensing may also help you get started.

about 4 years ago · Juan Pablo Isaza Relatório

0

You need to know what Bluetooth GATT service provides the temperature and humidity data. Applications like "nRF Connect" and the about://bluetooth-internals page built into your browser can help you explore the services provided by the device.

Web Bluetooth requires you to pass the UUIDs of the services you want to access to the navigator.bluetooth.requestDevice() function and so you need to figure out which GATT services you want to access before they will be visible on the BluetoothRemoteGATTServer object provided by the API.

If you post the manufacturer and model information for the device as part of the question someone may be able to direct you to documentation from the manufacturer for the GATT services the device provides or someone who has already reverse engineered how to access the data you are looking for.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda