11b464e99SMatthias Ringwald /* 21b464e99SMatthias Ringwald * Copyright (C) 2019 BlueKitchen GmbH 31b464e99SMatthias Ringwald * 41b464e99SMatthias Ringwald * Redistribution and use in source and binary forms, with or without 51b464e99SMatthias Ringwald * modification, are permitted provided that the following conditions 61b464e99SMatthias Ringwald * are met: 71b464e99SMatthias Ringwald * 81b464e99SMatthias Ringwald * 1. Redistributions of source code must retain the above copyright 91b464e99SMatthias Ringwald * notice, this list of conditions and the following disclaimer. 101b464e99SMatthias Ringwald * 2. Redistributions in binary form must reproduce the above copyright 111b464e99SMatthias Ringwald * notice, this list of conditions and the following disclaimer in the 121b464e99SMatthias Ringwald * documentation and/or other materials provided with the distribution. 131b464e99SMatthias Ringwald * 3. Neither the name of the copyright holders nor the names of 141b464e99SMatthias Ringwald * contributors may be used to endorse or promote products derived 151b464e99SMatthias Ringwald * from this software without specific prior written permission. 161b464e99SMatthias Ringwald * 4. Any redistribution, use, or modification is done solely for 171b464e99SMatthias Ringwald * personal benefit and not for any commercial purpose or for 181b464e99SMatthias Ringwald * monetary gain. 191b464e99SMatthias Ringwald * 201b464e99SMatthias Ringwald * THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS 211b464e99SMatthias Ringwald * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 221b464e99SMatthias Ringwald * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 231b464e99SMatthias Ringwald * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS 241b464e99SMatthias Ringwald * RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 251b464e99SMatthias Ringwald * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 261b464e99SMatthias Ringwald * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 271b464e99SMatthias Ringwald * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 281b464e99SMatthias Ringwald * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 291b464e99SMatthias Ringwald * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 301b464e99SMatthias Ringwald * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311b464e99SMatthias Ringwald * SUCH DAMAGE. 321b464e99SMatthias Ringwald * 331b464e99SMatthias Ringwald * Please inquire about commercial licensing options at 341b464e99SMatthias Ringwald * [email protected] 351b464e99SMatthias Ringwald * 361b464e99SMatthias Ringwald */ 371b464e99SMatthias Ringwald 381b464e99SMatthias Ringwald /* 391b464e99SMatthias Ringwald * btstack_run_loop_qt.h 401b464e99SMatthias Ringwald * Functionality special to the Qt event loop 411b464e99SMatthias Ringwald */ 421b464e99SMatthias Ringwald 431b464e99SMatthias Ringwald #ifndef btstack_run_loop_QT_H 441b464e99SMatthias Ringwald #define btstack_run_loop_QT_H 451b464e99SMatthias Ringwald 461b464e99SMatthias Ringwald #include "btstack_run_loop.h" 471b464e99SMatthias Ringwald 481b464e99SMatthias Ringwald // BTstack Run Loop Object for Qt integration 491b464e99SMatthias Ringwald #if defined __cplusplus 501b464e99SMatthias Ringwald #include <QObject> 511b464e99SMatthias Ringwald #include <QTimer> 529988cd6fSMatthias Ringwald #ifdef Q_OS_WIN 539988cd6fSMatthias Ringwald #include <windows.h> 549988cd6fSMatthias Ringwald #include <QWinEventNotifier> 55*84ede529SMatthias Ringwald #else 56*84ede529SMatthias Ringwald #include <QSocketNotifier> 579988cd6fSMatthias Ringwald #endif 581b464e99SMatthias Ringwald class BTstackRunLoopQt : public QObject { 591b464e99SMatthias Ringwald Q_OBJECT 601b464e99SMatthias Ringwald public slots: 611b464e99SMatthias Ringwald void processTimers(void); 629988cd6fSMatthias Ringwald #ifdef Q_OS_WIN 639988cd6fSMatthias Ringwald void processDataSource(HANDLE handle); 64*84ede529SMatthias Ringwald #else 65*84ede529SMatthias Ringwald void processDataSourceRead(int fd); 66*84ede529SMatthias Ringwald void processDataSourceWrite(int fd); 679988cd6fSMatthias Ringwald #endif 681b464e99SMatthias Ringwald }; 691b464e99SMatthias Ringwald #endif 701b464e99SMatthias Ringwald 711b464e99SMatthias Ringwald #if defined __cplusplus 721b464e99SMatthias Ringwald extern "C" { 731b464e99SMatthias Ringwald #endif 741b464e99SMatthias Ringwald 751b464e99SMatthias Ringwald /** 761b464e99SMatthias Ringwald * Provide btstack_run_loop_qt instance 771b464e99SMatthias Ringwald */ 781b464e99SMatthias Ringwald const btstack_run_loop_t * btstack_run_loop_qt_get_instance(void); 791b464e99SMatthias Ringwald 801b464e99SMatthias Ringwald /* API_END */ 811b464e99SMatthias Ringwald 821b464e99SMatthias Ringwald #if defined __cplusplus 831b464e99SMatthias Ringwald } 841b464e99SMatthias Ringwald #endif 851b464e99SMatthias Ringwald 861b464e99SMatthias Ringwald #endif // btstack_run_loop_QT_H 87