XPMobileSDK
open class XPMobileSDK : NSObject
Class through which all the commands to server are called
-
Server features of the main connection
Declaration
Swift
open static var serverFeatures: NSDictionary? { get }
-
Execute a generic command that follows Mobile Server Protocol command structure. This command enables you to send commands to the Milestone Mobile Server that are not yet implemented in the MIP SDK Mobile.
More details about the Mobile Server commands could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func sendCommand( name:String, parameters:[String:String]?, successHandler:SuccessResponse?, failureHandler: FailureBlock? )Parameters
namestring value, representing the Mobile Server protocol command name
parametersdictionary containing the command input parameters
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Executes a connect command to establish a new connection with a server.
More details about the Connect command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func connect(successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Disconnects from server - logs out current user
More details about the Disconnect command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func disconnect() -> XPSDKRequest -
Disconnects from server - logs out current user
More details about the Disconnect command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func disconnect(withSuccessHandler successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Connects to server with url method
More details about the Connect command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func connectWithURLString(_ urlString: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
urlStringThe URL String to which will connect
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Connects to server with server info
More details about the Connect command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func connectWithServerInfo(_ serverInfo: XPSDKServerInfo, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
serverInfoServer info that contains information about server host, port and secure connection flag
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Login
More details about the Login command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func loginForUsername(_ username: String, password: String, shouldSave: Bool, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
usernameThe username
passwordThe password
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Login
More details about the Connect and Login commands could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func connectAndLoginForURLString(_ urlString: String, username: String, password: String, shouldSave: Bool, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
urlStringThe URL String to which will connect
usernameThe username
passwordThe password
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Connect and login - first connects to a server, and then logins the user
More details about the Connect and Login commands could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func connectAndLoginForServerInfo(_ serverInfo: XPSDKServerInfo, username: String, password: String, shouldSave: Bool, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
urlStringThe URL String to which will connect
usernameThe username
passwordThe password
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Requests second step authentication pin
More details about the SecondStepAuthentication command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func requestSecondStepAuthenticationPin(withSuccessHandler successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Verifies second step authentication pin
More details about the SecondStepAuthentication command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func verifySecondStepAuthenticationPin(withPin pin: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
pinThe second step authentication pin
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
requestStream(forCameraID:size:method:signal:fps:compressionLevel:userInitiatedDownsampling:keyFramesOnly:resizeSupported:time:usesTranscoding:successHandler:failureHandler:)Request stream method
More details about the RequestStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func requestStream(forCameraID cameraID: XPSDKViewID, size: CGSize, method: XPSDKVideoConnectionMethod, signal: XPSDKVideoConnectionSignal, fps:Int, compressionLevel:Int, userInitiatedDownsampling:Bool, keyFramesOnly:Bool, resizeSupported: Bool, time: NSDate?, usesTranscoding: Bool, successHandler: @escaping (XPSDKResponse, XPSDKVideoConnection) -> Void, failureHandler: FailureBlock?)Parameters
cameraIDthe ID of camera for which the video stream is requested
sizeThe size of the video to be streamed
methodType of the method for retrieving video data * @param Push or Pull
signalType of the requested signal (live, playback or upload)
fpsFrame rate of the requested video (frames per second)
userInitiatedDownsamplingFlag to indicate whether user has initiated downsampling
successHandlerThe success block which returns XPSDKResponse and the newly created video connection
failureHandlerThe failure block which returns NSError
-
Cancels request for stream
Declaration
Swift
open class func cancelRequestStream(request: XPSDKRequest)Parameters
requestThe request that will be cancelled
-
Changes the parameter ‘fps’ of the existing video connection
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func changeStream(forVideoID videoID: String, fps: Int, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
fpsnew value for frames per second
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Changes the parameters ‘size’ and ‘source rectangle’ of the existing video connection
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func changeStream(forVideoID videoID: String, size: CGSize, sourceRect: CGRect, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
sizeThe new size of the video (Width and Height in pixels)
sourceRectThe coordinates of the cropping rectangle (Top, Left, Right, Bottom)
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Changes the parameter ‘playback speed’ of the existing video connection
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func changeStream(forVideoID videoID: String, playSpeed: Float, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
playSpeedSpeed of the playback (floating point). Sign determines the direction.
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Change stream with size
@param videoID: ID of the video connection (GUID) @param size: The new size of the video (Width and Height in pixels) @param successHandler: The success block which returns XPSDKResponse @param failureHandler: The failure block which returns NSError
Declaration
Swift
open class func changeStream(forVideoID videoID: String, size: CGSize, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -
Change stream with source rectangle
@param videoID: ID of the video connection (GUID) @param sourceRect: The coordinates of the cropping rectangle (Top, Left, Right, Bottom) @param successHandler: The success block which returns XPSDKResponse @param failureHandler: The failure block which returns NSError
Declaration
Swift
open class func changeStream(forVideoID videoID: String, sourceRect: CGRect, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -
requestAudioStream(forMicrophoneId:audioEncoding:signalType:methodType:successHandler:failureHandler:)Declaration
Swift
open class func requestAudioStream(forMicrophoneId micId: String, audioEncoding: String, signalType: String, methodType: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -
Declaration
Swift
open class func closeAudioStream(forAudioId audioId: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -
Gets previous sequence of playback video
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func previousSequence(forVideoID videoID: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Gets next sequence of playback video
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func nextSequence(forVideoID videoID: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Gets previous frame of playback video
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func previousFrame(forVideoID videoID: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Gets next frame of playback video
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func nextFrame(forVideoID videoID: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Seeks to timestamp in playback video
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func seekToTimestamp(forVideoID videoID: String, timestamp: NSNumber, seekType: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
timestampTimestamp
seekTypeseek type
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Seeks to time in playback video
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func seekToTime(forVideoID videoID: String, time: NSDate, seekType: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
timetime (NSDate)
seekTypeseek type
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Moves camera with ptzMotion
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func moveCamera(forVideoID videoID: String, ptzMotion: XPSDKPTZMotion, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
ptzMotionPTZ Motion (Up, Down, Left, Right, ZoomIn, ZoomOut, Home
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Moves camera with ptz preset
More details about the ChangeStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func moveCamera(forVideoID videoID: String, ptzPreset: XPSDKCameraPTZPreset, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoIDID of the video connection (GUID)
ptzPresetPTZ Preset
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Closes an existing video connection
More details about the CloseStream command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func closeVideoConnection(videoConnection: XPSDKVideoConnection, successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
videoConnectionThe video connection that will be closed
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
requestAudioStreamIn(forItemId:audioEncoding:samplingRate:bitsPerSample:numberOfChannels:successHandler:failureHandler:)Declaration
Swift
open class func requestAudioStreamIn(forItemId itemId: String, audioEncoding: String, samplingRate: String, bitsPerSample: String, numberOfChannels: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequest
-
Gets all views and cameras
More details about the GetAllViewsAndCameras command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func getAllViewsAndCameras(withSuccessHandler successHandler: SuccessResponse?, failureHandler: FailureBlock?)Parameters
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Gets subviews of view
More details about the GetViews command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func getSubviewsOfView(withId viewId: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
viewIdID of view which subviews are requested
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Gets outputs and events
More details about the GetOutputsAndEvents command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func getOutputsAndEvents(forCameraId cameraId: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
cameraIdThe camera ID for which the outputs and events will be returned
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Activates output
More details about the RequestActivation command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func requestActivate(forObjectId objectId: String, triggerType: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
objectIdThe ID of Output/Event to be activated
triggerTypeThe type of trigger (Output or Event)
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
getAlarms(withCount:timestamp:op:myAlarms:excludedStates:excludedPriorities:successHandler:failureHandler:)Gets alarms
More details about the GetAlarms command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func getAlarms(withCount count: Int, timestamp: String, op: String, myAlarms: Bool, excludedStates: String, excludedPriorities: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
countnumber of the requested alarms
timestamptimestamp
opoperator
myAlarmsflag for requesting only my alarms
excludedStatesstates to be excluded
excludedPrioritiespriorites to be excluded
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Gets a single alarm by ID
More details about the GetAlarms command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func getAlarm(withId alarmId: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
alarmIdthe ID of the alarm which is requested
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Gets alarm data settings
More details about the GetAlarmDataSettings command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func getAlarmDataSettings(withSuccessHandler successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Acknowledges alarm
More details about the AcknowledgeAlarm command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func acknowledgeAlarm(withId alarmId: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
alarmIdThe ID of the alarm to be acknowledged
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Updates alarm
More details about the UpdateAlarm command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
open class func updateAlarm(withId alarmId: String, updatedParameters: [String : String], successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
alarmIdAlarm Id which parameters will be updated
updatedParametersDictionary of parameteres to be updated
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
setupLogger(showInDebug:showInRelease:showDate:showLevel:showBundleName:showFileName:showLineNubmer:showFunctionName:showLevels:)Sets up logging details
Declaration
Swift
open class func setupLogger(showInDebug: Bool, showInRelease: Bool, showDate: Bool, showLevel: Bool, showBundleName: Bool, showFileName: Bool, showLineNubmer: Bool, showFunctionName: Bool, showLevels: [Level]?)Parameters
showInDebugFlag that indicates if the logger is enabled in debug mode
showInReleaseFlag that indicates if the logger is enabled in release mode
showDateFlag that indicates if the date should be logged
showBundleNameFlag that indicates if the bundle name should be logged
showFileNameFlag that indicates if the file name should be logged
showLineNubmerFlag that indicates if the line number should be logged
showFunctionNameFlag that indicates if the function name should be logged
showLevelsFlag that indicates if the bundle name should be logged
-
Declaration
Swift
open class func setAuthenticationComplete(_ authenticationComplete: Bool)
-
Creates new investigation
More details about the CreateInvestigation command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
@discardableResult open class func createInvestigation(withName name: String, cameraID: String, startTime: Date, endTime: Date, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
nameName of the investigation
cameraIDthe ID of the camera part of the investigation
startDatestart time of the investigation
endDateend time of the investigation
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Gets single (list of) investigation(s)
More details about the GetInvestigation command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
@discardableResult open class func getInvestigation(withId investigationId: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
itemIdthe ID of the investigation which is requested
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Deletes investigation with ID
More details about the DeleteInvestigation command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
@discardableResult open class func deleteInvestigation(withId investigationId: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
itemIdthe ID of the investigation which is requested to be deleted
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Deletes an investigation export on the server
More details about the DeleteInvestigation command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
@discardableResult open class func deleteInvestigationExport(withId investigationId: String, exportType: String, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
investigationIdId of the investigation for which an export will be deleted
exportTypeType of the export to be deleted. Possible values: Avi, Db, Mkv
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
getSequences(withCameraId:seqType:time:beforeTime:beforeCount:afterTime:afterCount:investigationId:forceSequencesFromExport:successHandler:failureHandler:)Get recorded sequences for particular camera
More details about the GetSequences command could be found in the Mobile Server Protocol documentation.
Declaration
Swift
@discardableResult open class func getSequences(withCameraId cameraID: String, seqType: String, time: NSNumber, beforeTime: NSNumber?, beforeCount: NSNumber?, afterTime: NSNumber?, afterCount: NSNumber?, investigationId: String?, forceSequencesFromExport: String?, successHandler: SuccessResponse?, failureHandler: FailureBlock?) -> XPSDKRequestParameters
cameraIDID of the cameramfor which are retrieved Sequences.
seqTypeType of the sequences requests – enumeration (Motion, Recording, RecordingWithTrigger)
timeCentral time of sequence request (in milliseconds since Unix epoch).
beforeTime(optional) Time span in the past (concerning central time) to where sequences to be searched (in seconds). Must be non-negative.
beforeCount(optional) Maximal count of sequences to be searched in the time interval from “BeforeTime” to “Time”
afterTime(optional) Time span in the future (concerning central time) to where sequences to be searched (in seconds). Must be non-negative
afterCount(optional) Maximal count of sequences to be searched in the time interval from “Time” to “AfterTime”.
investigationId(optional) The id of the investigation (export) to be used for extracting the sequences.
forceSequencesFromExport(optional) [Yes/No] Force the sequences to be taken from the export stored by the mobile server. Requires InvestigationId to be passed as well.
successHandlerThe success block which returns XPSDKResponse
failureHandlerThe failure block which returns NSError
-
Adds Delegate
Declaration
Swift
open class func addDelegate(_ delegate: XPMobileSDKConnectionDelegate)Parameters
delegateAdd delegate to set of delegates
-
Removes Delegate
Declaration
Swift
open class func removeDelegate(_ delegate: XPMobileSDKConnectionDelegate)Parameters
delegateRemove delegate from set of delegates
-
Stops All Sessions
Declaration
Swift
open class func stopAllSessions() -
Sends Keepalive Message to make sure that connection to server is still active
Declaration
Swift
open class func sendLiveMessage()
XPMobileSDK Class Reference