1#import <Foundation/Foundation.h>
46@implementation NavigineSdkExample
67 NSLog(
@"Error: failed to get NavigineSdk instance");
73 NSLog(
@"Navigine SDK Version: %@", [
NCNavigineSdk getVersion]);
83 NSLog(
@"Relative Time: %lld", [
NCNavigineSdk getRelativeTime]);
98 NSLog(
@"SDK reset to initial state");
109 }
@catch (NSException *exception) {
110 NSLog(
@"SDK initialization error: %@", exception.reason);
122 NSLog(
@"LocationManager successfully initialized");
131 NSLog(
@"NavigationManager successfully initialized");
141 NSLog(
@"ZoneManager successfully initialized");
152 NSLog(
@"RouteManager successfully initialized");
163 NSLog(
@"AsyncRouteManager successfully initialized");
173 NSLog(
@"NotificationManager successfully initialized");
183 NSLog(
@"MeasurementManager successfully initialized");
192 NSLog(
@"LocationListManager successfully initialized");
200 NSLog(
@"StorageManager successfully initialized");
209 NSLog(
@"RouteLayer successfully initialized");
229 NSLog(
@"Next instruction: %@ %.0f m", next.
title, next.
distance);
240 [[
NCGlobalPoint alloc] initWithLatitude:55.751 longitude:37.618],
241 [[
NCGlobalPoint alloc] initWithLatitude:55.752 longitude:37.618],
242 ] sublocationId:nil];
250 NSLog(
@"Route walk started: %@", started ?
@"YES" :
@"NO");
255 NSLog(
@"Walk advance: %f m", sample.
advance);
266 NSLog(
@"MqttSession successfully initialized");
276 NSLog(
@"=== Navigine SDK Information ===");
279 NSLog(
@"Relative Time: %lld", [
NCNavigineSdk getRelativeTime]);
280 NSLog(
@"LocationManager: %@",
self.
locationManager ?
@"available" :
@"unavailable");
281 NSLog(
@"NavigationManager: %@",
self.
navigationManager ?
@"available" :
@"unavailable");
282 NSLog(
@"ZoneManager: %@",
self.
zoneManager ?
@"available" :
@"unavailable");
283 NSLog(
@"RouteManager: %@",
self.
routeManager ?
@"available" :
@"unavailable");
284 NSLog(
@"AsyncRouteManager: %@",
self.
asyncRouteManager ?
@"available" :
@"unavailable");
285 NSLog(
@"NotificationManager: %@",
self.
notificationManager ?
@"available" :
@"unavailable");
286 NSLog(
@"MeasurementManager: %@",
self.
measurementManager ?
@"available" :
@"unavailable");
287 NSLog(
@"LocationListManager: %@",
self.
locationListManager ?
@"available" :
@"unavailable");
288 NSLog(
@"StorageManager: %@",
self.
storageManager ?
@"available" :
@"unavailable");
289 NSLog(
@"MqttSession: %@",
self.
mqttSession ?
@"available" :
@"unavailable");
296 NSLog(
@"=== Manager Usage Demonstration ===");
300 NSLog(
@"LocationManager ready for location operations");
306 NSLog(
@"NavigationManager ready for positioning");
312 NSLog(
@"ZoneManager ready for zone operations");
318 NSLog(
@"RouteManager ready for route building");
324 NSLog(
@"AsyncRouteManager ready for async route operations");
330 NSLog(
@"NotificationManager ready for notifications");
336 NSLog(
@"MeasurementManager ready for measurements");
342 NSLog(
@"LocationListManager ready for location list operations");
348 NSLog(
@"StorageManager ready for storage operations");
354 NSLog(
@"MqttSession ready for publishing position data via MQTT");
362 - (void)demonstrateObjectiveCFeatures {
363 NSLog(
@"=== Objective-C Features Demonstration ===");
366 dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
368 dispatch_async(dispatch_get_main_queue(), ^{
369 NSLog(
@"Async operation completed");
374 [
self addObserver:
self forKeyPath:@"locationManager" options:NSKeyValueObservingOptionNew context:nil];
381 if ([
self respondsToSelector:selector]) {
382 [
self performSelector:selector];
389 - (void)observeValueForKeyPath:(NSString *)keyPath
391 change:(NSDictionary<NSKeyValueChangeKey,
id> *)change
392 context:(
void *)context {
393 if ([keyPath isEqualToString:
@"locationManager"]) {
394 NSLog(
@"LocationManager changed");
403 [
self demonstrateManagersUsage];
404 [
self demonstrateObjectiveCFeatures];
408 [
self removeObserver:
self forKeyPath:@"locationManager"];
416int main(
int argc,
const char * argv[]) {
419 [example runExample];