Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for SensorSubscribeCmd #255

Open
salaink opened this issue Oct 16, 2023 · 1 comment
Open

Support for SensorSubscribeCmd #255

salaink opened this issue Oct 16, 2023 · 1 comment
Labels

Comments

@salaink
Copy link

salaink commented Oct 16, 2023

Currently support for SensorSubscribeCmd is missing.

This is my current workaround, but it's really ugly:

class SensorSubscribeCmd extends Buttplug.ButtplugDeviceMessage {
  static Name = "SensorSubscribeCmd"
  constructor(DeviceIndex, SensorIndex, SensorType) {
    super(DeviceIndex, Buttplug.DEFAULT_MESSAGE_ID);
		this.SensorIndex = SensorIndex
		this.SensorType = SensorType
  }
}

const sorter = Window.BP.bpClient._connector._sorter;
const old_pim = sorter.ParseIncomingMessages;
sorter.ParseIncomingMessages = (msgs) => { 
    for (const msg of msgs) {
        if (msg.Type == Buttplug.SensorReading) {
            // handle msg.Data[0]
        }
    }
    return old_pim.apply(sorter, [msgs]);
};
const dev = Window.BP.devices["Generic Vibrator"];
dev.sendExpectOk(new SensorSubscribeCmd(1, 0, "foo")).then(console.log);
@salaink salaink added the bug label Oct 16, 2023
@qdot
Copy link
Member

qdot commented Oct 16, 2023

Ugh yeah I'm trying to rework the sensor system, it's broken in a fairly fundamental way right now. That's why this hadn't gotten implemented here yet. It is on my list tho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants