mirror of
https://github.com/CopterExpress/clover.git
synced 2026-06-02 16:09:32 +00:00
rc: use /mavros/statustext/recv topic for STATUSTEXT messages
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3</string>
|
||||
<string>5</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
|
||||
@@ -63,12 +63,12 @@ class ViewController: UIViewController, WKScriptMessageHandler {
|
||||
// Got notification message
|
||||
print(message)
|
||||
let m = message.body as! NSDictionary;
|
||||
let level = m["level"] as! Int
|
||||
let level = m["severity"] as! Int
|
||||
if level == 4 {
|
||||
let banner = NotificationBanner(title: m["msg"] as! String, style: .warning)
|
||||
let banner = NotificationBanner(title: m["text"] as! String, style: .warning)
|
||||
banner.show()
|
||||
} else {
|
||||
let banner = NotificationBanner(title: m["msg"] as! String, style: .danger)
|
||||
let banner = NotificationBanner(title: m["text"] as! String, style: .danger)
|
||||
banner.show()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,15 +62,15 @@ new ROSLIB.Topic({
|
||||
|
||||
new ROSLIB.Topic({
|
||||
ros: ros,
|
||||
name: '/rosout_agg',
|
||||
messageType: 'rosgraph_msgs/Log'
|
||||
name: '/mavros/statustext/recv',
|
||||
messageType: 'mavros_msgs/StatusText'
|
||||
}).subscribe(function(message) {
|
||||
var BLACKLIST = ['CMD: ', 'PR: ', 'DROPPED', 'Clock skew detected', 'MANUAL CONTROL LOST'];
|
||||
if (message.level >= 4) {
|
||||
if (message.severity <= 4) {
|
||||
if (BLACKLIST.some(function(e) {
|
||||
return message.msg.indexOf(e) != -1;
|
||||
return message.text.indexOf(e) != -1;
|
||||
})) {
|
||||
console.log('Filtered out message ' + message.msg);
|
||||
console.log('Filtered out message ' + message.text);
|
||||
return;
|
||||
}
|
||||
callNativeApp('notification', message);
|
||||
|
||||
Reference in New Issue
Block a user