使用QSocketNotifier可以监听文件描述符的几种状态:
QSocketNotifier::Read 0 There is data to be read.
QSocketNotifier::Write 1 Data can be written.
QSocketNotifier::Exception 2 An exception has occurred. We recommend against using this.
在linux驱动中可以实现poll接口提供对应的监听read状态,这样可以实现qt接收linux驱动中的相关信号。
QFile使用handle()返回文件描述符填充QSocketNotifier第一个参数,QSocketNotifier发送activated(int socket)信号。
QSocketNotifier::Read 0 There is data to be read.
QSocketNotifier::Write 1 Data can be written.
QSocketNotifier::Exception 2 An exception has occurred. We recommend against using this.
在linux驱动中可以实现poll接口提供对应的监听read状态,这样可以实现qt接收linux驱动中的相关信号。
QFile使用handle()返回文件描述符填充QSocketNotifier第一个参数,QSocketNotifier发送activated(int socket)信号。