sharpbrick / powered-up

.NET implementation of the LEGO PoweredUp Protocol
MIT License
98 stars 19 forks source link

Add MoveHub (88006) #95

Closed corneliusmunz closed 3 years ago

corneliusmunz commented 3 years ago

Add support for the MoveHub (88006) which is used in the Boost and StarWars Sets. Attached you will find the needed CLI Logs

poweredup device list
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: MoveHub (with address 95892814641)
1
Selected MoveHub with key 1
Discover Ports. Receiving Messages ...
.......................................................................................................................................................................................................
Discover Ports Function: 198 / 198
Hub: 0
  Port: 0
    IOTypeId: InternalMotorWithTacho
    HardwareRevision: 1.0.0.0
    SoftwareRevision: 1.0.0.0
    OutputCapability: True
    InputCapability: True
    LogicalCombinableCapability: True
    LogicalSynchronizableCapability: True
    ModeCombinations: [0000000000000110]
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: POWER
      IsInput: False
      IsOutput: True
      RawMin: -100
      RawMax: 100
      PctMin: -100
      PctMax: 100
      SIMin: -100
      SIMax: 100
      Symbol: PCT
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: SPEED
      IsInput: True
      IsOutput: True
      RawMin: -100
      RawMax: 100
      PctMin: -100
      PctMax: 100
      SIMin: -100
      SIMax: 100
      Symbol: PCT
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 2
      Name: POS
      IsInput: True
      IsOutput: True
      RawMin: -360
      RawMax: 360
      PctMin: -100
      PctMax: 100
      SIMin: -360
      SIMax: 360
      Symbol: DEG
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: True
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: True
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int32
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
  Port: 1
    IOTypeId: InternalMotorWithTacho
    HardwareRevision: 1.0.0.0
    SoftwareRevision: 1.0.0.0
    OutputCapability: True
    InputCapability: True
    LogicalCombinableCapability: True
    LogicalSynchronizableCapability: True
    ModeCombinations: [0000000000000110]
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: POWER
      IsInput: False
      IsOutput: True
      RawMin: -100
      RawMax: 100
      PctMin: -100
      PctMax: 100
      SIMin: -100
      SIMax: 100
      Symbol: PCT
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: SPEED
      IsInput: True
      IsOutput: True
      RawMin: -100
      RawMax: 100
      PctMin: -100
      PctMax: 100
      SIMin: -100
      SIMax: 100
      Symbol: PCT
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 2
      Name: POS
      IsInput: True
      IsOutput: True
      RawMin: -360
      RawMax: 360
      PctMin: -100
      PctMax: 100
      SIMin: -360
      SIMax: 360
      Symbol: DEG
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: True
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: True
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int32
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
  Port: 16
    IOTypeId: InternalMotorWithTacho
    HardwareRevision: 1.0.0.0
    SoftwareRevision: 1.0.0.0
    OutputCapability: True
    InputCapability: True
    LogicalCombinableCapability: True
    LogicalSynchronizableCapability: False
    ModeCombinations: [0000000000000110]
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: POWER
      IsInput: False
      IsOutput: True
      RawMin: -100
      RawMax: 100
      PctMin: -100
      PctMax: 100
      SIMin: -100
      SIMax: 100
      Symbol: PCT
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: SPEED
      IsInput: True
      IsOutput: True
      RawMin: -100
      RawMax: 100
      PctMin: -100
      PctMax: 100
      SIMin: -100
      SIMax: 100
      Symbol: PCT
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 2
      Name: POS
      IsInput: True
      IsOutput: True
      RawMin: -360
      RawMax: 360
      PctMin: -100
      PctMax: 100
      SIMin: -360
      SIMax: 360
      Symbol: DEG
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: True
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: True
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int32
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
  Port: 50
    IOTypeId: RgbLight
    HardwareRevision: 0.1.0.0
    SoftwareRevision: 2.0.0.6
    OutputCapability: True
    InputCapability: False
    LogicalCombinableCapability: False
    LogicalSynchronizableCapability: False
    ModeCombinations: []
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: COL O
      IsInput: False
      IsOutput: True
      RawMin: 0
      RawMax: 10
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 10
      Symbol:
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: True
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: True
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: RGB O
      IsInput: False
      IsOutput: True
      RawMin: 0
      RawMax: 255
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 255
      Symbol:
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: True
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 3
      DatasetType: SByte
      TotalFigures: 3
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
  Port: 58
    IOTypeId: InternalTilt
    HardwareRevision: 1.0.0.0
    SoftwareRevision: 0.2.1.0
    OutputCapability: False
    InputCapability: True
    LogicalCombinableCapability: True
    LogicalSynchronizableCapability: False
    ModeCombinations: [0000000000011111]
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: ANGLE
      IsInput: True
      IsOutput: False
      RawMin: -90
      RawMax: 90
      PctMin: -100
      PctMax: 100
      SIMin: -90
      SIMax: 90
      Symbol: DEG
      InputSupportsNull: False
      InputSupportFunctionalMapping20: True
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 2
      DatasetType: SByte
      TotalFigures: 3
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: TILT
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 10
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 10
      Symbol: DIR
      InputSupportsNull: False
      InputSupportFunctionalMapping20: True
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: True
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 2
      Name: ORINT
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 5
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 5
      Symbol: DIR
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 3
      Name: IMPCT
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 100
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 100
      Symbol: IMP
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: True
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int32
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 4
      Name: ACCEL
      IsInput: True
      IsOutput: False
      RawMin: -65
      RawMax: 65
      PctMin: -100
      PctMax: 100
      SIMin: -65
      SIMax: 65
      Symbol: ACC
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 3
      DatasetType: SByte
      TotalFigures: 3
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 5
      Name: OR_CF
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 6
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 6
      Symbol: SID
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 6
      Name: IM_CF
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 255
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 255
      Symbol: SEN
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 2
      DatasetType: SByte
      TotalFigures: 3
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 7
      Name: CALIB
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 255
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 255
      Symbol: CAL
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 3
      DatasetType: SByte
      TotalFigures: 3
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
  Port: 59
    IOTypeId: Current
    HardwareRevision: 0.0.0.2
    SoftwareRevision: 0.0.1.0
    OutputCapability: False
    InputCapability: True
    LogicalCombinableCapability: False
    LogicalSynchronizableCapability: False
    ModeCombinations: []
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: CUR L
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 4095
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 2444
      Symbol: mA
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int16
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: CUR S
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 4095
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 2444
      Symbol: mA
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int16
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
  Port: 60
    IOTypeId: Voltage
    HardwareRevision: 0.0.0.2
    SoftwareRevision: 0.0.1.0
    OutputCapability: False
    InputCapability: True
    LogicalCombinableCapability: False
    LogicalSynchronizableCapability: False
    ModeCombinations: []
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: VLT L
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 3893
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 9600
      Symbol: mV
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int16
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: VLT S
      IsInput: True
      IsOutput: False
      RawMin: 0
      RawMax: 3893
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 9600
      Symbol: mV
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: True
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int16
      TotalFigures: 4
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
  Port: 70
    IOTypeId: 66
    HardwareRevision: 0.0.0.1
    SoftwareRevision: 1.0.0.0
    OutputCapability: False
    InputCapability: False
    LogicalCombinableCapability: True
    LogicalSynchronizableCapability: False
    ModeCombinations: [0000000000000111]
    UsedCombinationIndex: 0
    MultiUpdateEnabled: False
    ConfiguredModeDataSetIndex: []
    Mode: 0
      Name: TRIGGER
      IsInput: False
      IsOutput: False
      RawMin: 0
      RawMax: 10
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 10
      Symbol:
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 1
      Name: CANVAS
      IsInput: False
      IsOutput: False
      RawMin: 0
      RawMax: 10
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 10
      Symbol:
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: SByte
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False
    Mode: 2
      Name: VAR
      IsInput: False
      IsOutput: False
      RawMin: 0
      RawMax: 10
      PctMin: 0
      PctMax: 100
      SIMin: 0
      SIMax: 10
      Symbol:
      InputSupportsNull: False
      InputSupportFunctionalMapping20: False
      InputAbsolute: False
      InputRelative: False
      InputDiscrete: False
      OutputSupportsNull: False
      OutputSupportFunctionalMapping20: False
      OutputAbsolute: False
      OutputRelative: False
      OutputDiscrete: False
      NumberOfDatasets: 1
      DatasetType: Int32
      TotalFigures: 1
      Decimals: 0
      DeltaInterval: 0
      NotificationEnabled: False

Port 0

poweredup device dump-static-port -p 0
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: MoveHub (with address 95892814641)
1
Selected MoveHub with key 1
Discover Port 0. Receiving Messages ...
........................
Discover Ports Function: 23 / 23
##################################################
0B-00-43-00-01-0F-03-06-00-07-00
07-00-43-00-02-06-00
11-00-44-00-00-00-50-4F-57-45-52-00-00-00-00-00-00
0E-00-44-00-00-01-00-00-C8-C2-00-00-C8-42
0E-00-44-00-00-02-00-00-C8-C2-00-00-C8-42
0E-00-44-00-00-03-00-00-C8-C2-00-00-C8-42
0A-00-44-00-00-04-50-43-54-00
08-00-44-00-00-05-00-10
0A-00-44-00-00-80-01-00-01-00
11-00-44-00-01-00-53-50-45-45-44-00-00-00-00-00-00
0E-00-44-00-01-01-00-00-C8-C2-00-00-C8-42
0E-00-44-00-01-02-00-00-C8-C2-00-00-C8-42
0E-00-44-00-01-03-00-00-C8-C2-00-00-C8-42
0A-00-44-00-01-04-50-43-54-00
08-00-44-00-01-05-10-10
0A-00-44-00-01-80-01-00-04-00
11-00-44-00-02-00-50-4F-53-00-00-00-00-00-00-00-00
0E-00-44-00-02-01-00-00-B4-C3-00-00-B4-43
0E-00-44-00-02-02-00-00-C8-C2-00-00-C8-42
0E-00-44-00-02-03-00-00-B4-C3-00-00-B4-43
0A-00-44-00-02-04-44-45-47-00
08-00-44-00-02-05-08-08
0A-00-44-00-02-80-01-02-04-00
##################################################

Port 1

poweredup device dump-static-port -p 1
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: MoveHub (with address 95892814641)
1
Selected MoveHub with key 1
Discover Port 1. Receiving Messages ...
........................
Discover Ports Function: 23 / 23
##################################################
0B-00-43-01-01-0F-03-06-00-07-00
07-00-43-01-02-06-00
11-00-44-01-00-00-50-4F-57-45-52-00-00-00-00-00-00
0E-00-44-01-00-01-00-00-C8-C2-00-00-C8-42
0E-00-44-01-00-02-00-00-C8-C2-00-00-C8-42
0E-00-44-01-00-03-00-00-C8-C2-00-00-C8-42
0A-00-44-01-00-04-50-43-54-00
08-00-44-01-00-05-00-10
0A-00-44-01-00-80-01-00-01-00
11-00-44-01-01-00-53-50-45-45-44-00-00-00-00-00-00
0E-00-44-01-01-01-00-00-C8-C2-00-00-C8-42
0E-00-44-01-01-02-00-00-C8-C2-00-00-C8-42
0E-00-44-01-01-03-00-00-C8-C2-00-00-C8-42
0A-00-44-01-01-04-50-43-54-00
08-00-44-01-01-05-10-10
0A-00-44-01-01-80-01-00-04-00
11-00-44-01-02-00-50-4F-53-00-00-00-00-00-00-00-00
0E-00-44-01-02-01-00-00-B4-C3-00-00-B4-43
0E-00-44-01-02-02-00-00-C8-C2-00-00-C8-42
0E-00-44-01-02-03-00-00-B4-C3-00-00-B4-43
0A-00-44-01-02-04-44-45-47-00
08-00-44-01-02-05-08-08
0A-00-44-01-02-80-01-02-04-00
##################################################

Port 16

poweredup device dump-static-port -p 16
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: MoveHub (with address 95892814641)
1
Selected MoveHub with key 1
Discover Port 16. Receiving Messages ...
........................
Discover Ports Function: 23 / 23
##################################################
0B-00-43-10-01-07-03-06-00-07-00
07-00-43-10-02-06-00
11-00-44-10-00-00-50-4F-57-45-52-00-00-00-00-00-00
0E-00-44-10-00-01-00-00-C8-C2-00-00-C8-42
0E-00-44-10-00-02-00-00-C8-C2-00-00-C8-42
0E-00-44-10-00-03-00-00-C8-C2-00-00-C8-42
0A-00-44-10-00-04-50-43-54-00
08-00-44-10-00-05-00-10
0A-00-44-10-00-80-01-00-01-00
11-00-44-10-01-00-53-50-45-45-44-00-00-00-00-00-00
0E-00-44-10-01-01-00-00-C8-C2-00-00-C8-42
0E-00-44-10-01-02-00-00-C8-C2-00-00-C8-42
0E-00-44-10-01-03-00-00-C8-C2-00-00-C8-42
0A-00-44-10-01-04-50-43-54-00
08-00-44-10-01-05-10-10
0A-00-44-10-01-80-01-00-04-00
11-00-44-10-02-00-50-4F-53-00-00-00-00-00-00-00-00
0E-00-44-10-02-01-00-00-B4-C3-00-00-B4-43
0E-00-44-10-02-02-00-00-C8-C2-00-00-C8-42
0E-00-44-10-02-03-00-00-B4-C3-00-00-B4-43
0A-00-44-10-02-04-44-45-47-00
08-00-44-10-02-05-08-08
0A-00-44-10-02-80-01-02-04-00
##################################################

Port 50

poweredup device dump-static-port -p 50
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: MoveHub (with address 95892814641)
1
Selected MoveHub with key 1
Discover Port 50. Receiving Messages ...
.................
Discover Ports Function: 16 / 16
##################################################
0B-00-43-32-01-01-02-00-00-03-00
05-00-43-32-02
11-00-44-32-00-00-43-4F-4C-20-4F-00-00-00-00-00-00
0E-00-44-32-00-01-00-00-00-00-00-00-20-41
0E-00-44-32-00-02-00-00-00-00-00-00-C8-42
0E-00-44-32-00-03-00-00-00-00-00-00-20-41
0A-00-44-32-00-04-00-00-00-00
08-00-44-32-00-05-00-44
0A-00-44-32-00-80-01-00-01-00
11-00-44-32-01-00-52-47-42-20-4F-00-00-00-00-00-00
0E-00-44-32-01-01-00-00-00-00-00-00-7F-43
0E-00-44-32-01-02-00-00-00-00-00-00-C8-42
0E-00-44-32-01-03-00-00-00-00-00-00-7F-43
0A-00-44-32-01-04-00-00-00-00
08-00-44-32-01-05-00-10
0A-00-44-32-01-80-03-00-03-00
##################################################

Port 58

poweredup device dump-static-port -p 58
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: MoveHub (with address 95892814641)
1
Selected MoveHub with key 1
Discover Port 58. Receiving Messages ...
...........................................................
Discover Ports Function: 58 / 58
##################################################
0B-00-43-3A-01-06-08-FF-00-00-00
07-00-43-3A-02-1F-00
11-00-44-3A-00-00-41-4E-47-4C-45-00-00-00-00-00-00
0E-00-44-3A-00-01-00-00-B4-C2-00-00-B4-42
0E-00-44-3A-00-02-00-00-C8-C2-00-00-C8-42
0E-00-44-3A-00-03-00-00-B4-C2-00-00-B4-42
0A-00-44-3A-00-04-44-45-47-00
08-00-44-3A-00-05-50-00
0A-00-44-3A-00-80-02-00-03-00
11-00-44-3A-01-00-54-49-4C-54-00-00-00-00-00-00-00
0E-00-44-3A-01-01-00-00-00-00-00-00-20-41
0E-00-44-3A-01-02-00-00-00-00-00-00-C8-42
0E-00-44-3A-01-03-00-00-00-00-00-00-20-41
0A-00-44-3A-01-04-44-49-52-00
08-00-44-3A-01-05-44-00
0A-00-44-3A-01-80-01-00-01-00
11-00-44-3A-02-00-4F-52-49-4E-54-00-00-00-00-00-00
0E-00-44-3A-02-01-00-00-00-00-00-00-A0-40
0E-00-44-3A-02-02-00-00-00-00-00-00-C8-42
0E-00-44-3A-02-03-00-00-00-00-00-00-A0-40
0A-00-44-3A-02-04-44-49-52-00
08-00-44-3A-02-05-10-00
0A-00-44-3A-02-80-01-00-01-00
11-00-44-3A-03-00-49-4D-50-43-54-00-00-00-00-00-00
0E-00-44-3A-03-01-00-00-00-00-00-00-C8-42
0E-00-44-3A-03-02-00-00-00-00-00-00-C8-42
0E-00-44-3A-03-03-00-00-00-00-00-00-C8-42
0A-00-44-3A-03-04-49-4D-50-00
08-00-44-3A-03-05-08-00
0A-00-44-3A-03-80-01-02-04-00
11-00-44-3A-04-00-41-43-43-45-4C-00-00-00-00-00-00
0E-00-44-3A-04-01-00-00-82-C2-00-00-82-42
0E-00-44-3A-04-02-00-00-C8-C2-00-00-C8-42
0E-00-44-3A-04-03-00-00-82-C2-00-00-82-42
0A-00-44-3A-04-04-41-43-43-00
08-00-44-3A-04-05-10-00
0A-00-44-3A-04-80-03-00-03-00
11-00-44-3A-05-00-4F-52-5F-43-46-00-00-00-00-00-00
0E-00-44-3A-05-01-00-00-00-00-00-00-C0-40
0E-00-44-3A-05-02-00-00-00-00-00-00-C8-42
0E-00-44-3A-05-03-00-00-00-00-00-00-C0-40
0A-00-44-3A-05-04-53-49-44-00
08-00-44-3A-05-05-10-00
0A-00-44-3A-05-80-01-00-01-00
11-00-44-3A-06-00-49-4D-5F-43-46-00-00-00-00-00-00
0E-00-44-3A-06-01-00-00-00-00-00-00-7F-43
0E-00-44-3A-06-02-00-00-00-00-00-00-C8-42
0E-00-44-3A-06-03-00-00-00-00-00-00-7F-43
0A-00-44-3A-06-04-53-45-4E-00
08-00-44-3A-06-05-10-00
0A-00-44-3A-06-80-02-00-03-00
11-00-44-3A-07-00-43-41-4C-49-42-00-00-00-00-00-00
0E-00-44-3A-07-01-00-00-00-00-00-00-7F-43
0E-00-44-3A-07-02-00-00-00-00-00-00-C8-42
0E-00-44-3A-07-03-00-00-00-00-00-00-7F-43
0A-00-44-3A-07-04-43-41-4C-00
08-00-44-3A-07-05-10-00
0A-00-44-3A-07-80-03-00-03-00
##################################################

Port 59

poweredup device dump-static-port -p 59
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: MoveHub (with address 95892814641)
1
Selected MoveHub with key 1
Discover Port 59. Receiving Messages ...
.................
Discover Ports Function: 16 / 16
##################################################
0B-00-43-3B-01-02-02-03-00-00-00
05-00-43-3B-02
11-00-44-3B-00-00-43-55-52-20-4C-00-00-00-00-00-00
0E-00-44-3B-00-01-00-00-00-00-00-F0-7F-45
0E-00-44-3B-00-02-00-00-00-00-00-00-C8-42
0E-00-44-3B-00-03-00-00-00-00-00-C0-18-45
0A-00-44-3B-00-04-6D-41-00-00
08-00-44-3B-00-05-10-00
0A-00-44-3B-00-80-01-01-04-00
11-00-44-3B-01-00-43-55-52-20-53-00-00-00-00-00-00
0E-00-44-3B-01-01-00-00-00-00-00-F0-7F-45
0E-00-44-3B-01-02-00-00-00-00-00-00-C8-42
0E-00-44-3B-01-03-00-00-00-00-00-C0-18-45
0A-00-44-3B-01-04-6D-41-00-00
08-00-44-3B-01-05-10-00
0A-00-44-3B-01-80-01-01-04-00
##################################################

Port 60

poweredup device dump-static-port -p 60
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: MoveHub (with address 95892814641)
1
Selected MoveHub with key 1
Discover Port 60. Receiving Messages ...
.................
Discover Ports Function: 16 / 16
##################################################
0B-00-43-3C-01-02-02-03-00-00-00
05-00-43-3C-02
11-00-44-3C-00-00-56-4C-54-20-4C-00-00-00-00-00-00
0E-00-44-3C-00-01-00-00-00-00-00-50-73-45
0E-00-44-3C-00-02-00-00-00-00-00-00-C8-42
0E-00-44-3C-00-03-00-00-00-00-00-00-16-46
0A-00-44-3C-00-04-6D-56-00-00
08-00-44-3C-00-05-10-00
0A-00-44-3C-00-80-01-01-04-00
11-00-44-3C-01-00-56-4C-54-20-53-00-00-00-00-00-00
0E-00-44-3C-01-01-00-00-00-00-00-50-73-45
0E-00-44-3C-01-02-00-00-00-00-00-00-C8-42
0E-00-44-3C-01-03-00-00-00-00-00-00-16-46
0A-00-44-3C-01-04-6D-56-00-00
08-00-44-3C-01-05-10-00
0A-00-44-3C-01-80-01-01-04-00
##################################################

Port 70

poweredup device dump-static-port -p 70
Scan Started. Please select the Hub (using a number keys or 'q' to terminate):
1: MoveHub (with address 95892814641)
1
Selected MoveHub with key 1
Discover Port 70. Receiving Messages ...
........................
Discover Ports Function: 23 / 23
##################################################
0B-00-43-46-01-04-03-00-00-00-00
07-00-43-46-02-07-00
11-00-44-46-00-00-54-52-49-47-47-45-52-00-00-00-00
0E-00-44-46-00-01-00-00-00-00-00-00-20-41
0E-00-44-46-00-02-00-00-00-00-00-00-C8-42
0E-00-44-46-00-03-00-00-00-00-00-00-20-41
0A-00-44-46-00-04-00-00-00-00
08-00-44-46-00-05-00-00
0A-00-44-46-00-80-01-00-01-00
11-00-44-46-01-00-43-41-4E-56-41-53-00-00-00-00-00
0E-00-44-46-01-01-00-00-00-00-00-00-20-41
0E-00-44-46-01-02-00-00-00-00-00-00-C8-42
0E-00-44-46-01-03-00-00-00-00-00-00-20-41
0A-00-44-46-01-04-00-00-00-00
08-00-44-46-01-05-00-00
0A-00-44-46-01-80-01-00-01-00
11-00-44-46-02-00-56-41-52-00-00-00-00-00-00-00-00
0E-00-44-46-02-01-00-00-00-00-00-00-20-41
0E-00-44-46-02-02-00-00-00-00-00-00-C8-42
0E-00-44-46-02-03-00-00-00-00-00-00-20-41
0A-00-44-46-02-04-00-00-00-00
08-00-44-46-02-05-00-00
0A-00-44-46-02-80-01-02-01-00
##################################################
corneliusmunz commented 3 years ago

If it is ok, i will try to contribute with a PR for the MoveHub. Maybe i will need some guidance 😄

tthiery commented 3 years ago

I would really appreciate. Just post here when you need help!

corneliusmunz commented 3 years ago

I have done first adaptions to add the MoveHub to the project: https://github.com/corneliusmunz/powered-up/tree/feature/add_move_hub

Unfortunately if i execute the very basic example the connetion works and it fetches all ports and attached devices but after that the service receives immediately a disconnect message. I think for the Mario stuff it is the same. The disconnect is in my point of view initiated by the hub itself.

Here the trace messages i receive:

info: Example[0]
      Finding Service
info: Example[0]
      Press RETURN to cancel Scanning
info: SharpBrick.PoweredUp.PoweredUpHost[0]
      Discovered log of type MoveHub with name 'myBoostHub' on Bluetooth Address '95892814641'
info: Example[0]
      Connecting to Hub
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      Connected
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      Registered Receive Handler
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-00-01-27-00-00-00-00-10-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/0 of device type InternalMotorWithTacho (HW: 1.0.0.0 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-01-01-27-00-00-00-00-10-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/1 of device type InternalMotorWithTacho (HW: 1.0.0.0 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 09-00-04-10-02-27-00-00-01
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached Virtual IO - Port 0/16 using ports 0 + 1 of device type InternalMotorWithTacho
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-32-01-17-00-00-00-00-01-06-00-00-20
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/50 of device type RgbLight (HW: 0.1.0.0 / SW: 2.0.0.6)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3A-01-28-00-00-00-00-10-00-00-01-02
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/58 of device type InternalTilt (HW: 1.0.0.0 / SW: 0.2.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3B-01-15-00-02-00-00-00-00-00-01-00
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/59 of device type Current (HW: 0.0.0.2 / SW: 0.0.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3C-01-14-00-02-00-00-00-00-00-01-00
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/60 of device type Voltage (HW: 0.0.0.2 / SW: 0.0.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-46-01-42-00-01-00-00-00-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/70 of device type 66 (HW: 0.0.0.1 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 04-00-02-30
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Hub Action - HubWillSwitchOff
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 04-00-02-31
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Hub Action - HubWillDisconnect
tthiery commented 3 years ago

Seeing your example it should all work fine. Have you tested the BT behavior when SharpBrick.PoweredUp is not involved?

Could be the same as for Mario, just that Mario would be closed even earlier.

tthiery commented 3 years ago

BLE issues of MarioHub was related to a notebook and we are now deeper in the stack examining other issues. The JavaScript library implements the Lego Wireless Protocol as well and the only thing they do different between the TechnicMediumHub and the MoveHub is a firmware check on the device

Maybe you can also try it from a different notebook to rule the local computer's bluetooth stack out of the equation.

corneliusmunz commented 3 years ago

@tthiery I have merged the new changes of the master branch into my feature branch and adapted the SystemType stuff. I tried to run the example again and got the follwowing result. I think it is not realated to the notebook because the TwoPort stuff works fine:

info: Example[0]
      Finding Service
info: Example[0]
      Press RETURN to cancel Scanning
info: SharpBrick.PoweredUp.PoweredUpHost[0]
      Discovered log of type MoveHub with name 'myBoostHub' on Bluetooth Address '95892814641'
info: Example[0]
      Connecting to Hub
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      Connected
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-00-01-27-00-00-00-00-10-00-00-00-10
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      Registered Receive Handler
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/0 of device type InternalMotorWithTacho (HW: 1.0.0.0 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-01-01-27-00-00-00-00-10-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/1 of device type InternalMotorWithTacho (HW: 1.0.0.0 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 09-00-04-10-02-27-00-00-01
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached Virtual IO - Port 0/16 using ports 0 + 1 of device type InternalMotorWithTacho
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-32-01-17-00-00-00-00-01-06-00-00-20
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/50 of device type RgbLight (HW: 0.1.0.0 / SW: 2.0.0.6)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3A-01-28-00-00-00-00-10-00-00-01-02
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/58 of device type InternalTilt (HW: 1.0.0.0 / SW: 0.2.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3B-01-15-00-02-00-00-00-00-00-01-00
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/59 of device type Current (HW: 0.0.0.2 / SW: 0.0.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3C-01-14-00-02-00-00-00-00-00-01-00
fail: SharpBrick.PoweredUp.Protocol.LegoWirelessProtocol[0]
      Exception in LegoWirelessProtocol Decode/Knowledge
System.NotImplementedException: The method or operation is not implemented.
   at SharpBrick.PoweredUp.Voltage.GetStaticPortInfoMessages(Version softwareVersion, Version hardwareVersion, SystemType systemType) in C:\Users\Cornelius\source\repos\powered-up-fork\src\SharpBrick.PoweredUp\Devices\Voltage.cs:line 38
   at SharpBrick.PoweredUp.Protocol.Knowledge.KnowledgeManager.AddCachePortAndPortModeInformation(DeviceType type, Version hardwareRevision, Version softwareRevision, HubInfo hub, PortInfo port, ProtocolKnowledge knowledge, IDeviceFactory deviceFactory) in C:\Users\Cornelius\source\repos\powered-up-fork\src\SharpBrick.PoweredUp\Protocol\Knowledge\KnowledgeManager.cs:line 187
   at SharpBrick.PoweredUp.Protocol.Knowledge.KnowledgeManager.ApplyDynamicProtocolKnowledge(LegoWirelessMessage message, ProtocolKnowledge knowledge, IDeviceFactory deviceFactory) in C:\Users\Cornelius\source\repos\powered-up-fork\src\SharpBrick.PoweredUp\Protocol\Knowledge\KnowledgeManager.cs:line 129
   at SharpBrick.PoweredUp.Protocol.LegoWirelessProtocol.<ConnectAsync>b__15_0(Byte[] data) in C:\Users\Cornelius\source\repos\powered-up-fork\src\SharpBrick.PoweredUp\Protocol\LegoWirelessProtocol.cs:line 55
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-46-01-42-00-01-00-00-00-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/70 of device type 66 (HW: 0.0.0.1 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 04-00-02-30
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Hub Action - HubWillSwitchOff
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 04-00-02-31
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Hub Action - HubWillDisconnect
tthiery commented 3 years ago

With that I can help. Every device has Static and non-static Port and Port Mode Information. I hardcode them to not need to query them from the devices (it would take like 20 BLE messages each time the hub initializes).

So for Voltage there is a branching because every hub has different voltage definitions. And here you run into the situation that none is defined for MoveHub Voltage device.

The content you dropped above with poweredup device dump-static-port -p can be copy pasted into it.

corneliusmunz commented 3 years ago

@tthiery thanks for guiding me! I have added the static dump and i am one step further (or unfortunately at the same step as last week). I think the Port 70 of the Move hub with the device Id 66 is not known and i don't now what this means. I can also not find a DeviceType on @nathankellenicki library. Here are the debug infos of the ExampleMoveHubColors. I have pushed my code changes in the following branch: https://github.com/corneliusmunz/powered-up/tree/feature/add_move_hub

info: Example[0]
      Finding Service
info: Example[0]
      Press RETURN to cancel Scanning
info: SharpBrick.PoweredUp.PoweredUpHost[0]
      Discovered log of type MoveHub with name 'myBoostHub' on Bluetooth Address '95892814641'
info: Example[0]
      Connecting to Hub
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      Connected
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      Registered Receive Handler
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-00-01-27-00-00-00-00-10-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/0 of device type InternalMotorWithTacho (HW: 1.0.0.0 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-01-01-27-00-00-00-00-10-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/1 of device type InternalMotorWithTacho (HW: 1.0.0.0 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 09-00-04-10-02-27-00-00-01
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached Virtual IO - Port 0/16 using ports 0 + 1 of device type InternalMotorWithTacho
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-32-01-17-00-00-00-00-01-06-00-00-20
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/50 of device type RgbLight (HW: 0.1.0.0 / SW: 2.0.0.6)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3A-01-28-00-00-00-00-10-00-00-01-02
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/58 of device type InternalTilt (HW: 1.0.0.0 / SW: 0.2.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3B-01-15-00-02-00-00-00-00-00-01-00
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/59 of device type Current (HW: 0.0.0.2 / SW: 0.0.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3C-01-14-00-02-00-00-00-00-00-01-00
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/60 of device type Voltage (HW: 0.0.0.2 / SW: 0.0.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-46-01-42-00-01-00-00-00-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/70 of device type 66 (HW: 0.0.0.1 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 04-00-02-30
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Hub Action - HubWillSwitchOff
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 04-00-02-31
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Hub Action - HubWillDisconnect
tthiery commented 3 years ago

Well, in case you do not understand the port or the mode, do not expose it. Remove the known port from the MoveHub implementation (maybe comment it out). I guess, like that the library will not try to await it announcement as AttachedHubIO message and the initialization can complete.

If you comment it out and leave it like that, create an issue for investigation. I also have little hesitation filing issues against the documentation repo of Lego.

tthiery commented 3 years ago

btw, I would not be surprised if this is a Debug port like exposed on the MarioHub.

corneliusmunz commented 3 years ago

Ok, i have commented it out in the MoveHub.cs but now i receive the following error. So sorry for bothering you all the time...

info: Example[0]
      Finding Service
info: Example[0]
      Press RETURN to cancel Scanning
info: SharpBrick.PoweredUp.PoweredUpHost[0]
      Discovered log of type MoveHub with name 'myBoostHub' on Bluetooth Address '95892814641'
info: Example[0]
      Connecting to Hub
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      Connected
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      Registered Receive Handler
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-00-01-27-00-00-00-00-10-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/0 of device type InternalMotorWithTacho (HW: 1.0.0.0 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-01-01-27-00-00-00-00-10-00-00-00-10
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/1 of device type InternalMotorWithTacho (HW: 1.0.0.0 / SW: 1.0.0.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 09-00-04-10-02-27-00-00-01
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached Virtual IO - Port 0/16 using ports 0 + 1 of device type InternalMotorWithTacho
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-32-01-17-00-00-00-00-01-06-00-00-20
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/50 of device type RgbLight (HW: 0.1.0.0 / SW: 2.0.0.6)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3A-01-28-00-00-00-00-10-00-00-01-02
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/58 of device type InternalTilt (HW: 1.0.0.0 / SW: 0.2.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3B-01-15-00-02-00-00-00-00-00-01-00
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/59 of device type Current (HW: 0.0.0.2 / SW: 0.0.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-3C-01-14-00-02-00-00-00-00-00-01-00
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Attached IO - Port 0/60 of device type Voltage (HW: 0.0.0.2 / SW: 0.0.1.0)
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 0F-00-04-46-01-42-00-01-00-00-00-00-00-00-10
fail: SharpBrick.PoweredUp.Protocol.LegoWirelessProtocol[0]
      Exception in LegoWirelessProtocol Decode/Knowledge
System.NullReferenceException: Object reference not set to an instance of an object.
   at SharpBrick.PoweredUp.Hub.OnHubAttachedIOMessage(HubAttachedIOMessage hubAttachedIO) in C:\Users\Cornelius\source\repos\powered-up-fork\src\SharpBrick.PoweredUp\Hubs\Hub_Ports.cs:line 117
   at SharpBrick.PoweredUp.Hub.OnHubChange(LegoWirelessMessage message) in C:\Users\Cornelius\source\repos\powered-up-fork\src\SharpBrick.PoweredUp\Hubs\Hub.cs:line 102
   at System.Reactive.AnonymousSafeObserver`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs:line 43
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 49
   at System.Reactive.Linq.ObservableImpl.Where`1.Predicate._.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Where.cs:line 54
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value) in /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:line 49
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) in /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Select.cs:line 47
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 146
   at SharpBrick.PoweredUp.Protocol.LegoWirelessProtocol.<ConnectAsync>b__15_0(Byte[] data) in C:\Users\Cornelius\source\repos\powered-up-fork\src\SharpBrick.PoweredUp\Protocol\LegoWirelessProtocol.cs:line 57
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 04-00-02-30
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Hub Action - HubWillSwitchOff
dbug: SharpBrick.PoweredUp.Bluetooth.BluetoothKernel[0]
      < 04-00-02-31
info: SharpBrick.PoweredUp.Functions.TraceMessages[0]
      Hub Action - HubWillDisconnect
tthiery commented 3 years ago

That you have to debug. Probably the library has a bug because it never saw an unknown port 🤣

Sorry. Too Late to deep dive

KeyDecoder commented 3 years ago

Hi guys, I started playing around with getting my R2D2 to move using this library (which is awesome btw) and it's MoveHub using the branch done by corneliusmunz.

With the above issue, I found that leaving the port 70 in was the best option since the port gets announced by cannot find it in OnHubAttachedIOMessage (needs a null check in here to handle that scenario).

With the MoveHub connection, what I found was since the code to handle virtual ports (case OnHubAttachedIOMessage) is commented out in the switch statement, it's waiting for that virtual port (AB) to be attached in ExpectedDevicesCompletedAsync. I'm not sure why the code is commented out but once I un-commented it it worked fine and was able to start accessing the internal motor and external motor with some added code into the MoveHub.

Main question is if a good reason that code was commented out or not?

One thing I noticed with the MoveHub is that it has a very short timeout when you first turn it on, so if you don't finish connecting very quickly it will turn itself off.

tthiery commented 3 years ago

Reason for commenting out: the active use case (CreateVirtualPort) is handled here vs the general handler. I think the handler was raised twice when creating the VP manually.

Solution is likely to modify the logic during the expected device phase.

tthiery commented 3 years ago

Would anyone with the hardware mind finishing up this merge request 😁. @corneliusmunz is a bit busy with the legoino project so I think he does not mind when someone else finished it.

corneliusmunz commented 3 years ago

@KeyDecoder would be great if you take over the work which i have done. I can do some testing on a real device if this is needed. I also have experienced that the MoveHub needs very short connection times compared to all other hubs i have tested.

KeyDecoder commented 3 years ago

Sure, I can take a look although looks like you've pretty much done most of it.

For the virtual port, I'm assuming it was an issue where you told a device to create a virtual port and it then notified you, triggering the same code path twice?
If that is the case, what if we add a check when processing the attached virtual IO message to see if device already attached in the port (and the port exists as well) and if so then either ignore the message or detach and create a new device.

If we don't expect any more notifications after the connect, we could also just disable the handling of that message if received from the hub (which matches the logic that exists right now).

tthiery commented 3 years ago

The Lego Wireless Protocol for most parts is a request-response protocol. In the CreateVirtualPortAsync method we have to await the response. I would suggest that we introduce a boolean flag during the expected device discovery period to allow the general HubAttachedIO handler (uni-directional messages btw) to process the event (the uncommented code). After the expected device block we lock the behavior again. A bit ugly because it is state but it is within the hub logic part so I am fine with it.

KeyDecoder commented 3 years ago

Added PR. I've tried to keep the code styling consistent. Apologies if done anything the wrong way.

I handling the virtual port so during connection it will handle notifications from attaching virtual ports but after that it ignores them. That allows the MoveHub to register its virtual ports but maintains the current behaviour for manually creating virtual ports from the applications. Since I don't have any hardware to test virtual ports, this seemed best. I don't think this is exactly what you meant but it would be hard to implement that without any hardware test that with.