标签: interruption

在linux中设置串口中断

我试图在ubuntu中设置串口的中断(在用C编写的程序中),但它不起作用.我已经检查过串口通讯是否正常运行而没有中断,所以我可能会设置错误.代码如下:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <unistd.h>
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <fcntl.h>
    #include <sys/signal.h>
    #include <errno.h>
    #include <termios.h>

    void signal_handler_IO (int status);   /* definition of signal handler */

    int n;
    int fd;
    int connected;
    struct termios termAttr;
    struct sigaction saio;

    int main(int argc, char *argv[])
    {
         fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
         if (fd == -1)
         {
            perror("open_port: Unable to open /dev/ttyO1\n");
            exit(1);
         }

         saio.sa_handler = signal_handler_IO;
         saio.sa_flags = 0;
         saio.sa_restorer = NULL; …
Run Code Online (Sandbox Code Playgroud)

c ubuntu serial-port interrupt interruption

7
推荐指数
2
解决办法
2万
查看次数

如何捕获UIScrollView或其他的cancallation?

有时,会发生电话等中断,并会干扰iPhone或iPad中应用的常规行为.

例如,我创建了一个UIScrollView实例并实现了UIScrollView委托方法:scrollViewWillBeginDragging和scrollViewDidEndDragging(以及scrollViewDidEndDecelerating).

scrollViewWillBeginDragging方法停用了我的应用程序中的所有自定义按钮.然后scrollViewDidEndDragging和scrollViewDidEndDecelerating方法激活这些自定义按钮.也就是说,当用户滚动时,所有自定义按钮都会暂停一段时间.

问题是,当用户开始拖动并且只是持有UIScrollView实例时,如果我通过按下主页按钮和电源按钮来截取屏幕截图,则不会调用scrollViewDidEndDragging和scrollViewDidEndDecelerating中的任何一个.所以应用程序搞砸了.

我在我的UIViewController中实现了一个UIApplicationWillResignActiveNotification方法,但在截取屏幕后没有调用它.

我如何能够捕获任何扰乱常规事件的中断?

有时,由于中断,touchesEnd和touchesCanceled也没有被调用.

谢谢.

iphone events ipad interruption ios

5
推荐指数
1
解决办法
428
查看次数

如何获得AVPlayer的中断开始/结束事件

我正在播放音频文件AVPlayer.我实施了AVAudioSessionInterruptionNotification.

    AVAudioSession *session = [AVAudioSession sharedInstance];
    NSError *errorInAudio   = nil;
    [session setActive:YES error:&errorInAudio];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(interruption:) name:AVAudioSessionInterruptionNotification object:nil];

    [session setCategory:AVAudioSessionCategoryPlayback error:nil];
Run Code Online (Sandbox Code Playgroud)

当应用程序处于前台(如语音控制)时出现中断时,它可以正常工作.
但我在后台模式下制作应用程序并打开iPod播放器并开始播放.它的中断当时没有被调用,即使我的应用程序进入前台也是如此.
可能是什么问题.请帮忙.

iphone interruption avaudiosession avplayer

5
推荐指数
1
解决办法
4469
查看次数

AudioUnitInitialize 失败,错误代码为 1701737535 'ent?' 报警中断后

我正在使用 VOIP 应用程序。该应用程序与 CallKit 一起运行良好。

如果警报在通话中触发,我将面临问题。每次当警报停止触发(音频中断结束)时,我们都会尝试在 AVAudioSession 上 setActive: 。但它总是给出代码 1701737535 的错误,即。“ent?”。

当我尝试初始化音频单元时,会发生同样的错误。不使用 CallKit 它工作正常。

任何人都遇到过在音频中断结束时激活音频会话的问题。

我在同一场景中收到不同的错误“!pri”561017449,但这次由于本机电话应用程序而发生中断。

问题是 100% 可复制的。尝试了许多点击和跟踪,例如线程、延迟或调用 setActive:YES 而不调用 setActive:YES。但没有运气。

总结在这里:

  1. 收到错误 1701737535 即。“恩特?” 如果由于警报而中断。

  2. 收到错误 561017449 即。'!pri' 如果由于本机调用而中断

仅当将 CallKit 与 VIOP 结合使用时才进行复制。

任何人都帮忙。

voip interruption ios avaudiosession callkit

5
推荐指数
1
解决办法
2559
查看次数

AVAudioSessionInterruption的AudioKit处理

接到电话或刚打完电话后,启用了后台播放的AudioKit应用程序将永久静音,我不确定如何处理。重新启动声音输出的唯一方法是杀死并重新启动应用程序。其他中断(例如启用和使用Siri)可以毫无障碍地进行,并且在活动期间,应用的声音会回落。

通常,一个应用可以注册自己以接收通知(例如NSNotification.Name.AVAudioSessionInterruption)来检测AVAudioSession中断,但是一个人如何检索AVSession通常传递到通知中的对象?

NotificationCenter.default.addObserver(self, selector: #selector(AppDelegate.sessionInterrupted(_:)),
                                               name: NSNotification.Name.AVAudioSessionInterruption,
                                               object: MISSING_AK_AVAUDIOSESSION_REF)
Run Code Online (Sandbox Code Playgroud)

此外,如果能够成功实现音频中断通知,那么AudioKit会发生什么?它不被设计为“重新启动”或被搁置。任何帮助将非常感激。

iphone interruption ios avaudiosession audiokit

5
推荐指数
1
解决办法
325
查看次数

捕获设备处于活动状态时,AVAudioSessionInterruptionNotification未触发

我在iOS 7.0.4上遇到" AVAudioSessionInterruptionNotification " 问题.
我在NSNotificationCenter上注册,然后激活AVAudioSession.一切正常,但如果激活相机,则不再触发该特定通知,无论是中断开始还是结束.
我通过在iPhone4上接收手机通话来测试音频中断,并在应用程序运行时发出警报响铃.我也尝试使用"AVCam"示例应用程序的通知,我有同样的问题.
音频中断和相机激活之间有什么关系?如果开启相机,为什么会停止触发音频中断?这可能是iOS错误吗?

编辑2014年1月10日:我更新到iOS 7.1 beta 3,问题仍然存在.

谢谢.

audio interruption avcapturedevice avaudiosession ios7

4
推荐指数
1
解决办法
1798
查看次数

如何在Swift中断后恢复音频?

我在这里遵循指示,我已经把这个测试项目放在一起来处理音频播放的中断.具体来说,我正在使用默认iphone时钟应用程序中的警报作为中断.似乎中断处理程序被调用但没有越过该let = interruptionType行,因为" 错误类型 "出现两次.

import UIKit
import AVFoundation

class ViewController: UIViewController {

    var player = AVAudioPlayer()

    let audioPath = NSBundle.mainBundle().pathForResource("rachmaninov-romance-sixhands-alianello", ofType: "mp3")!

    func handleInterruption(notification: NSNotification) {

        guard let interruptionType = notification.userInfo?[AVAudioSessionInterruptionTypeKey] as? AVAudioSessionInterruptionType else { print("wrong type"); return }

        switch interruptionType {

        case .Began:
            print("began")
            // player is paused and session is inactive. need to update UI)
            player.pause()
            print("audio paused")

        default:
            print("ended")
            /**/
            if let option = notification.userInfo?[AVAudioSessionInterruptionOptionKey] as? AVAudioSessionInterruptionOptions where option == .ShouldResume { …
Run Code Online (Sandbox Code Playgroud)

audio resume interruption swift

4
推荐指数
2
解决办法
6752
查看次数

应用AVPlayer播放后播放mp4中断iPod音乐

我的应用程序使用AVPlayer播放mp4,当我的应用程序完成启动时,它会中断iPod音乐,虽然我已将音频会话设置为允许与其他人混音

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    AudioSessionInitialize(NULL, NULL, NULL, NULL);
    AudioSessionSetActive(true);
    UInt32 sessionCategory = kAudioSessionCategory_AmbientSound;
    AudioSessionSetProperty(kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory);
    UInt32 allowMixWithOthers = true;
    AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof(allowMixWithOthers), &allowMixWithOthers);
Run Code Online (Sandbox Code Playgroud)

视图控制器出现后,我重新启动iPod音乐,它可以正常使用我的应用程序而不会中断,我的应用程序将不再打断音乐.

有谁知道问题是否可以解决?我也查了一下myapp-info.plist,找不到属性以防止打断iPod.

所有AudioSession方法都不会返回任何错误.

这是iPhoneConfigureUtility中的日志:

Aug 20 10:55:54 nova-teki-iPhone audiotest[3510] <Warning>: AudioSessionInitialize status = 0
Aug 20 10:55:55 nova-teki-iPhone kernel[0] <Debug>: ALS: kIOHIDDisplayBrightnessSliderPositionKey=69% (0xb226)
Aug 20 10:55:55 nova-teki-iPhone audiotest[3510] <Warning>: AudioSessionSetActive status = 0
Aug 20 10:55:55 nova-teki-iPhone audiotest[3510] <Warning>: kAudioSessionProperty_AudioCategory status = 0
Aug 20 10:55:55 nova-teki-iPhone audiotest[3510] <Warning>: kAudioSessionProperty_OverrideCategoryMixWithOthers status = …
Run Code Online (Sandbox Code Playgroud)

audiosession interruption ios avplayer

3
推荐指数
2
解决办法
2013
查看次数

Mac OS 10.7 Lion下的Eclipse中断

我不久前升级到Mac OS 10.7 Lion,尽管Eclipse(Eclipse Java EE IDE for Web Developers,Version:Helios Service Release 2)工作正常,但两件事情变得非常缓慢:

  • 创建一个新项目过去需要几秒钟,现在需要大约1.5分钟.
  • 保存我的课程时,一切都会停止,旋转等待光标会出现约1分钟.在此期间,Activity监视器将Eclipse标记为"未响应".

我有最新的Eclipse更新.有谁知道可能导致这种行为的原因是什么?

谢谢,迈克

java eclipse interruption osx-lion

2
推荐指数
1
解决办法
1517
查看次数

为什么我必须在try/catch语句中包装每个Thread.sleep()调用?

我正在尝试用Java编写我的第一个多线程程序.我无法理解为什么我们需要围绕for循环进行此异常处理.当我在没有try/catch子句的情况下编译时,它会产生InterruptedException.(这是消息:

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
Unhandled exception type InterruptedException
Run Code Online (Sandbox Code Playgroud)

)

但是当使用try/catch运行时,catch块中的sysout永远不会显示 - 这意味着没有捕获到这样的异常!

public class SecondThread implements Runnable{
    Thread t;

    SecondThread(){
        t = new Thread(this, "Thread 2");
        t.start();
    }

    public void run(){
        try{
            for(int i=5 ; i>0 ; i--){
                System.out.println("thread 2: " + i);
                Thread.sleep(1000);
            }
        }
        catch(InterruptedException e){
            System.out.println("thread 2 interrupted");
        }
    }
}


public class MainThread{

    public static void main(String[] args){
        new SecondThread();

        try{
            for(int i=5 ; i>0 ; i--){
                System.out.println("main thread: …
Run Code Online (Sandbox Code Playgroud)

java interrupted-exception interruption

2
推荐指数
1
解决办法
9946
查看次数

USART接收中断stm32

我在地图上开发我正在研究STM32和USART中断.配置USART1并使能接收中断后.接收中断没有检测到的问题????

c stm32 interruption usart

1
推荐指数
1
解决办法
4万
查看次数

Firebase存储处理下载进行中的网络中断

我正在尝试从Firebase存储下载一些文件。互联网连接稳定后,它可以很好地工作。但是,如果在中途下载内容时互联网连接丢失,它只会继续尝试下载内容。如何检测是否没有正在下载的内容?

我已经实现了onProgessListener的StorageReference。但是,我不确定如何利用它来检测下载是否没有进度。

new OnProgressListener<FileDownloadTask.TaskSnapshot>() {
    @Override
    public void onProgress(FileDownloadTask.TaskSnapshot taskSnapshot) {
        //What to do with the taskSnapshot to detect if there are no progress in the download?
    }
};
Run Code Online (Sandbox Code Playgroud)

android download interruption firebase firebase-storage

1
推荐指数
1
解决办法
2754
查看次数