|
|
@ -0,0 +1,50 @@ |
|
|
|
package com.iflytop.handacid.hardware.command.handlers; |
|
|
|
|
|
|
|
import com.iflytop.handacid.app.core.command.DeviceCommand; |
|
|
|
import com.iflytop.handacid.common.enums.Action; |
|
|
|
import com.iflytop.handacid.common.enums.Device; |
|
|
|
import com.iflytop.handacid.hardware.command.CommandHandler; |
|
|
|
import com.iflytop.handacid.hardware.drivers.OutputIOCtrlDriver; |
|
|
|
import com.iflytop.handacid.hardware.type.BleGamepadMid; |
|
|
|
import com.iflytop.handacid.hardware.type.IO.OutputIOMId; |
|
|
|
import com.iflytop.handacid.hardware.type.MId; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
// |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@Component |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class BleGamepadHandler extends CommandHandler { |
|
|
|
private final OutputIOCtrlDriver driver_; |
|
|
|
private final Map<Device, BleGamepadMid> supportCmdDeviceIOOutputMap = Map.ofEntries( |
|
|
|
Map.entry(Device.BLE_GAMEPAD, BleGamepadMid.BleGamePad) |
|
|
|
); |
|
|
|
|
|
|
|
private final Map<Device, MId> supportCmdDeviceMIdMap = supportCmdDeviceIOOutputMap.entrySet().stream() |
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().mid)); |
|
|
|
|
|
|
|
private final Set<Action> supportActions = Set.of(Action.OPEN, Action.CLOSE); |
|
|
|
|
|
|
|
@Override |
|
|
|
protected Map<Device, MId> getSupportCmdDeviceMIdMap() |
|
|
|
{ |
|
|
|
return supportCmdDeviceMIdMap; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected Set<Action> getSupportActions() { |
|
|
|
return supportActions; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void handleCommand(DeviceCommand command) throws Exception { |
|
|
|
// 发送命令 |
|
|
|
} |
|
|
|
} |