decline & accept devices and protocol connection issues fixed
This commit is contained in:
28
app/providers/DeviceProvider/useDeviceResolve.ts
Normal file
28
app/providers/DeviceProvider/useDeviceResolve.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { PacketDeviceResolve, Solution } from "../ProtocolProvider/protocol/packets/packet.device.resolve";
|
||||
import { useSender } from "../ProtocolProvider/useSender"
|
||||
|
||||
/**
|
||||
* Хук для отклонения или принятия устройств
|
||||
*/
|
||||
export function useDeviceResolve() {
|
||||
const send = useSender();
|
||||
|
||||
const accept = (deviceId: string) => {
|
||||
const packet = new PacketDeviceResolve();
|
||||
packet.setDeviceId(deviceId);
|
||||
packet.setSolution(Solution.ACCEPT);
|
||||
send(packet);
|
||||
}
|
||||
|
||||
const decline = (deviceId: string) => {
|
||||
const packet = new PacketDeviceResolve();
|
||||
packet.setDeviceId(deviceId);
|
||||
packet.setSolution(Solution.DECLINE);
|
||||
send(packet);
|
||||
}
|
||||
|
||||
return {
|
||||
accept,
|
||||
decline
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user