Class Device
- Namespace
- Geotab.Checkmate.ObjectModel
- Assembly
- Geotab.Checkmate.ObjectModel.dll
A Device represents the physical tracking device installed in the vehicle. A device and vehicle is typically synonymous since the GO tracking device is installed in a vehicle. In the case where there is no device; this is represented by "NoDeviceId". The device types that are supported are:
[ReportClass]
public class Device : NameEntityWithVersion, IEntity, IComparable, IIdentifiable, IVersion, IGroupLinked, ITimeZoneIdProvider, IDefaultable, ICustomizable<Device>, IMediaFiles, IInstanceSizeEstimate
- Inheritance
-
Device
- Implements
- Derived
- Inherited Members
Constructors
Device()
Initializes a new instance of the Device class.
public Device()
Device(Device)
Initializes a new instance of the Device class.
protected Device(Device device)
Parameters
device
DeviceThe vehicle.
Device(Id?)
Initializes a new instance of the Device class.
public Device(Id? id)
Parameters
Device(Id?, long?, string?, string?, int?, string?, int?, TimeSpan?, DateTime?, WorkTime?, float?, IList<Group>?, string?, DeviceFlags?, DateTime?, DateTime?, IReadOnlyList<DevicePlanBillingInfo>?, List<PropertyValue<Device>>?, IList<MediaFile>?)
public Device(Id? id, long? version, string? name, string? comment, int? hardwareId, string? serialNumber, int? productId, TimeSpan? timeToDownload, DateTime? ignoreDownloadsUntil, WorkTime? workTime, float? maxSecondsBetweenLogs, IList<Group>? groups, string? timeZoneId, DeviceFlags? deviceFlags, DateTime? activeTo, DateTime? activeFrom, IReadOnlyList<DevicePlanBillingInfo>? devicePlanBillingInfo, List<PropertyValue<Device>>? customProperties, IList<MediaFile>? mediaFiles = null)
Parameters
id
IdThe unique identifier for each Device. In the case of a database, this would be the autonumber Id field.
version
long?The version.
name
stringThe Device name.
comment
stringThe comment.
hardwareId
int?The hardwareId. If the id is not known, set as null.
serialNumber
stringThe serial number of the device.
productId
int?The firmware product id.
timeToDownload
TimeSpan?The time to download, i.e. how frequently the device should produce new data and that data to be visible on the Checkmate end. This is used to check if the device is in good state.
ignoreDownloadsUntil
DateTime?The DateTime that tells the Checkmate at what moment should it start checking the device status and warn if there is no new data. Used when a new device is just installed or the vehicle undergoes a lengthy service.
workTime
WorkTimeThe WorkTime object.
maxSecondsBetweenLogs
float?Max number of seconds after which a device must produce a log when the ignition is on. When exceeded, data will be considered missing. Must be a positive value.
groups
IList<Group>timeZoneId
stringThe Timezone Id of the device.
deviceFlags
DeviceFlagsThe DeviceFlagsfor this device.
activeTo
DateTime?Date after which device becomes archived.
activeFrom
DateTime?Date after which device becomes active.
devicePlanBillingInfo
IReadOnlyList<DevicePlanBillingInfo>The device plan billing information.
customProperties
List<PropertyValue<Device>>The custom properties and its associated PropertyValue<T>s for this device.
mediaFiles
IList<MediaFile>The collection of MediaFile of MediaType Image for the pictures of this asset.
Fields
A1Prefix
public const string A1Prefix = "A1"
Field Value
A1ProductId
public const int A1ProductId = 255
Field Value
CustomDeviceProductId
public const int CustomDeviceProductId = 10000
Field Value
DefaultMaxNoLogSeconds
Gets the default value for MaxSecondsBetweenLogs.
protected const float DefaultMaxNoLogSeconds = 200
Field Value
Go10Prefix
public const string Go10Prefix = "X1"
Field Value
Go10ProductId
public const int Go10ProductId = 133
Field Value
Go2Prefix
public const string Go2Prefix = "GT"
Field Value
Go2ProductId
public const int Go2ProductId = 1
Field Value
Go3Prefix
public const string Go3Prefix = "G3"
Field Value
Go3ProductId
public const int Go3ProductId = 64
Field Value
Go4Prefix
public const string Go4Prefix = "G4"
Field Value
Go4ProductId
public const int Go4ProductId = 65
Field Value
Go4V3Prefix
public const string Go4V3Prefix = "GV"
Field Value
Go4V3ProductId
public const int Go4V3ProductId = 81
Field Value
Go5Prefix
public const string Go5Prefix = "G5"
Field Value
Go5ProductId
public const int Go5ProductId = 90
Field Value
Go6Prefix
public const string Go6Prefix = "G6"
Field Value
Go6ProductId
public const int Go6ProductId = 101
Field Value
Go7Prefix
public const string Go7Prefix = "G7"
Field Value
Go7ProductId
public const int Go7ProductId = 105
Field Value
Go8Prefix
public const string Go8Prefix = "G8"
Field Value
Go8ProductId
public const int Go8ProductId = 114
Field Value
Go8ProductIdNoGps
public const int Go8ProductIdNoGps = 116
Field Value
Go9BPlusProductId
public const int Go9BPlusProductId = 127
Field Value
Go9BPrefix
public const string Go9BPrefix = "GA"
Field Value
Go9BProductId
public const int Go9BProductId = 124
Field Value
Go9BProductIdNoGps
public const int Go9BProductIdNoGps = 125
Field Value
Go9Prefix
public const string Go9Prefix = "G9"
Field Value
Go9ProductId
public const int Go9ProductId = 120
Field Value
Go9ProductIdNoGps
public const int Go9ProductIdNoGps = 121
Field Value
GoAnywherePrefix
public const string GoAnywherePrefix = "B1"
Field Value
GoAnywhereProductId
public const int GoAnywhereProductId = 131
Field Value
GoDrivePrefix
public const string GoDrivePrefix = "GD"
Field Value
GoDriveProductId
public const int GoDriveProductId = 256
Field Value
GoMaxProductId
public const int GoMaxProductId = 254
Field Value
HistoricMax
public const int HistoricMax = 10000000
Field Value
HistoricMin
public const int HistoricMin = 1000000
Field Value
HistoricSerialNumber
The default serial number of historic devices.
public const string HistoricSerialNumber = "000-000-0000"
Field Value
S1Prefix
public const string S1Prefix = "S1"
Field Value
S1ProductId
public const int S1ProductId = 132
Field Value
U1Prefix
public const string U1Prefix = "U1"
Field Value
U1ProductId
public const int U1ProductId = 130
Field Value
UntrackedAssetHardwareId
public const int UntrackedAssetHardwareId = -1
Field Value
UntrackedAssetProductId
public const int UntrackedAssetProductId = -1
Field Value
Properties
ActiveFrom
Gets or sets the date the device is active from. Default [MinDate].
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.DeviceActiveFrom })]
public virtual DateTime? ActiveFrom { get; set; }
Property Value
ActiveTo
Gets or sets the date that the device is active to. Default [MaxDate].
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.DeviceActiveTo })]
public virtual DateTime? ActiveTo { get; set; }
Property Value
Comment
Gets or sets free text field where any user information can be stored and referenced for this entity.
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.DeviceComment })]
public string? Comment { get; set; }
Property Value
CustomFeatures
Gets or sets a list of DeviceCustomFeatures for this Device and their values.
[Obsolete("CustomFeatures property will be removed completely in a future version of the SDK.", false)]
public IDictionary<DeviceCustomFeature, bool?>? CustomFeatures { get; set; }
Property Value
- IDictionary<DeviceCustomFeature, bool?>
A list of DeviceCustomFeatures for this Device and their values.
CustomProperties
Gets or sets the set of dynamic, user created, custom properties.
public List<PropertyValue<Device>>? CustomProperties { get; set; }
Property Value
DeviceFlags
Gets or sets the device features which have been enabled whether the feature is in use (e.g. HOS, Iridium).
public DeviceFlags? DeviceFlags { get; set; }
Property Value
Remarks
The DevicePlan property cannot be added/updated via the API.
DevicePlanBillingInfo
Gets or sets the DevicePlanBillingInfo that has been purchased for this device.
public IReadOnlyList<DevicePlanBillingInfo>? DevicePlanBillingInfo { get; set; }
Property Value
DevicePlans
Gets or sets the Geotab DevicePlan that has been purchased for this device.
[Obsolete("Obsolete. Please use DevicePlanBillingInfo property instead.", false)]
public IReadOnlyList<DevicePlan>? DevicePlans { get; set; }
Property Value
DeviceReplacementInfo
Gets or sets the device replacement information.
public DeviceReplacementInfo? DeviceReplacementInfo { get; set; }
Property Value
- DeviceReplacementInfo
DeviceReplacementInfo The device replacement information.
DeviceType
Gets specifies the GO or Custom DeviceType.
public DeviceType? DeviceType { get; }
Property Value
Groups
Gets or sets the list of Group(s) the device belongs to.
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.DeviceGroup, ReportHeading.DeviceParentGroup }, IsList = true, IsGroup = true)]
public virtual IList<Group>? Groups { get; set; }
Property Value
HardwareId
Gets or sets the unique hardware identifier for the Device. This is a 4 byte unique number to identify devices in the system.
public int? HardwareId { get; set; }
Property Value
Remarks
This property is no longer supported via the SDK as of v5.7.2001.
Id
Gets or sets the unique identifier for this entity. See Id.
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.DeviceId })]
public override Id? Id { get; set; }
Property Value
IgnoreDownloadsUntil
Gets or sets The date that tells the system at what moment should it start checking the device status and warn if there is no new data. Used when a new device is just installed or the vehicle undergoes a lengthy service. Default [MinDate].
public DateTime? IgnoreDownloadsUntil { get; set; }
Property Value
MaxSecondsBetweenLogs
Gets or sets the maximum allowed time between logs when the ignition is on in seconds. When the value is exceeded, data is considered to be missing. Default [3600] for GoAnywhere or S1 device otherwise [200].
public float? MaxSecondsBetweenLogs { get; set; }
Property Value
Exceptions
- ArgumentOutOfRangeException
Thrown if the
value
is negative.
MediaFiles
Gets or sets the list of MediaFile photos of this asset. Maximum length [1].
public virtual IList<MediaFile>? MediaFiles { get; set; }
Property Value
MinSecondsBetweenLogs
Gets the minimum allowable value for MaxSecondsBetweenLogs. Defaults to 0.0f.
protected virtual float MinSecondsBetweenLogs { get; }
Property Value
- float
The minimum allowable value for MaxSecondsBetweenLogs. Defaults to 0.0f.
Name
Gets or sets the name of this entity which identifies it and is used when displaying this entity. Maximum length [50].
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.DeviceName })]
public override string? Name { get; set; }
Property Value
ProductId
Gets or sets the product id. Each device is assigned a unique hardware product id.
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.DeviceProductId })]
public virtual int? ProductId { get; set; }
Property Value
RegisterDeviceResultLite
Gets or sets a value indicating the current registration status of the device to the Gateway.
public RegisterDeviceResultLite? RegisterDeviceResultLite { get; set; }
Property Value
- RegisterDeviceResultLite
RegisterDeviceResultLite The registration status of the device to the Gateway.
SerialNumber
Gets or sets the Serial Number of the device. Maximum length [12].
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.DeviceSerialNumber })]
public string? SerialNumber { get; set; }
Property Value
TimeToDownload
Gets or sets the expected time between downloads, i.e. how frequently the device is expected to produce new data. For passive devices this might range from 1 to a few days. For live devices this should be maximum 24h unless vehicles travel out of coverage frequently. This is used to check if the device is in good state.
public TimeSpan? TimeToDownload { get; set; }
Property Value
- TimeSpan?
Nullable<T> where T is. float
TimeZoneId
Gets or sets the IANA Timezone Id of the device used to determine local work times. This is typically the "home location" of the device. Default ["America/New_York"].
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.DeviceTimeZoneId })]
public string? TimeZoneId { get; set; }
Property Value
Remarks
Retrieve a list of valid timezone Id's by querying "GetTimeZones".
TmpTrailerId
Gets or sets the trailerId for the assets of type trailer.
[Obsolete("Obsolete. Please do not use this property.", false)]
public Id? TmpTrailerId { get; set; }
Property Value
WorkTime
Gets or sets the WorkTime rules to apply to the device. Default [WorkTimeStandardHours].
public WorkTime? WorkTime { get; set; }
Property Value
Methods
Clone()
Creates a new object that is a copy of the current instance.
public override IEntity Clone()
Returns
- IEntity
A new object that is a copy of this instance.
DeviceTypeFromProductId(int)
`Maps the given productId to a. DeviceType
public static DeviceType DeviceTypeFromProductId(int productId)
Parameters
productId
intThe device product Id.
Returns
- DeviceType
The. DeviceType
FromDeviceType(DeviceType)
Gets the object type that matches a DeviceType
public static Type FromDeviceType(DeviceType deviceType)
Parameters
deviceType
DeviceTypeThe deviceType.
Returns
FromProductId(int)
Get the correct Device object from the given product Id.
public static Device FromProductId(int productId)
Parameters
productId
intThe product identifier.
Returns
FromSerialNumber(string)
Returns the correct type of device for the given serial number.
public static Device FromSerialNumber(string value)
Parameters
value
stringThe serial number for the device. For example, GV-001-000-0000.
Returns
GetObjectTypeFromDeviceType(DeviceType?)
`Get the correct Device class the given product Id.
public static Type GetObjectTypeFromDeviceType(DeviceType? deviceType)
Parameters
deviceType
DeviceType?Type of the device.
Returns
Exceptions
- ArgumentException
Unknown device type.
GetSize()
Gets the size estimate of this instance in bytes.
public virtual long GetSize()
Returns
- long
Returns the size of the entity.
IsActive()
Returns [true] the device's active to date is 'max date'. (Active devices use 'max date' as active to).
public bool IsActive()
Returns
IsActive(DateTime?)
Returns [true] if the device's was active on this date.
public bool IsActive(DateTime? date)
Parameters
date
DateTime?The date.
Returns
IsActive(DateTime?, DateTime?)
Calculates if the device was active for a given date range.
public bool IsActive(DateTime? fromDate, DateTime? toDate)
Parameters
Returns
IsHistoricHardwareId()
Checks if the device has a historic hardware id.
public bool IsHistoricHardwareId()
Returns
IsNoGpsDevice()
Determine if a device is NoGps Device by its productId.
public bool IsNoGpsDevice()
Returns
PopulateDefaults()
Populate non-required empty (null) properties with default values.
public virtual void PopulateDefaults()
PrefixFromDeviceType(int)
Returns the string prefix of the given product ID.
public static string PrefixFromDeviceType(int productId)
Parameters
productId
intInternal product Id for a serial number
Returns
ProductIdFromSerialNumber(string)
Returns the product id from its serial number;
public static int ProductIdFromSerialNumber(string value)
Parameters
value
stringInternal product Id for a serial number
Returns
- int
product id
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.