12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- """睿手相关参数模型"""
- from enum import Enum
- from pydantic import BaseModel
- from pydantic import Field
- class ChannelName(int, Enum):
- CHANNEL_A = 0x01
- CHANNEL_B = 0x02
- class DraftChannel(int, Enum):
- SINGLE = 0x01
- DOUBLE = 0x02
- class IsElectric(int, Enum):
- WITH_ELECTRIC = 0x00
- WITHOUT_ELECTRIC = 0x01
- class SetCurrent(BaseModel):
- """set current pydantic model"""
- channel: ChannelName = Field(
- ...,
- description=
- "set peripheral hand current channel (channelA: 0x01, channelB: 0x02)")
- value: int = Field(...,
- le=255,
- ge=0,
- description="set peripheral hand current value")
- class ControlMotion(BaseModel):
- """control motion pydantic model"""
- hand_select: str = Field()
- thumb: int = Field(..., le=100, ge=0)
- index_finger: int = Field(..., le=100, ge=0)
- middle_finger: int = Field(..., le=100, ge=0)
- ring_finger: int = Field(..., le=100, ge=0)
- little_finger: int = Field(..., le=100, ge=0)
- duration: int = Field(..., le=20, ge=5)
- class DraftingAction(BaseModel):
- """drafting action pydantic model"""
- hand_select: str = Field(
- ...,
- description="select control hand (double: 0x01, left: 0x02, right:0x03)"
- )
- is_electric: IsElectric = Field(
- ..., description="model (with electric: 0x00, without electric: 0x01)")
- draft_channel: DraftChannel = Field(
- ..., description="select channel (a channel: 0x01, double: 0x02)")
- a_channel_value: int = Field(...,
- le=255,
- ge=0,
- description="set A channel hand current value")
- b_channel_value: int = Field(...,
- le=255,
- ge=0,
- description="set b channel hand current value")
- duration: int = Field(..., le=20, ge=5)
|