diff --git a/src/components/MainContent/SelectedDevice.tsx b/src/components/MainContent/SelectedDevice.tsx index e8647c3..258403c 100644 --- a/src/components/MainContent/SelectedDevice.tsx +++ b/src/components/MainContent/SelectedDevice.tsx @@ -6,6 +6,7 @@ import { BatteryPercentageMessage, BrightnessMessage, ColorThemeMessage, + HapticsMessage, RequestStatusMessage, } from '@/pax/core/messages'; import { Messages } from '@/pax/shared/enums'; @@ -60,6 +61,9 @@ export const SelectedDevice = ({ currentDevice }: SelectedDeviceProps) => { if (message instanceof BrightnessMessage) { actions.setBrightness(message.brightness); } + if (message instanceof HapticsMessage) { + actions.setHaptics(message.percentage); + } }) .catch(e => { if (e instanceof BaseBluetoothException) { @@ -119,6 +123,23 @@ export const SelectedDevice = ({ currentDevice }: SelectedDeviceProps) => { void bluetoothState.writeToMainService(toPost.packet); }} /> + { + actions.setHaptics(value[0]); + }} + onValueCommit={value => { + const toPost = post( + HapticsMessage.createWithHaptics(value[0]), + currentDevice, + ); + void bluetoothState.writeToMainService(toPost.packet); + }} + /> +

Device: {!currentDevice ? '' : currentDevice.serial}