summaryrefslogtreecommitdiffstats
path: root/res/controllers/hid-controller-api.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'res/controllers/hid-controller-api.d.ts')
-rw-r--r--res/controllers/hid-controller-api.d.ts62
1 files changed, 62 insertions, 0 deletions
diff --git a/res/controllers/hid-controller-api.d.ts b/res/controllers/hid-controller-api.d.ts
new file mode 100644
index 0000000000..dbe4ca70d9
--- /dev/null
+++ b/res/controllers/hid-controller-api.d.ts
@@ -0,0 +1,62 @@
+
+/** HidControllerJSProxy */
+
+declare namespace controller {
+ /**
+ * Sends HID OutputReport with hard coded ReportID 0 to HID device
+ *
+ * This function only works with HID devices, which don't use ReportIDs
+ *
+ * @param dataList Data to send as list of bytes
+ * @param length Unused but mandatory argument for backwards compatibility
+ */
+ function send(dataList: number[], length?: number): void;
+
+ /**
+ * Sends HID OutputReport to HID device
+ *
+ * @param dataList Data to send as list of bytes
+ * @param length Unused but mandatory argument for backwards compatibility
+ * @param reportID 1...255 for HID devices that uses ReportIDs - or 0 for devices, which don't use ReportIDs
+ * @param resendUnchangedReport If set, the report will also be send, if the data are unchanged since last sending [default = false]
+ */
+ function send(dataList: number[], length: number, reportID: number, resendUnchangedReport?: boolean): void;
+
+ /**
+ * Sends an OutputReport to HID device
+ *
+ * @param reportID 1...255 for HID devices that uses ReportIDs - or 0 for devices, which don't use ReportIDs
+ * @param dataArray Data to send as byte array
+ * @param resendUnchangedReport If set, the report will also be send, if the data are unchanged since last sending [default = false]
+ */
+ function sendOutputReport(reportID: number, dataArray: ArrayBuffer, resendUnchangedReport?: boolean): void;
+
+ /**
+ * getInputReport receives an InputReport from the HID device on request.
+ *
+ * This can be used on startup to initialize the knob positions in Mixxx
+ * to the physical position of the hardware knobs on the controller.
+ * This is an optional command in the HID standard - not all devices support it.
+ *
+ * @param reportID 1...255 for HID devices that uses ReportIDs - or 0 for devices, which don't use
+ * @returns Returns report data with ReportID byte as prefix
+ */
+ function getInputReport(reportID: number): ArrayBuffer;
+
+ /**
+ * Sends a FeatureReport to HID device
+ *
+ * @param reportID 1...255 for HID devices that uses ReportIDs - or 0 for devices, which don't use
+ * @param reportData Data to send as byte array
+ */
+ function sendFeatureReport(reportID: number, reportData: ArrayBuffer): void;
+
+ /**
+ * getFeatureReport receives a FeatureReport from the HID device on request.
+ *
+ * @param reportID 1...255 for HID devices that uses ReportIDs - or 0 for devices, which don't use
+ * @returns The returned array matches the input format of sendFeatureReport,
+ * allowing it to be read, modified and sent it back to the controller.
+ */
+ function getFeatureReport(reportID: number): ArrayBuffer;
+}