Device Settings

Pre-requisite:

  • The user has to be signed in to perform the following operations.
  • The Device should be a cluster device to perform the following operations.

Get Cluster for a Device

To get the device cluster, The following method can be used:

  • spaceId (required): The space ID of the device.
  • deviceId (required): The device ID.
InstaVision.deviceServices.getDeviceCluster(
  spaceId = "spaceId",
  deviceId = "deviceId",
  onSuccess = { deviceCluster ->
    // The device cluster object
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)

Update Device Cluster

To update the device cluster, The following method can be used:

  • spaceId (required): The space ID of the device.
  • deviceId (required): The device ID.
  • clusterId (required): The id of the cluster to be update.
  • request (required): The request object containing the list of attributes in the cluster.
val request = UpdateClusterRequest(
  attributes = listOf(
    UpdateClusterAttribute(
      id = ClusterAttributeTypes.TimeZoneIdentifier.id,
      value = timezone.id
    ),
    UpdateClusterAttribute(
      id = ClusterAttributeTypes.TimeZoneOffset.id,
      value = tzFormat
    )
  )
)
InstaVision.deviceServices.updateCluster(
  spaceId = "spaceId",
  deviceId = "deviceId",
  clusterId = DeviceClusterTypes.TimeZone.id,
  request = request,
  onSuccess = {
    // The device cluster has been updated successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)

Update Device Cluster attribute

To update the device cluster, The following method can be used:

  • spaceId (required): The space ID of the device.
  • deviceId (required): The device ID.
  • clusterId (required): The id of the cluster to be update.
  • attributeId (required): the id of the attribute to be updated.
  • request (required): The request object containing the new value for the attribute.
val request = UpdateClusterAttributeRequest(
  value = false // The new value for the attribute
)
InstaVision.deviceServices.updateClusterAttribute(
  spaceId = "spaceId",
  deviceId = "deviceId",
  clusterId = DeviceClusterTypes.PrivacyMode.id,
  attributeId = ClusterAttributeTypes.PrivacyMode.id,
  request = request,
  onSuccess = {
    // The device cluster has been updated successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)

Get Cloud Settings for a Device

To get the cloud settings for a device, The following method can be used:

  • spaceId (required): The space ID of the device.
  • deviceId (required): The device ID.
InstaVision.deviceServices.getCloudSettings(
  spaceId = "spaceId",
  deviceId = "deviceId",
  onSuccess = { cloudSettings ->
    // The cloud settings object
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)

Update Cloud Settings for a Device

To update the cloud settings for a device, The following method can be used:

  • spaceId (required): The space ID of the device.
  • deviceId (required): The device ID.
  • request (required): The request object containing the new cloud settings.
val request = AiSettingsRequest(cloudAi = AiDetection(motion = isMotionEnabled))

InstaVision.deviceServices.updateCloudSettings(
  spaceId = "spaceId",
  deviceId = "deviceId",
  request = request,
  onSuccess = {
    // The cloud settings have been updated successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)

Update Notification Settings for a Device

To update the notification settings for a device, The following method can be used:

  • spaceId (required): The space ID of the device.
  • deviceId (required): The device ID.
  • request (required): The request object containing the new notification settings.
val request = Notification(mute = !status)

InstaVision.deviceServices.updateNotificationSettings(
  spaceId = "spaceId",
  deviceId = "deviceId",
  request = request,
  onSuccess = {
    // The notification settings have been updated successfully
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)

Get Activity Zones for a space

To get the activity zones for a device, The following method can be used:

  • spaceId (required): The space ID of the device.
InstaVision.deviceServices.getActivityZones(
  spaceId = "spaceId",
  onSuccess = { activityZones ->
    // The activity zones object
  },
  onError = { error ->
    // The error object contains the error code and message
  },
)

Device Cluster Extensions

There are some extensions available for the device cluster to make it easier to work with the device cluster attributes. The following extensions are available:

// Extensions to check if the device supports a feature
cluster.supportsPrivacyMode()
cluster.supportsMotionSensitivity()
cluster.supportsMotionDetection()
cluster.supportsMotionDetectionCooldown()
cluster.supportsHumanTracking()
cluster.supportsPirSensitivity()
cluster.supportsActivityZone()
cluster.supportsStatusLight()
cluster.supportsCameraLight()
cluster.supportsNightVision()
cluster.supportsGuideLamp()
cluster.supportsAlarmLight()
cluster.supportsFloodLight()
cluster.supportsTimeZone()
cluster.supportsOSDSettings()
cluster.supportsAudioSettings()
cluster.supportsRotation()
cluster.supportsEventDuration()
cluster.supportsPTZ()
cluster.supportsHDR()
cluster.supportsBitRate()
cluster.supportsAlwaysOn()
cluster.supportsSDCard()
cluster.supportsEventScheduling()
cluster.supportOSDLogo()
cluster.supportOSDTimestamp()
cluster.supportsSpeaker()
cluster.supportsMicrophone()
cluster.supportsPan()
cluster.supportsTilt()
cluster.supportsRSSI()
cluster.supportsManualSiren()
cluster.supportsEdgeAIPerson()
cluster.supportsEdgeAIAnimal()
cluster.supportsEdgeAIVehicle()

// Extensions to get the options of an attribute
cluster.motionSensitivityOptions()
cluster.pirSensitivityOptions()
cluster.coolDownPeriodOptions()
cluster.nightVisionOptions()
cluster.cameraLightOptions()
cluster.floodLightModeOptions()
cluster.guideLightModeOptions()

// Extensions to get the value of the attribute
cluster.isAlwaysOnEnabled()
cluster.isHumanTrackingEnabled()
cluster.isStatusLightEnabled()
cluster.motionSensitivityLevel()
cluster.pirSensitivityLevel()
cluster.isActivityZoneEnabled()
cluster.eventDuration()
cluster.showOsdLogo()
cluster.showOsdTime()
cluster.isHdrEnabled()
cluster.rotationAngle()
cluster.isSpeakerEnabled()
cluster.isMicrophoneEnabled()
cluster.speakerVolume()
cluster.coolDownPeriod()
cluster.nightVision()
cluster.cameraLightMode()
cluster.guideLightMode()
cluster.alarmLightMode()
cluster.floodLightMode()
cluster.cvrMode()
cluster.isInPrivacyMode()
cluster.timeZone()
cluster.activityZones()
cluster.isEdgeAiPersonEnabled()
cluster.isEdgeAiAnimalEnabled()
cluster.isEdgeAiVehicleEnabled()
cluster.isMotionDetectionEnabled()

// Map extensions
device.getClustersMap()
deviceCluster.getClusterMap()
cluster.getAttributesMap()
attributeProperty.getLabelsMap()