Verify packet PTT readiness and isolate manual VHF forwarding status
This commit is contained in:
1 parent
9bb62cf731
commit
abfc8be078
7 files changed
+16
-7
No files matched your search
+1
-1
@@ -5,7 +5,7 @@ export async function reservePacketSlot(client,controller,frequencyMHz,port){
|
||||
const request={id:randomUUID(),frequencyMHz,expiresAt:Date.now()+90000};client.job.controller={...controller,id:request.id};await client.persist();
|
||||
await writeFile(controller.requestFile+'.tmp',JSON.stringify(request));await rename(controller.requestFile+'.tmp',controller.requestFile);
|
||||
const deadline=Date.now()+65000;
|
||||
while(Date.now()<deadline){try{const state=JSON.parse(await readFile(controller.statusFile,'utf8'));if(state.manualRequestId===request.id&&state.phase==='vhf'&&Math.abs(Number(state.frequency)-frequencyMHz)<0.0001&&Date.now()-Date.parse(state.at)<5000){const html=await client.fwd.bpq('/Node/Port?'+port);if(/Connected to TNC/.test(html)&&/1200bd/.test(html))return;}}catch{}await new Promise(resolve=>setTimeout(resolve,300));}
|
||||
while(Date.now()<deadline){try{const state=JSON.parse(await readFile(controller.statusFile,'utf8'));if(state.manualRequestId===request.id&&state.phase==='vhf'&&state.pttReady===true&&Math.abs(Number(state.frequency)-frequencyMHz)<0.0001&&Date.now()-Date.parse(state.at)<5000){const html=await client.fwd.bpq('/Node/Port?'+port);if(/Connected to TNC/.test(html)&&/1200bd/.test(html))return;}}catch{}await new Promise(resolve=>setTimeout(resolve,300));}
|
||||
throw Error('Modem packet non pronto: nessuna chiamata avviata');
|
||||
}
|
||||
export async function releasePacketSlot(client){
|
||||
|
||||
Reference in new issue
Block a user