Please select Into the mobile phone version | Continue to access the computer ver.
DJIDiagnostics class in IOS MSDK
522 3 2020-12-9
Uploading and Loding Picture ...(0/1)
o(^-^)o
dp7102
lvl.2
Israel
Offline

Hi,
I would like to use DJIDiagnostics class in IOS MSDK to get indication of the drone hardware issues.
As I understand, I can observe DJIDiagnostics instance value changes using KVO.

So I create diagnostic object using:

let djiDiagnistics = DJIDiagnostics()


I observe values change with code like this:
kvoTokenComponent = djiDiagnistics.observe(\.component, options: .new) { (djiDiagnistics, change) in
    guard let component = change.newValue else { return }
    print("New component: \(component)")
}


My questions:
1. djiDiagnistics members are zero during all lifetime of the variable (even when I disconnect it from simulator or turn drone off). Do I create/use DJIDiagnostics in a wrong way?
2. Do i do observation process correctly?
I didn't find any examples or information regarding DJIDiagnostics class use. If there is such example, could you please provide me a link.

Thanks!


2020-12-9
Use props
想养一条边牧
lvl.3
Flight distance : 1155 ft
Hong Kong
Offline

No, it's wrong. Should set the delegate first and then use product:didUpdateDiagnosticsInformation method to monitor it.
https://developer.dji.com/api-re ... uct_delegate_inline
https://developer.dji.com/api-re ... sinformation_inline
2020-12-11
Use props
dp7102
lvl.2
Israel
Offline

想养一条边牧 Posted at 12-11 01:24
No, it's wrong. Should set the delegate first and then use product:didUpdateDiagnosticsInformation method to monitor it.
https://developer.dji.com/api-reference/ios-api/BaseClasses/DJIBaseProduct.html#djibaseproduct_delegate_inline
https://developer.dji.com/api-reference/ios-api/BaseClasses/DJIBaseProduct.html#djibaseproduct_updatediagnosticsinformation_inline

Thank you very much for the explanation!!
I am currently on vacation, and I'll test the solution with drone as soon as I am back from vacation.
2020-12-12
Use props
dp7102
lvl.2
Israel
Offline

想养一条边牧 Posted at 12-11 01:24
No, it's wrong. Should set the delegate first and then use product:didUpdateDiagnosticsInformation method to monitor it.
https://developer.dji.com/api-reference/ios-api/BaseClasses/DJIBaseProduct.html#djibaseproduct_delegate_inline
https://developer.dji.com/api-reference/ios-api/BaseClasses/DJIBaseProduct.html#djibaseproduct_updatediagnosticsinformation_inline

Sorry for the delay with my response. I've tested the solution, and it works fine! Thanks again!
2020-12-26
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules