// // OSCScriptingInterface.h // interface/src/scripting // // Created by Ada on 2025-12-13 // Copyright 2025 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #ifndef hifi_OSCScriptingInterface_h #define hifi_OSCScriptingInterface_h #include #include #include "SettingHandle.h" #include "ScriptManager.h" class OSCScriptingInterface : public QObject { Q_OBJECT void receivePacket(); public: OSCScriptingInterface(ScriptManager* parent); ~OSCScriptingInterface(); /*@jsdoc * Sends an encoded OSC message. The target host address and port are visible as the osc/sendHost and osc/sendPort settings. * @function OSCSocket.sendMessage * @param {string} address - The OSC address, starting with / * @param {string} argumentTypes - A string of the data types contained in arguments. * Supports the i (32-bit integer), f (32-bit float), * s (null-terminated string), b (ArrayBuffer), T (boolean true), and F (boolean false) tag types. The string should not be prefixed with a comma. May be left empty for no arguments. * @param {Array.<*>} [arguments] - OSC arguments. */ Q_INVOKABLE void sendMessage(const QString& address, const QString& argumentTypes = QString(), const QVariantList& arguments = QVariantList()); signals: /*@jsdoc * Triggered when an OSC datagram is received. The receiving host address and port are visible as the osc/receiveHost and osc/receivePort settings. * @function OSCSocket.messageReceived * @param {string} address - OSC address starting with / * @param {string} argumentTypes - String of OSC data types contained by arguments * @param {Array.<*>} arguments * @returns {Signal} */ void messageReceived(const QString& address, const QString& argumentTypes, const QVariantList& arguments); private: ScriptManager* _scriptManager; Setting::Handle _receivePort; Setting::Handle _receiveHost; Setting::Handle _sendPort; Setting::Handle _sendHost; std::shared_ptr _socket; }; #endif