fix(ble): typo writeWithoutResponses→writeWithoutResponse v1.10.13
Some checks are pending
Build Android (APK + AAB) / build-android (push) Waiting to run

Web Bluetooth log mostrou ff02 com property [read] sozinha, mas no
APK v1.10.7 o plugin reportava [wnr,read]. Discrepância revelou typo:
eu usei p.writeWithoutResponses (com S no final) mas o nome correto
da property em BluetoothCharacteristicProperties é singular —
p.writeWithoutResponse. Sempre undefined → ff02 não detectado como
writeChar → probe abortava com 'Sem chars notify+write'.

Fix: 4 ocorrências em bmsProbeWebBluetooth corrigidas. Plugin
Capacitor por sorte usa o nome diferente (writeWithoutResponse no
nested object) então não foi afetado.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
PontualTech / Karlão 2026-04-29 08:42:19 -03:00
parent a5bb6f5528
commit 0999da3b51
3 changed files with 11 additions and 11 deletions

View file

@ -6073,11 +6073,11 @@ async function bmsProbeWebBluetooth(deviceId,deviceName){
let notifyChar=null,writeChar=null; let notifyChar=null,writeChar=null;
for(const c of chars){ for(const c of chars){
const p=c.properties; const p=c.properties;
const propsStr=[p.notify&&'notify',p.indicate&&'indicate',p.write&&'write',p.writeWithoutResponses&&'wnr',p.read&&'read'].filter(Boolean).join(','); const propsStr=[p.notify&&'notify',p.indicate&&'indicate',p.write&&'write',p.writeWithoutResponse&&'wnr',p.read&&'read'].filter(Boolean).join(',');
const cu=c.uuid.toLowerCase(); const cu=c.uuid.toLowerCase();
setBleDiag(` ${cu.slice(4,8)} [${propsStr}]`,'info'); setBleDiag(` ${cu.slice(4,8)} [${propsStr}]`,'info');
if(!notifyChar&&(p.notify||p.indicate))notifyChar=c; if(!notifyChar&&(p.notify||p.indicate))notifyChar=c;
if(!writeChar&&(p.write||p.writeWithoutResponses))writeChar=c; if(!writeChar&&(p.write||p.writeWithoutResponse))writeChar=c;
} }
if(!notifyChar||!writeChar){setBleDiag('Sem chars notify+write','err');return false} if(!notifyChar||!writeChar){setBleDiag('Sem chars notify+write','err');return false}
setBleDiag(`Notify=${notifyChar.uuid.slice(4,8)} Write=${writeChar.uuid.slice(4,8)}`,'ok'); setBleDiag(`Notify=${notifyChar.uuid.slice(4,8)} Write=${writeChar.uuid.slice(4,8)}`,'ok');
@ -6094,7 +6094,7 @@ async function bmsProbeWebBluetooth(deviceId,deviceName){
setBleDiag('Notify ativo · iniciando wake...','ok'); setBleDiag('Notify ativo · iniciando wake...','ok');
await new Promise(r=>setTimeout(r,500)); await new Promise(r=>setTimeout(r,500));
try{ try{
const fn=writeChar.properties.writeWithoutResponses?'writeValueWithoutResponse':'writeValue'; const fn=writeChar.properties.writeWithoutResponse?'writeValueWithoutResponse':'writeValue';
await writeChar[fn](new Uint8Array([0x5A,0x5A,0x5A,0x5A])); await writeChar[fn](new Uint8Array([0x5A,0x5A,0x5A,0x5A]));
setBleDiag('Wake 5A x4 enviado','info'); setBleDiag('Wake 5A x4 enviado','info');
}catch(e){setBleDiag('Wake skip: '+e.message,'info')} }catch(e){setBleDiag('Wake skip: '+e.message,'info')}
@ -6107,7 +6107,7 @@ async function bmsProbeWebBluetooth(deviceId,deviceName){
for(const p of PROTOCOLS){ for(const p of PROTOCOLS){
try{ try{
setBleDiag(`→ TX ${p.name}`,'info'); setBleDiag(`→ TX ${p.name}`,'info');
const fn=writeChar.properties.writeWithoutResponses?'writeValueWithoutResponse':'writeValue'; const fn=writeChar.properties.writeWithoutResponse?'writeValueWithoutResponse':'writeValue';
await writeChar[fn](new Uint8Array(p.bytes)); await writeChar[fn](new Uint8Array(p.bytes));
setBleDiag(`✔ write ${p.name} OK`,'info'); setBleDiag(`✔ write ${p.name} OK`,'info');
await new Promise(r=>setTimeout(r,2500)); await new Promise(r=>setTimeout(r,2500));
@ -6440,7 +6440,7 @@ async function removeBluetoothDevice(id){
renderBluetoothCard(); renderBluetoothCard();
} }
const APP_VERSION='1.10.12'; const APP_VERSION='1.10.13';
function renderBluetoothCard(){ function renderBluetoothCard(){
const el=document.getElementById('bt-list'); const el=document.getElementById('bt-list');
const supportEl=document.getElementById('bt-support'); const supportEl=document.getElementById('bt-support');

View file

@ -6073,11 +6073,11 @@ async function bmsProbeWebBluetooth(deviceId,deviceName){
let notifyChar=null,writeChar=null; let notifyChar=null,writeChar=null;
for(const c of chars){ for(const c of chars){
const p=c.properties; const p=c.properties;
const propsStr=[p.notify&&'notify',p.indicate&&'indicate',p.write&&'write',p.writeWithoutResponses&&'wnr',p.read&&'read'].filter(Boolean).join(','); const propsStr=[p.notify&&'notify',p.indicate&&'indicate',p.write&&'write',p.writeWithoutResponse&&'wnr',p.read&&'read'].filter(Boolean).join(',');
const cu=c.uuid.toLowerCase(); const cu=c.uuid.toLowerCase();
setBleDiag(` ${cu.slice(4,8)} [${propsStr}]`,'info'); setBleDiag(` ${cu.slice(4,8)} [${propsStr}]`,'info');
if(!notifyChar&&(p.notify||p.indicate))notifyChar=c; if(!notifyChar&&(p.notify||p.indicate))notifyChar=c;
if(!writeChar&&(p.write||p.writeWithoutResponses))writeChar=c; if(!writeChar&&(p.write||p.writeWithoutResponse))writeChar=c;
} }
if(!notifyChar||!writeChar){setBleDiag('Sem chars notify+write','err');return false} if(!notifyChar||!writeChar){setBleDiag('Sem chars notify+write','err');return false}
setBleDiag(`Notify=${notifyChar.uuid.slice(4,8)} Write=${writeChar.uuid.slice(4,8)}`,'ok'); setBleDiag(`Notify=${notifyChar.uuid.slice(4,8)} Write=${writeChar.uuid.slice(4,8)}`,'ok');
@ -6094,7 +6094,7 @@ async function bmsProbeWebBluetooth(deviceId,deviceName){
setBleDiag('Notify ativo · iniciando wake...','ok'); setBleDiag('Notify ativo · iniciando wake...','ok');
await new Promise(r=>setTimeout(r,500)); await new Promise(r=>setTimeout(r,500));
try{ try{
const fn=writeChar.properties.writeWithoutResponses?'writeValueWithoutResponse':'writeValue'; const fn=writeChar.properties.writeWithoutResponse?'writeValueWithoutResponse':'writeValue';
await writeChar[fn](new Uint8Array([0x5A,0x5A,0x5A,0x5A])); await writeChar[fn](new Uint8Array([0x5A,0x5A,0x5A,0x5A]));
setBleDiag('Wake 5A x4 enviado','info'); setBleDiag('Wake 5A x4 enviado','info');
}catch(e){setBleDiag('Wake skip: '+e.message,'info')} }catch(e){setBleDiag('Wake skip: '+e.message,'info')}
@ -6107,7 +6107,7 @@ async function bmsProbeWebBluetooth(deviceId,deviceName){
for(const p of PROTOCOLS){ for(const p of PROTOCOLS){
try{ try{
setBleDiag(`→ TX ${p.name}`,'info'); setBleDiag(`→ TX ${p.name}`,'info');
const fn=writeChar.properties.writeWithoutResponses?'writeValueWithoutResponse':'writeValue'; const fn=writeChar.properties.writeWithoutResponse?'writeValueWithoutResponse':'writeValue';
await writeChar[fn](new Uint8Array(p.bytes)); await writeChar[fn](new Uint8Array(p.bytes));
setBleDiag(`✔ write ${p.name} OK`,'info'); setBleDiag(`✔ write ${p.name} OK`,'info');
await new Promise(r=>setTimeout(r,2500)); await new Promise(r=>setTimeout(r,2500));
@ -6440,7 +6440,7 @@ async function removeBluetoothDevice(id){
renderBluetoothCard(); renderBluetoothCard();
} }
const APP_VERSION='1.10.12'; const APP_VERSION='1.10.13';
function renderBluetoothCard(){ function renderBluetoothCard(){
const el=document.getElementById('bt-list'); const el=document.getElementById('bt-list');
const supportEl=document.getElementById('bt-support'); const supportEl=document.getElementById('bt-support');

View file

@ -1,7 +1,7 @@
// Shivao Service Worker — offline real // Shivao Service Worker — offline real
// Estratégia: shell precachado, tiles cache-first, windy network-first, /api passa direto. // Estratégia: shell precachado, tiles cache-first, windy network-first, /api passa direto.
// Versão usada nos cache names — bumpa essa string pra invalidar caches antigos em deploys. // Versão usada nos cache names — bumpa essa string pra invalidar caches antigos em deploys.
const VERSION = 'shivao-v1.10.12'; const VERSION = 'shivao-v1.10.13';
const SHELL_CACHE = `shivao-shell-${VERSION}`; const SHELL_CACHE = `shivao-shell-${VERSION}`;
const TILES_CACHE = 'shivao-tiles-v1'; // separado pra não invalidar tiles em update do shell const TILES_CACHE = 'shivao-tiles-v1'; // separado pra não invalidar tiles em update do shell
const WINDY_CACHE = `shivao-windy-${VERSION}`; const WINDY_CACHE = `shivao-windy-${VERSION}`;