ifix如何通过事件调度实现声音报警

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ifix如何通过事件调度实现声音报警相关的知识,希望对你有一定的参考价值。

参考技术A 事件调度 添加你的报警标签~
脚本:
同步函数为:mciSendString
使用时首先要声明:Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA"
(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

用法:

Dim filename as String
Dim cmd As String
filename = "test.wav" cmd = "open " & filename & " type WAVEAudio alias MyWav" Call mciSendString(cmd, 0, 0, 0)
Call mciSendString("play MyWav", 0, 0, 0)

异步函数为:mciSendString
使用时首先要声明:Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
用法:

Dim filename as String
filename = "test.wav"
Call sndPlaySound(filename, SND_SYNC)
可以连续调用sndPlaySound来进行连续多个语音文件的播放。追问

你好,你这个我知道,我的意思是如果一个项目多个点呢!我们的要求是数字量通过高中低三种优先级实现,而模拟量则是通过高高、高、低和低低实现的,一个项目上千个点呢!这种情况该怎么通过事件调度对其实现啊!大侠!

追答

进群 聊吧~ 这里说话不方便~64599562

如何通过在 fb 上发布消息来实现调度事件

【中文标题】如何通过在 fb 上发布消息来实现调度事件【英文标题】:How implement scheduling event with post a message on fb 【发布时间】:2011-12-07 06:10:27 【问题描述】:

我正在创建一个应用程序,我在其中添加了一个用于在您的帐户上发布消息的工具。现在这个设施我正在添加一个用于调度的事件。在该用户的帮助下,可以编写消息并稍后或在特定日期和时间发布。为此,我使用了用户在给定日期生成的本地通知事件。但问题是,当通知生成时,我调用了一个用于在 Facebook 上发布消息的函数。为了生成通知,我使用了以下代码:

-(IBAction)save
    NSString *str1=[NSString stringWithFormat:@"%@",txt_date.text];
    NSString *str2=[NSString stringWithFormat:@" %@",txt_time.text];
    str1=[str1 stringByAppendingFormat:str2];
    selected_label.text= str1;
    [[UIApplication sharedApplication] cancelAllLocalNotifications];
    NSDate *today=[NSDate date]; 
    NSDateFormatter* formatter_current = [[[NSDateFormatter alloc] init] autorelease];
    formatter_current.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
    //Set the required date format 
    [formatter_current setDateFormat:@"yyyy-MM-dd hh:mm a"]; 

    NSLog(@"current date is =%@",str1); 
    today=[formatter_current dateFromString:str1];
    NSLog(@"current date:-%@",today); 
    UILocalNotification* ln = [[UILocalNotification alloc] init];
    ln.alertBody = @"Wake Up Sid";
    ln.applicationIconBadgeNumber = 1;
    ln.fireDate = today; //[NSDate dateWithTimeIntervalSinceNow:15];
    ln.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
    NSLog(@"alarm will activate on%@",today);
    NSDateFormatter* formatter_alarm = [[[NSDateFormatter alloc] init] autorelease];
    NSLocale *uslocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];
    [formatter_alarm setLocale:uslocale];
    [uslocale release]; 
    formatter_alarm.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
    [formatter_alarm setDateFormat:@"hh:mm a"]; 
    NSString *str=[formatter_alarm stringFromDate:today];
    NSLog(@"%@",str);
    ln.alertBody = [NSString stringWithFormat:@"Your first appointment at %@",str];
    ln.soundName = UILocalNotificationDefaultSoundName;
    ln.repeatInterval=NSDayCalendarUnit;
    [[UIApplication sharedApplication] scheduleLocalNotification:ln];
    [ln release];

在 appdelegate 文件中,我使用此函数接收通知并调用发布消息函数:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
// Override point for customization after application launch.

    self.viewController=[[demo_social_updatesViewController alloc]initWithNibName:@"demo_social_updatesViewController" bundle:nil];
    nav_controller=[[UINavigationController alloc] initWithRootViewController:self.viewController];
    // Add the view controller's view to the window and display.
    [self.window addSubview:nav_controller.view];
    [self.window makeKeyAndVisible];
    appDelegate_acess_token=[[NSUserDefaults standardUserDefaults] stringForKey:@"access_token"];
      application.applicationIconBadgeNumber = 0;
    // Handle launching from a notification
    UILocalNotification *localNotif =
    [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
    if (localNotif) 
        NSLog(@"Recieved Notification %@",localNotif);
    
    return YES;


- (void)applicationDidEnterBackground:(UIApplication *)application
    if (application.applicationIconBadgeNumber == 1) 
        BOOL tmp=[Global_Class_parsing post_comment_fb:appDelegate_acess_token uesr_comment:@"testing message111"];
        if(tmp)

            UIAlertView *av = [[[UIAlertView alloc] initWithTitle:@"Sucessfully posted to photos & wall!" 
                                                          message:@"Check out your Facebook to see!"
                                                         delegate:nil 
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles:nil] autorelease];
            [av show];

        
        else
            UIAlertView *av = [[[UIAlertView alloc] initWithTitle:@"error"message:@"Check connection!"
                                                         delegate:nil 
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles:nil] autorelease];
            [av show];
        
    

    /*
     Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
     If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
     */


- (void)applicationWillEnterForeground:(UIApplication *)application
    /*
     Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
     */
    if (application.applicationIconBadgeNumber == 1) 
        BOOL tmp=[Global_Class_parsing post_comment_fb:appDelegate_acess_token uesr_comment:@"testing message111"];
        if(tmp)

            UIAlertView *av = [[[UIAlertView alloc] initWithTitle:@"Sucessfully posted to photos & wall!" 
                                                          message:@"Check out your Facebook to see!"
                                                         delegate:nil 
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles:nil] autorelease];
            [av show];

        
        else
            UIAlertView *av = [[[UIAlertView alloc] initWithTitle:@"error"message:@"Check connection!"
                                                         delegate:nil 
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles:nil] autorelease];
            [av show];
        
    


- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification 
    UIApplicationState state = [application applicationState];
    if (state == UIApplicationStateInactive) 
        NSLog(@"Recieved Notification %@",notification);
     else 
        NSLog(@"Recieved Notification method call.");
    

现在的问题是,当通知生成和 applicationbadge 编号变为 1 时,它不会调用任何函数,我的 post message 函数也不会调用。那么我该如何解决这个错误呢?

【问题讨论】:

Why didrecivedlocalnotification method not working? 的可能重复项。如果您想重述原始问题,您应该只编辑原始问题,而不是再次提问。 【参考方案1】:

我得到这个问题的解决方案是,我有两种方法可以使用 post 方法实现调度,一种是简单地使用通知。另一个是使用网络服务。我都用过,而且效果很好。

【讨论】:

以上是关于ifix如何通过事件调度实现声音报警的主要内容,如果未能解决你的问题,请参考以下文章

如何通过在 fb 上发布消息来实现调度事件

Zabbix自定义报警提示声音

如何使用键盘事件通过 URLrequest 播放声音?

如何通过任务调度实现百万规则报警

06-k8s服务层event监控及报警

06-k8s服务层event监控及报警