mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-31 13:00:26 -04:00 
			
		
		
		
	Web API: /sdrangel/audio (GET) implementation (1)
This commit is contained in:
		
							parent
							
								
									6c31320812
								
							
						
					
					
						commit
						dad604dcf8
					
				| @ -696,12 +696,16 @@ margin-bottom: 20px; | |||||||
|     // Script section to load models into a JS Var |     // Script section to load models into a JS Var | ||||||
|     var defs = {} |     var defs = {} | ||||||
|             defs.AudioDevices = { |             defs.AudioDevices = { | ||||||
|   "required" : [ "nbInputDevices", "nbOutputDevices" ], |   "required" : [ "inputDeviceSelectedIndex", "nbInputDevices", "nbOutputDevices", "outputDeviceSelectedIndex" ], | ||||||
|   "properties" : { |   "properties" : { | ||||||
|     "nbInputDevices" : { |     "nbInputDevices" : { | ||||||
|       "type" : "integer", |       "type" : "integer", | ||||||
|       "description" : "Number of input audio devices" |       "description" : "Number of input audio devices" | ||||||
|     }, |     }, | ||||||
|  |     "inputDeviceSelectedIndex" : { | ||||||
|  |       "type" : "integer", | ||||||
|  |       "description" : "Index of selected input audio devices (-1 if default)" | ||||||
|  |     }, | ||||||
|     "inputDevices" : { |     "inputDevices" : { | ||||||
|       "type" : "array", |       "type" : "array", | ||||||
|       "description" : "Names of input devices", |       "description" : "Names of input devices", | ||||||
| @ -713,6 +717,10 @@ margin-bottom: 20px; | |||||||
|       "type" : "integer", |       "type" : "integer", | ||||||
|       "description" : "Number of output audio devices" |       "description" : "Number of output audio devices" | ||||||
|     }, |     }, | ||||||
|  |     "outputDeviceSelectedIndex" : { | ||||||
|  |       "type" : "integer", | ||||||
|  |       "description" : "Index of selected output audio devices (-1 if default)" | ||||||
|  |     }, | ||||||
|     "outputDevices" : { |     "outputDevices" : { | ||||||
|       "type" : "array", |       "type" : "array", | ||||||
|       "description" : "Names of output devices", |       "description" : "Names of output devices", | ||||||
| @ -726,12 +734,12 @@ margin-bottom: 20px; | |||||||
|             defs.AudioDevicesSelect = { |             defs.AudioDevicesSelect = { | ||||||
|   "properties" : { |   "properties" : { | ||||||
|     "input" : { |     "input" : { | ||||||
|       "type" : "string", |       "type" : "integer", | ||||||
|       "description" : "Name of the audio input device" |       "description" : "Index of the audio input device (-1 for default)" | ||||||
|     }, |     }, | ||||||
|     "output" : { |     "output" : { | ||||||
|       "type" : "string", |       "type" : "integer", | ||||||
|       "description" : "Name of the audio output device" |       "description" : "Index of the audio output device (-1 for default)" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "description" : "Audio devices selected" |   "description" : "Audio devices selected" | ||||||
| @ -7356,7 +7364,7 @@ except ApiException as e: | |||||||
|           </div> |           </div> | ||||||
|           <div id="generator"> |           <div id="generator"> | ||||||
|             <div class="content"> |             <div class="content"> | ||||||
|               Generated 2017-11-24T00:55:01.257+01:00 |               Generated 2017-11-24T08:42:52.359+01:00 | ||||||
|             </div> |             </div> | ||||||
|           </div> |           </div> | ||||||
|       </div> |       </div> | ||||||
|  | |||||||
| @ -22,4 +22,4 @@ QString WebAPIAdapterInterface::instanceSummaryURL = "/sdrangel"; | |||||||
| QString WebAPIAdapterInterface::instanceDevicesURL = "/sdrangel/devices"; | QString WebAPIAdapterInterface::instanceDevicesURL = "/sdrangel/devices"; | ||||||
| QString WebAPIAdapterInterface::instanceChannelsURL = "/sdrangel/channels"; | QString WebAPIAdapterInterface::instanceChannelsURL = "/sdrangel/channels"; | ||||||
| QString WebAPIAdapterInterface::instanceLoggingURL = "/sdrangel/logging"; | QString WebAPIAdapterInterface::instanceLoggingURL = "/sdrangel/logging"; | ||||||
| 
 | QString WebAPIAdapterInterface::instanceAudioURL = "/sdrangel/audio"; | ||||||
|  | |||||||
| @ -27,6 +27,7 @@ namespace Swagger | |||||||
|     class SWGInstanceDevicesResponse; |     class SWGInstanceDevicesResponse; | ||||||
|     class SWGInstanceChannelsResponse; |     class SWGInstanceChannelsResponse; | ||||||
|     class SWGLoggingInfo; |     class SWGLoggingInfo; | ||||||
|  |     class SWGAudioDevices; | ||||||
|     class SWGErrorResponse; |     class SWGErrorResponse; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -82,10 +83,20 @@ public: | |||||||
|             Swagger::SWGErrorResponse& error __attribute__((unused))) |             Swagger::SWGErrorResponse& error __attribute__((unused))) | ||||||
|     { return 501; } |     { return 501; } | ||||||
| 
 | 
 | ||||||
|  |     /**
 | ||||||
|  |      * Handler of /sdrangel/audio (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels | ||||||
|  |      * returns the Http status code (default 501: not implemented) | ||||||
|  |      */ | ||||||
|  |     virtual int instanceAudioGet( | ||||||
|  |             Swagger::SWGAudioDevices& response __attribute__((unused)), | ||||||
|  |             Swagger::SWGErrorResponse& error __attribute__((unused))) | ||||||
|  |     { return 501; } | ||||||
|  | 
 | ||||||
|     static QString instanceSummaryURL; |     static QString instanceSummaryURL; | ||||||
|     static QString instanceDevicesURL; |     static QString instanceDevicesURL; | ||||||
|     static QString instanceChannelsURL; |     static QString instanceChannelsURL; | ||||||
|     static QString instanceLoggingURL; |     static QString instanceLoggingURL; | ||||||
|  |     static QString instanceAudioURL; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -25,6 +25,8 @@ | |||||||
| #include "SWGInstanceSummaryResponse.h" | #include "SWGInstanceSummaryResponse.h" | ||||||
| #include "SWGInstanceDevicesResponse.h" | #include "SWGInstanceDevicesResponse.h" | ||||||
| #include "SWGInstanceChannelsResponse.h" | #include "SWGInstanceChannelsResponse.h" | ||||||
|  | #include "SWGAudioDevices.h" | ||||||
|  | #include "SWGAudioDevicesSelect.h" | ||||||
| #include "SWGErrorResponse.h" | #include "SWGErrorResponse.h" | ||||||
| 
 | 
 | ||||||
| WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) : | WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) : | ||||||
| @ -185,6 +187,33 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http | |||||||
|                 response.write("Invalid HTTP method"); |                 response.write("Invalid HTTP method"); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |         else if (path == WebAPIAdapterInterface::instanceAudioURL) | ||||||
|  |         { | ||||||
|  |             Swagger::SWGErrorResponse errorResponse; | ||||||
|  | 
 | ||||||
|  |             if (request.getMethod() == "GET") | ||||||
|  |             { | ||||||
|  |                 Swagger::SWGAudioDevices normalResponse; | ||||||
|  | 
 | ||||||
|  |                 int status = m_adapter->instanceAudioGet(normalResponse, errorResponse); | ||||||
|  |                 response.setStatus(status); | ||||||
|  | 
 | ||||||
|  |                 if (status == 200) { | ||||||
|  |                     response.write(normalResponse.asJson().toUtf8()); | ||||||
|  |                 } else { | ||||||
|  |                     response.write(errorResponse.asJson().toUtf8()); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             else if (request.getMethod() == "PATCH") | ||||||
|  |             { | ||||||
|  |                 Swagger::SWGAudioDevicesSelect normalResponse; | ||||||
|  |             } | ||||||
|  |             else | ||||||
|  |             { | ||||||
|  |                 response.setStatus(405,"Invalid HTTP method"); | ||||||
|  |                 response.write("Invalid HTTP method"); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
| //            QDirIterator it(":", QDirIterator::Subdirectories);
 | //            QDirIterator it(":", QDirIterator::Subdirectories);
 | ||||||
|  | |||||||
| @ -36,6 +36,7 @@ | |||||||
| #include "SWGInstanceDevicesResponse.h" | #include "SWGInstanceDevicesResponse.h" | ||||||
| #include "SWGInstanceChannelsResponse.h" | #include "SWGInstanceChannelsResponse.h" | ||||||
| #include "SWGDeviceListItem.h" | #include "SWGDeviceListItem.h" | ||||||
|  | #include "SWGAudioDevices.h" | ||||||
| #include "SWGErrorResponse.h" | #include "SWGErrorResponse.h" | ||||||
| 
 | 
 | ||||||
| #include "webapiadaptergui.h" | #include "webapiadaptergui.h" | ||||||
| @ -249,6 +250,38 @@ int WebAPIAdapterGUI::instanceLoggingPut( | |||||||
|     return 200; |     return 200; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | int WebAPIAdapterGUI::instanceAudioGet( | ||||||
|  |             Swagger::SWGAudioDevices& response, | ||||||
|  |             Swagger::SWGErrorResponse& error __attribute__((unused))) | ||||||
|  | { | ||||||
|  |     const QList<QAudioDeviceInfo>& audioInputDevices = m_mainWindow.m_audioDeviceInfo.getInputDevices(); | ||||||
|  |     const QList<QAudioDeviceInfo>& audioOutputDevices = m_mainWindow.m_audioDeviceInfo.getOutputDevices(); | ||||||
|  |     int nbInputDevices = audioInputDevices.size(); | ||||||
|  |     int nbOutputDevices = audioOutputDevices.size(); | ||||||
|  | 
 | ||||||
|  |     response.init(); | ||||||
|  |     response.setNbInputDevices(nbInputDevices); | ||||||
|  |     response.setInputDeviceSelectedIndex(m_mainWindow.m_audioDeviceInfo.getInputDeviceIndex()); | ||||||
|  |     response.setNbOutputDevices(nbOutputDevices); | ||||||
|  |     response.setOutputDeviceSelectedIndex(m_mainWindow.m_audioDeviceInfo.getOutputDeviceIndex()); | ||||||
|  |     QList<QString*> *inputDeviceNames = response.getInputDevices(); | ||||||
|  |     QList<QString*> *outputDeviceNames = response.getOutputDevices(); | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < nbInputDevices; i++) | ||||||
|  |     { | ||||||
|  |         inputDeviceNames->append(new QString()); | ||||||
|  |         *inputDeviceNames->back() = audioInputDevices[i].deviceName(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     for (int i = 0; i < nbOutputDevices; i++) | ||||||
|  |     { | ||||||
|  |         outputDeviceNames->append(new QString()); | ||||||
|  |         *outputDeviceNames->back() = audioOutputDevices[i].deviceName(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return 200; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| QtMsgType WebAPIAdapterGUI::getMsgTypeFromString(const QString& msgTypeString) | QtMsgType WebAPIAdapterGUI::getMsgTypeFromString(const QString& msgTypeString) | ||||||
| { | { | ||||||
|     if (msgTypeString == "debug") { |     if (msgTypeString == "debug") { | ||||||
|  | |||||||
| @ -53,6 +53,10 @@ public: | |||||||
|             Swagger::SWGLoggingInfo& response, |             Swagger::SWGLoggingInfo& response, | ||||||
|             Swagger::SWGErrorResponse& error); |             Swagger::SWGErrorResponse& error); | ||||||
| 
 | 
 | ||||||
|  |     virtual int instanceAudioGet( | ||||||
|  |             Swagger::SWGAudioDevices& response, | ||||||
|  |             Swagger::SWGErrorResponse& error); | ||||||
|  | 
 | ||||||
| private: | private: | ||||||
|     MainWindow& m_mainWindow; |     MainWindow& m_mainWindow; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -634,11 +634,16 @@ definitions: | |||||||
|     description: "List of audio devices available in the system" |     description: "List of audio devices available in the system" | ||||||
|     required: |     required: | ||||||
|       - nbInputDevices |       - nbInputDevices | ||||||
|  |       - inputDeviceSelectedIndex | ||||||
|       - nbOutputDevices |       - nbOutputDevices | ||||||
|  |       - outputDeviceSelectedIndex | ||||||
|     properties: |     properties: | ||||||
|       nbInputDevices: |       nbInputDevices: | ||||||
|         description: "Number of input audio devices" |         description: "Number of input audio devices" | ||||||
|         type: integer |         type: integer | ||||||
|  |       inputDeviceSelectedIndex: | ||||||
|  |         description: "Index of selected input audio devices (-1 if default)" | ||||||
|  |         type: integer | ||||||
|       inputDevices: |       inputDevices: | ||||||
|         description: "Names of input devices" |         description: "Names of input devices" | ||||||
|         type: array |         type: array | ||||||
| @ -647,6 +652,9 @@ definitions: | |||||||
|       nbOutputDevices: |       nbOutputDevices: | ||||||
|         description: "Number of output audio devices" |         description: "Number of output audio devices" | ||||||
|         type: integer |         type: integer | ||||||
|  |       outputDeviceSelectedIndex: | ||||||
|  |         description: "Index of selected output audio devices (-1 if default)" | ||||||
|  |         type: integer | ||||||
|       outputDevices: |       outputDevices: | ||||||
|         description: "Names of output devices" |         description: "Names of output devices" | ||||||
|         type: array |         type: array | ||||||
| @ -656,11 +664,11 @@ definitions: | |||||||
|     description: "Audio devices selected" |     description: "Audio devices selected" | ||||||
|     properties: |     properties: | ||||||
|       input: |       input: | ||||||
|         description: "Name of the audio input device" |         description: "Index of the audio input device (-1 for default)" | ||||||
|         type: string |         type: integer | ||||||
|       output: |       output: | ||||||
|         description: "Name of the audio output device" |         description: "Index of the audio output device (-1 for default)" | ||||||
|         type: string |         type: integer | ||||||
|   LocationInformation: |   LocationInformation: | ||||||
|     description: "Instance geolocation information" |     description: "Instance geolocation information" | ||||||
|     required: |     required: | ||||||
|  | |||||||
| @ -696,12 +696,16 @@ margin-bottom: 20px; | |||||||
|     // Script section to load models into a JS Var |     // Script section to load models into a JS Var | ||||||
|     var defs = {} |     var defs = {} | ||||||
|             defs.AudioDevices = { |             defs.AudioDevices = { | ||||||
|   "required" : [ "nbInputDevices", "nbOutputDevices" ], |   "required" : [ "inputDeviceSelectedIndex", "nbInputDevices", "nbOutputDevices", "outputDeviceSelectedIndex" ], | ||||||
|   "properties" : { |   "properties" : { | ||||||
|     "nbInputDevices" : { |     "nbInputDevices" : { | ||||||
|       "type" : "integer", |       "type" : "integer", | ||||||
|       "description" : "Number of input audio devices" |       "description" : "Number of input audio devices" | ||||||
|     }, |     }, | ||||||
|  |     "inputDeviceSelectedIndex" : { | ||||||
|  |       "type" : "integer", | ||||||
|  |       "description" : "Index of selected input audio devices (-1 if default)" | ||||||
|  |     }, | ||||||
|     "inputDevices" : { |     "inputDevices" : { | ||||||
|       "type" : "array", |       "type" : "array", | ||||||
|       "description" : "Names of input devices", |       "description" : "Names of input devices", | ||||||
| @ -713,6 +717,10 @@ margin-bottom: 20px; | |||||||
|       "type" : "integer", |       "type" : "integer", | ||||||
|       "description" : "Number of output audio devices" |       "description" : "Number of output audio devices" | ||||||
|     }, |     }, | ||||||
|  |     "outputDeviceSelectedIndex" : { | ||||||
|  |       "type" : "integer", | ||||||
|  |       "description" : "Index of selected output audio devices (-1 if default)" | ||||||
|  |     }, | ||||||
|     "outputDevices" : { |     "outputDevices" : { | ||||||
|       "type" : "array", |       "type" : "array", | ||||||
|       "description" : "Names of output devices", |       "description" : "Names of output devices", | ||||||
| @ -726,12 +734,12 @@ margin-bottom: 20px; | |||||||
|             defs.AudioDevicesSelect = { |             defs.AudioDevicesSelect = { | ||||||
|   "properties" : { |   "properties" : { | ||||||
|     "input" : { |     "input" : { | ||||||
|       "type" : "string", |       "type" : "integer", | ||||||
|       "description" : "Name of the audio input device" |       "description" : "Index of the audio input device (-1 for default)" | ||||||
|     }, |     }, | ||||||
|     "output" : { |     "output" : { | ||||||
|       "type" : "string", |       "type" : "integer", | ||||||
|       "description" : "Name of the audio output device" |       "description" : "Index of the audio output device (-1 for default)" | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   "description" : "Audio devices selected" |   "description" : "Audio devices selected" | ||||||
| @ -7356,7 +7364,7 @@ except ApiException as e: | |||||||
|           </div> |           </div> | ||||||
|           <div id="generator"> |           <div id="generator"> | ||||||
|             <div class="content"> |             <div class="content"> | ||||||
|               Generated 2017-11-24T00:55:01.257+01:00 |               Generated 2017-11-24T08:42:52.359+01:00 | ||||||
|             </div> |             </div> | ||||||
|           </div> |           </div> | ||||||
|       </div> |       </div> | ||||||
|  | |||||||
| @ -38,8 +38,10 @@ SWGAudioDevices::~SWGAudioDevices() { | |||||||
| void | void | ||||||
| SWGAudioDevices::init() { | SWGAudioDevices::init() { | ||||||
|     nb_input_devices = 0; |     nb_input_devices = 0; | ||||||
|  |     input_device_selected_index = 0; | ||||||
|     input_devices = new QList<QString*>(); |     input_devices = new QList<QString*>(); | ||||||
|     nb_output_devices = 0; |     nb_output_devices = 0; | ||||||
|  |     output_device_selected_index = 0; | ||||||
|     output_devices = new QList<QString*>(); |     output_devices = new QList<QString*>(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -47,6 +49,7 @@ void | |||||||
| SWGAudioDevices::cleanup() { | SWGAudioDevices::cleanup() { | ||||||
|      |      | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     if(input_devices != nullptr) { |     if(input_devices != nullptr) { | ||||||
|         QList<QString*>* arr = input_devices; |         QList<QString*>* arr = input_devices; | ||||||
|         foreach(QString* o, *arr) { |         foreach(QString* o, *arr) { | ||||||
| @ -56,6 +59,7 @@ SWGAudioDevices::cleanup() { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     if(output_devices != nullptr) { |     if(output_devices != nullptr) { | ||||||
|         QList<QString*>* arr = output_devices; |         QList<QString*>* arr = output_devices; | ||||||
|         foreach(QString* o, *arr) { |         foreach(QString* o, *arr) { | ||||||
| @ -77,10 +81,12 @@ SWGAudioDevices::fromJson(QString &json) { | |||||||
| void | void | ||||||
| SWGAudioDevices::fromJsonObject(QJsonObject &pJson) { | SWGAudioDevices::fromJsonObject(QJsonObject &pJson) { | ||||||
|     ::Swagger::setValue(&nb_input_devices, pJson["nbInputDevices"], "qint32", ""); |     ::Swagger::setValue(&nb_input_devices, pJson["nbInputDevices"], "qint32", ""); | ||||||
|  |     ::Swagger::setValue(&input_device_selected_index, pJson["inputDeviceSelectedIndex"], "qint32", ""); | ||||||
|      |      | ||||||
|     ::Swagger::setValue(&input_devices, pJson["inputDevices"], "QList", "QString"); |     ::Swagger::setValue(&input_devices, pJson["inputDevices"], "QList", "QString"); | ||||||
|      |      | ||||||
|     ::Swagger::setValue(&nb_output_devices, pJson["nbOutputDevices"], "qint32", ""); |     ::Swagger::setValue(&nb_output_devices, pJson["nbOutputDevices"], "qint32", ""); | ||||||
|  |     ::Swagger::setValue(&output_device_selected_index, pJson["outputDeviceSelectedIndex"], "qint32", ""); | ||||||
|      |      | ||||||
|     ::Swagger::setValue(&output_devices, pJson["outputDevices"], "QList", "QString"); |     ::Swagger::setValue(&output_devices, pJson["outputDevices"], "QList", "QString"); | ||||||
|      |      | ||||||
| @ -102,12 +108,16 @@ SWGAudioDevices::asJsonObject() { | |||||||
|      |      | ||||||
|     obj->insert("nbInputDevices", QJsonValue(nb_input_devices)); |     obj->insert("nbInputDevices", QJsonValue(nb_input_devices)); | ||||||
| 
 | 
 | ||||||
|  |     obj->insert("inputDeviceSelectedIndex", QJsonValue(input_device_selected_index)); | ||||||
|  | 
 | ||||||
|     QJsonArray input_devicesJsonArray; |     QJsonArray input_devicesJsonArray; | ||||||
|     toJsonArray((QList<void*>*)input_devices, &input_devicesJsonArray, "input_devices", "QString"); |     toJsonArray((QList<void*>*)input_devices, &input_devicesJsonArray, "input_devices", "QString"); | ||||||
|     obj->insert("inputDevices", input_devicesJsonArray); |     obj->insert("inputDevices", input_devicesJsonArray); | ||||||
| 
 | 
 | ||||||
|     obj->insert("nbOutputDevices", QJsonValue(nb_output_devices)); |     obj->insert("nbOutputDevices", QJsonValue(nb_output_devices)); | ||||||
| 
 | 
 | ||||||
|  |     obj->insert("outputDeviceSelectedIndex", QJsonValue(output_device_selected_index)); | ||||||
|  | 
 | ||||||
|     QJsonArray output_devicesJsonArray; |     QJsonArray output_devicesJsonArray; | ||||||
|     toJsonArray((QList<void*>*)output_devices, &output_devicesJsonArray, "output_devices", "QString"); |     toJsonArray((QList<void*>*)output_devices, &output_devicesJsonArray, "output_devices", "QString"); | ||||||
|     obj->insert("outputDevices", output_devicesJsonArray); |     obj->insert("outputDevices", output_devicesJsonArray); | ||||||
| @ -124,6 +134,15 @@ SWGAudioDevices::setNbInputDevices(qint32 nb_input_devices) { | |||||||
|     this->nb_input_devices = nb_input_devices; |     this->nb_input_devices = nb_input_devices; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | qint32 | ||||||
|  | SWGAudioDevices::getInputDeviceSelectedIndex() { | ||||||
|  |     return input_device_selected_index; | ||||||
|  | } | ||||||
|  | void | ||||||
|  | SWGAudioDevices::setInputDeviceSelectedIndex(qint32 input_device_selected_index) { | ||||||
|  |     this->input_device_selected_index = input_device_selected_index; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| QList<QString*>* | QList<QString*>* | ||||||
| SWGAudioDevices::getInputDevices() { | SWGAudioDevices::getInputDevices() { | ||||||
|     return input_devices; |     return input_devices; | ||||||
| @ -142,6 +161,15 @@ SWGAudioDevices::setNbOutputDevices(qint32 nb_output_devices) { | |||||||
|     this->nb_output_devices = nb_output_devices; |     this->nb_output_devices = nb_output_devices; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | qint32 | ||||||
|  | SWGAudioDevices::getOutputDeviceSelectedIndex() { | ||||||
|  |     return output_device_selected_index; | ||||||
|  | } | ||||||
|  | void | ||||||
|  | SWGAudioDevices::setOutputDeviceSelectedIndex(qint32 output_device_selected_index) { | ||||||
|  |     this->output_device_selected_index = output_device_selected_index; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| QList<QString*>* | QList<QString*>* | ||||||
| SWGAudioDevices::getOutputDevices() { | SWGAudioDevices::getOutputDevices() { | ||||||
|     return output_devices; |     return output_devices; | ||||||
|  | |||||||
| @ -46,20 +46,28 @@ public: | |||||||
|     qint32 getNbInputDevices(); |     qint32 getNbInputDevices(); | ||||||
|     void setNbInputDevices(qint32 nb_input_devices); |     void setNbInputDevices(qint32 nb_input_devices); | ||||||
| 
 | 
 | ||||||
|  |     qint32 getInputDeviceSelectedIndex(); | ||||||
|  |     void setInputDeviceSelectedIndex(qint32 input_device_selected_index); | ||||||
|  | 
 | ||||||
|     QList<QString*>* getInputDevices(); |     QList<QString*>* getInputDevices(); | ||||||
|     void setInputDevices(QList<QString*>* input_devices); |     void setInputDevices(QList<QString*>* input_devices); | ||||||
| 
 | 
 | ||||||
|     qint32 getNbOutputDevices(); |     qint32 getNbOutputDevices(); | ||||||
|     void setNbOutputDevices(qint32 nb_output_devices); |     void setNbOutputDevices(qint32 nb_output_devices); | ||||||
| 
 | 
 | ||||||
|  |     qint32 getOutputDeviceSelectedIndex(); | ||||||
|  |     void setOutputDeviceSelectedIndex(qint32 output_device_selected_index); | ||||||
|  | 
 | ||||||
|     QList<QString*>* getOutputDevices(); |     QList<QString*>* getOutputDevices(); | ||||||
|     void setOutputDevices(QList<QString*>* output_devices); |     void setOutputDevices(QList<QString*>* output_devices); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     qint32 nb_input_devices; |     qint32 nb_input_devices; | ||||||
|  |     qint32 input_device_selected_index; | ||||||
|     QList<QString*>* input_devices; |     QList<QString*>* input_devices; | ||||||
|     qint32 nb_output_devices; |     qint32 nb_output_devices; | ||||||
|  |     qint32 output_device_selected_index; | ||||||
|     QList<QString*>* output_devices; |     QList<QString*>* output_devices; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -37,20 +37,14 @@ SWGAudioDevicesSelect::~SWGAudioDevicesSelect() { | |||||||
| 
 | 
 | ||||||
| void | void | ||||||
| SWGAudioDevicesSelect::init() { | SWGAudioDevicesSelect::init() { | ||||||
|     input = new QString(""); |     input = 0; | ||||||
|     output = new QString(""); |     output = 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| SWGAudioDevicesSelect::cleanup() { | SWGAudioDevicesSelect::cleanup() { | ||||||
|      |      | ||||||
|     if(input != nullptr) { |  | ||||||
|         delete input; |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     if(output != nullptr) { |  | ||||||
|         delete output; |  | ||||||
|     } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| SWGAudioDevicesSelect* | SWGAudioDevicesSelect* | ||||||
| @ -64,8 +58,8 @@ SWGAudioDevicesSelect::fromJson(QString &json) { | |||||||
| 
 | 
 | ||||||
| void | void | ||||||
| SWGAudioDevicesSelect::fromJsonObject(QJsonObject &pJson) { | SWGAudioDevicesSelect::fromJsonObject(QJsonObject &pJson) { | ||||||
|     ::Swagger::setValue(&input, pJson["input"], "QString", "QString"); |     ::Swagger::setValue(&input, pJson["input"], "qint32", ""); | ||||||
|     ::Swagger::setValue(&output, pJson["output"], "QString", "QString"); |     ::Swagger::setValue(&output, pJson["output"], "qint32", ""); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| QString | QString | ||||||
| @ -82,28 +76,28 @@ QJsonObject* | |||||||
| SWGAudioDevicesSelect::asJsonObject() { | SWGAudioDevicesSelect::asJsonObject() { | ||||||
|     QJsonObject* obj = new QJsonObject(); |     QJsonObject* obj = new QJsonObject(); | ||||||
|      |      | ||||||
|     toJsonValue(QString("input"), input, obj, QString("QString")); |     obj->insert("input", QJsonValue(input)); | ||||||
| 
 | 
 | ||||||
|     toJsonValue(QString("output"), output, obj, QString("QString")); |     obj->insert("output", QJsonValue(output)); | ||||||
| 
 | 
 | ||||||
|     return obj; |     return obj; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| QString* | qint32 | ||||||
| SWGAudioDevicesSelect::getInput() { | SWGAudioDevicesSelect::getInput() { | ||||||
|     return input; |     return input; | ||||||
| } | } | ||||||
| void | void | ||||||
| SWGAudioDevicesSelect::setInput(QString* input) { | SWGAudioDevicesSelect::setInput(qint32 input) { | ||||||
|     this->input = input; |     this->input = input; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| QString* | qint32 | ||||||
| SWGAudioDevicesSelect::getOutput() { | SWGAudioDevicesSelect::getOutput() { | ||||||
|     return output; |     return output; | ||||||
| } | } | ||||||
| void | void | ||||||
| SWGAudioDevicesSelect::setOutput(QString* output) { | SWGAudioDevicesSelect::setOutput(qint32 output) { | ||||||
|     this->output = output; |     this->output = output; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -22,7 +22,6 @@ | |||||||
| #include <QJsonObject> | #include <QJsonObject> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| #include <QString> |  | ||||||
| 
 | 
 | ||||||
| #include "SWGObject.h" | #include "SWGObject.h" | ||||||
| 
 | 
 | ||||||
| @ -42,16 +41,16 @@ public: | |||||||
|     void fromJsonObject(QJsonObject &json); |     void fromJsonObject(QJsonObject &json); | ||||||
|     SWGAudioDevicesSelect* fromJson(QString &jsonString); |     SWGAudioDevicesSelect* fromJson(QString &jsonString); | ||||||
| 
 | 
 | ||||||
|     QString* getInput(); |     qint32 getInput(); | ||||||
|     void setInput(QString* input); |     void setInput(qint32 input); | ||||||
| 
 | 
 | ||||||
|     QString* getOutput(); |     qint32 getOutput(); | ||||||
|     void setOutput(QString* output); |     void setOutput(qint32 output); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     QString* input; |     qint32 input; | ||||||
|     QString* output; |     qint32 output; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user