signal

How to declare New-Signal-Slot syntax in Qt 5 as a parameter to function

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I pass signal or slot (member-function, new syntax in Qt 5) as a parameter to function and then call connect ? e.g. I want to write a function that waits for a signal. Note : It is not compile - PointerToMemberFunction is my question. bool waitForSignal(const QObject* sender, PointerToMemberFunction??? signal, int timeOut = 5000/*ms*/) { if (sender == nullptr) return true; bool isTimeOut = false; QEventLoop loop; QTimer timer; timer.setSingleShot(true); QObject::connect(&timer, &QTimer::timeout, [&loop, &isTimeOut]() { loop.quit();

Music Recognition and Signal Processing

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to build something similar to Tunatic or Midomi (try them out if you're not sure what they do) and I'm wondering what algorithms I'd have to use; The idea I have about the workings of such applications is something like this: have a big database with several songs for each song in 1. reduce quality / bit-rate (to 64kbps for instance) and calculate the sound "hash" have the sound / excerpt of the music you want to identify for the song in 3. reduce quality / bit-rate (again to 64kbps) and calculate sound "hash" if 4. sound hash is in

Get signal strength of WIFI and Mobile Data

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: In my app I need to check the connection speed of both WiFi and Mobile Data and then compare it, then switch to which ever network has the highest speed. So how can I get the speed or best signal strength of wifi and mobile data? how can I switch one off and other on programatically. Please help me out. A sample would be helpful. 回答1: Wifi: WifiManager wifiManager = ( WifiManager ) context . getSystemService ( Context . WIFI_SERVICE ); int linkSpeed = wifiManager . getConnectionInfo (). getRssi (); In case of mobile it should work:

Simple Signals - C programming and alarm function

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: #include #include void ALARMhandler(int sig) { signal(SIGALRM, SIG_IGN); /* ignore this signal */ printf("Hello"); signal(SIGALRM, ALARMhandler); /* reinstall the handler */ } int main(int argc, char *argv[]) { alarm(2); /* set alarm clock */ while (1) ; printf("All done"); } I expect the program to print "hello" after 2 seconds, but instead the output is "zsh: alarm ./a.out" Any idea what is going on? 回答1: You're forgetting to set the alarm handler initially. Change the start of main() like: int main(int argc, char *argv[]) { signal(SIGALRM

How to convert Wifi signal strength from Quality (percent) to RSSI (dBm)?

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: How should I convert Wifi signal strength from a Quality in percentage, usually 0% to 100% into an RSSI value, usually a negative dBm number (i.e. -96db )? 回答1: Wifi Signal Strength Percentage to RSSI dBm Microsoft defines Wifi signal quality in their WLAN_ASSOCIATION_ATTRIBUTES structure as follows: wlanSignalQuality : A percentage value that represents the signal quality of the network. WLAN_SIGNAL_QUALITY is of type ULONG. This member contains a value between 0 and 100. A value of 0 implies an actual RSSI signal strength of -100

Catch native crash: signal 7 (SIGBUS), code 2 (BUS_ADRERR)

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: On my Google Play Console I've got some reports for an application (FYI, it also uses JNI). This is the backtrace: native: pc 00000000002c0536 /system/lib/libart.so (_ZN3artL16Unsafe_putDoubleEP7_JNIEnvP8_jobjectS3_xd+31) native: pc 0000000073bb9609 /data/dalvik-cache/arm/system@framework@boot.oat I am not able to catch it with any crash reporting system (Google Analytics, Crashlytics) and of course have no clue on how to reproduce it. Interestingly, the devices affected for most are the ones from Motorola Moto G series and mid-aged Samsung

Declare abstract signal in interface class

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How to declare a Qt signal in an abstract class / interface when the implementing class is already derrived from QObject/QWidget? class IEmitSomething { public: // this should be the signal known to others virtual void someThingHappened() = 0; } class ImplementEmitterOfSomething : public QWidget, public IEmitSomething { // signal implementation should be generated here signals: void someThingHappended(); } 回答1: As I found out in the last days... the Qt way of doing this is like this: class IEmitSomething { public: virtual ~IEmitSomething(){}

How To apply a filter to a signal in python

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: is there any prepared function in python to apply a filter (for example Butterworth filter) to a given signal? I looking for such a function in 'scipy.signal' but I haven't find any useful functions more than filter design ones. actually I want this function to convolve a filter with the signal. 回答1: Yes! There are two: scipy.signal.filtfilt scipy.signal.lfilter There are also methods for convolution ( convolve and fftconvolve ), but these are probably not appropriate for your application because it involves IIR filters. Full code sample: b,

Android Bitmap Fatal signal 11 (SIGSEGV)

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm developing and android app that take a picture and OCRed it. I'm getting this error sometime and sometime not without changing my code, THE ERROR : 01-08 20:41:59.940: A/libc(10967): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1) I have a method that crop the image to let the user highlight the text : private void performCrop(){ File file = new File(_path); Uri outputFileUri = Uri.fromFile(file); try{ //call the standard crop action intent (the user device may not support it) Intent cropIntent = new Intent("com.android.camera.action

ART prevents any Java calls from JNI during native signal handling

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My project use a module of capturing crash and send in android system. When handling the native crash, native code will do something and then do java calls from JNI. It works well on the Dalvik. But it fails in android version above 5.0 using ART. Because ART prevents any Java calls from JNI during native signal handling. It says that ART signal handling uses alternate signal stack, so during the process of signal handing, can't call java methods? Is there any other ways?? Flow: 1. Java call native method, but native method crashes. 2.