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

    name

    string value, representing the Mobile Server protocol command name

    parameters

    dictionary containing the command input parameters

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    urlString

    The URL String to which will connect

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    serverInfo

    Server info that contains information about server host, port and secure connection flag

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    urlString

    The URL String to which will connect

    username

    The username

    password

    The password

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    urlString

    The URL String to which will connect

    username

    The username

    password

    The password

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    pin

    The second step authentication pin

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The failure block which returns NSError

    • 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

    cameraID

    the ID of camera for which the video stream is requested

    size

    The size of the video to be streamed

    method

    Type of the method for retrieving video data * @param Push or Pull

    signal

    Type of the requested signal (live, playback or upload)

    fps

    Frame rate of the requested video (frames per second)

    userInitiatedDownsampling

    Flag to indicate whether user has initiated downsampling

    successHandler

    The success block which returns XPSDKResponse and the newly created video connection

    failureHandler

    The failure block which returns NSError

  • Cancels request for stream

    Declaration

    Swift

    open class func cancelRequestStream(request: XPSDKRequest)

    Parameters

    request

    The 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

    videoID

    ID of the video connection (GUID)

    fps

    new value for frames per second

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoID

    ID of the video connection (GUID)

    size

    The new size of the video (Width and Height in pixels)

    sourceRect

    The coordinates of the cropping rectangle (Top, Left, Right, Bottom)

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoID

    ID of the video connection (GUID)

    playSpeed

    Speed of the playback (floating point). Sign determines the direction.

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?)
  • 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

    videoID

    ID of the video connection (GUID)

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoID

    ID of the video connection (GUID)

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoID

    ID of the video connection (GUID)

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoID

    ID of the video connection (GUID)

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoID

    ID of the video connection (GUID)

    timestamp

    Timestamp

    seekType

    seek type

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoID

    ID of the video connection (GUID)

    time

    time (NSDate)

    seekType

    seek type

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoID

    ID of the video connection (GUID)

    ptzMotion

    PTZ Motion (Up, Down, Left, Right, ZoomIn, ZoomOut, Home

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoID

    ID of the video connection (GUID)

    ptzPreset

    PTZ Preset

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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

    videoConnection

    The video connection that will be closed

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The failure block which returns NSError

  • 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

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    viewId

    ID of view which subviews are requested

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    cameraId

    The camera ID for which the outputs and events will be returned

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    objectId

    The ID of Output/Event to be activated

    triggerType

    The type of trigger (Output or Event)

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The failure block which returns NSError

  • 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?) -> XPSDKRequest

    Parameters

    count

    number of the requested alarms

    timestamp

    timestamp

    op

    operator

    myAlarms

    flag for requesting only my alarms

    excludedStates

    states to be excluded

    excludedPriorities

    priorites to be excluded

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    alarmId

    the ID of the alarm which is requested

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    alarmId

    The ID of the alarm to be acknowledged

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    alarmId

    Alarm Id which parameters will be updated

    updatedParameters

    Dictionary of parameteres to be updated

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The failure block which returns NSError

  • 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

    showInDebug

    Flag that indicates if the logger is enabled in debug mode

    showInRelease

    Flag that indicates if the logger is enabled in release mode

    showDate

    Flag that indicates if the date should be logged

    showBundleName

    Flag that indicates if the bundle name should be logged

    showFileName

    Flag that indicates if the file name should be logged

    showLineNubmer

    Flag that indicates if the line number should be logged

    showFunctionName

    Flag that indicates if the function name should be logged

    showLevels

    Flag 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?) -> XPSDKRequest

    Parameters

    name

    Name of the investigation

    cameraID

    the ID of the camera part of the investigation

    startDate

    start time of the investigation

    endDate

    end time of the investigation

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    itemId

    the ID of the investigation which is requested

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    itemId

    the ID of the investigation which is requested to be deleted

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The 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?) -> XPSDKRequest

    Parameters

    investigationId

    Id of the investigation for which an export will be deleted

    exportType

    Type of the export to be deleted. Possible values: Avi, Db, Mkv

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The failure block which returns NSError

  • 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?) -> XPSDKRequest

    Parameters

    cameraID

    ID of the cameramfor which are retrieved Sequences.

    seqType

    Type of the sequences requests – enumeration (Motion, Recording, RecordingWithTrigger)

    time

    Central 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.

    successHandler

    The success block which returns XPSDKResponse

    failureHandler

    The failure block which returns NSError