Migration guide

This page is intended as a guide for the process of migrating from MobileSDKv1 to MobileSDKv2.

Previously, the sniffer and wizard library were part of one framework (CameraWizard) and the streaming part of a second framework (CameraStreamer). This is not the case anymore, as there's only one framework (CMMobileSDK) which includes several classes: CameraSniffer, CameraWizard, CameraStreamer and NuboCamWizard.

The main big difference between the two SDKs is that the old version needed basic authentication for instantiating objects and used XML API calls for other requests, while the new version requires an access token to be passed with each REST API call. You should set CMAccessTokenProvider.delegate to some instance at your program which holds valid access token, MobileSDK will ask instance to provide token when it required.

To perform migration you should replace MobileSDKv1 with MobileSDKv2 (check Installation guide page for instructions).

๐Ÿ“˜

Below you can find examples of MobileSDKv1 and MobileSDKv2 usage differences.

Please note that we covered mostly used methods; check Public API page to learn all available methods and callbacks.

We used ObjC for example however Swift can be used instead with same semantics.

CameraSniffer + CameraWizard

// MobileSDKv1
CameraWizard *cameraWizard = [[CameraWizard alloc] initWithDelegate:self userId:@"12345" sessionId:@"0123456789012345678901234567890" serverIp:@"test.cameramanager.com" serverHttpsPort:@"123"];
 
// MobileSDKv2, MobileSDKv3
CMCameraSniffer *sniffer = [[CMCameraSniffer alloc] initWithDelegate:yourSnifferDelegateInstance];
CMCameraWizard *wizard = [[CMCameraWizard alloc] initWithDelegate:yourWizardDelegateInstance];
// MobileSDKv1
[cameraWizard startSniffer];
ย 
// MobileSDKv2, MobileSDKv3
[sniffer startSniffing];
// MobileSDKv1
if (cameraWizard.snifferStarted) {
    [cameraWizard stopSniffer];
}
 
// MobileSDKv2, MobileSDKv3
[sniffer stopSniffing];
// MobileSDKv1
- (void)foundNewDevice:(Device *)device {
    // present device to user
}
 
- (void)failedWithError:(CameraWizardError *)error {
    // some error occurred
}
 
// MobileSDKv2, MobileSDKv3
- (void)cameraSniffer:(CMCameraSniffer *)sniffer onFound:(CMDevice *)device {
    // present device to user
}
 
- (void)cameraSniffer:(CMCameraSniffer *)sniffer onError:(CMMobileSDKError *)error {
    // some error occurred at sniffer
}
// MobileSDKv1
[cameraWizard addDevice:someDeviceReturnedBySniffer withName:@"My awesome camera" zoneId:1234 cameraUserName:@"admin" cameraPassword:@"12345"]; 
 
// MobileSDKv2
[wizard addDevice:someDeviceReturnedBySniffer named:"My awesome camera" atZone:1234];
 
// MobileSDKv3
[wizard addDevice:someDeviceReturnedBySniffer named:"My sniffed camera" atZone:1234];
// MobileSDKv1
- (void)addedCameraWithId:(int)cameraId device:(Device *)device {
    // camera was added to platform; use it's id to retrieve any required information
}
 
- (void)failedWithError:(CameraWizardError *)error {
    // some error occurred
}
 
// MobileSDKv2, MobileSDKv3
- (void)cameraWizard:(CMCameraWizard *)wizard onAdded:(NSInteger)cameraId forDevice:(CMDevice *)device {
    // camera was added to platform; use it's id to retrieve any required information
}
 
- (void)cameraWizard:(CMCameraWizard *)wizard onError:(CMMobileSDKError *)error forDevice:(CMDevice *)device {
    // some error occurred at wizard
}