Package fi.bitwards.service
Class BitwardsResource
java.lang.Object
fi.bitwards.service.BitwardsResource
Bitwards resource entity.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn access entry of the resource (resource event).static classThis class describes hardware features of the resource.static final classValidity period when resource is accessible. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringReservation mode is ANY_USER_CLOSEDstatic final StringReservation mode is ANY_USER_OPENstatic final StringReservation mode is ANY_USER_UNTIL_OPENstatic final intReservation status is ASSIGNED (resource type must not be RESERVABLE)static final intReservation status is BOOKED_LOCKED (resource type must be RESERVABLE)static final intReservation status is EXPIRED (resource type must be RESERVABLE)static final intReservation status is FREE (resource type must be RESERVABLE)static final intReservation status is NOT_RESERVABLE (resource type must not be RESERVABLE)static final intReservation status is ReLOCKING (resource type must be RESERVABLE)static final intReservation status is RELEASING (resource type must be RESERVABLE)static final intReservation status is UNKNOWNstatic final intResource type NORMALstatic final intResource type RESERVABLE, actual reservation status is obtained with getReservationStatus() method. -
Method Summary
Modifier and TypeMethodDescriptionGet the access event list for the resource.Get the validity period(s) of the resource access right in use, i.e., when end user has access to the resource.Get the validity period(s) of Access Rights for the resource, i.e., when end user has access to the resource.longGet the account Id of the resourceGet the account name of the resourceGet the additional info of the resourceGet the address of the resourceintGet the battery level of the resourceGet the administrator info of the the resource.Deprecated.getBitwardsSchedule(long scheduleID) Gets the weekly schedule or exception days of when the end user has access to the resource.Get the description for resourceGet the door ID of the resourceGet the floor information of the resourceGet the bluetooth friendly name of the resource.longGet the location Id of the resourcedoubleLatitude of the location of the resourcedoubleLongitude of the location of the resourceGet the location name of the resourceGets the MAC address of the BLE interface.intGet the reservation status as reported by the resource (over Bluetooth).intGet the resource reservation status as reported by the server.Gets ResourceHardware instance that describes the hardware features of the resource.byte[]Get the resource id.Get the resource reservation operation mode from serverGet the resource reservation releasing time from serverintGet the resource type as reported by the resource (over Bluetooth).intGet the resource type as reported by the server.intgetRSSI()Get RSSI of the resource if it has been found.android.bluetooth.le.ScanRecordGet the can record sent by the resource, if resource was discovered using bluetooth.byte[]Get the serial number.Get the support email for resource locationGet the support number for resource locationDeprecated.booleanDetermines whether the most recent maintenance with the resource was successful or not.booleanDetermines whether there are pending maintenance messages to be sent to the resource.booleanDetermines whether resource is a soft token.booleanCheck if the resource is a Universal resourcebooleanisValid()Check if access to the resource is valid now.booleantoString()
-
Field Details
-
RESOURCE_TYPE_NORMAL
public static final int RESOURCE_TYPE_NORMALResource type NORMAL- See Also:
-
RESOURCE_TYPE_RESERVABLE
public static final int RESOURCE_TYPE_RESERVABLEResource type RESERVABLE, actual reservation status is obtained with getReservationStatus() method.- See Also:
-
RESERVATION_STATUS_ASSIGNED
public static final int RESERVATION_STATUS_ASSIGNEDReservation status is ASSIGNED (resource type must not be RESERVABLE)- See Also:
-
RESERVATION_STATUS_FREE
public static final int RESERVATION_STATUS_FREEReservation status is FREE (resource type must be RESERVABLE)- See Also:
-
RESERVATION_STATUS_BOOKED_LOCKED
public static final int RESERVATION_STATUS_BOOKED_LOCKEDReservation status is BOOKED_LOCKED (resource type must be RESERVABLE)- See Also:
-
RESERVATION_STATUS_RELEASING
public static final int RESERVATION_STATUS_RELEASINGReservation status is RELEASING (resource type must be RESERVABLE)- See Also:
-
RESERVATION_STATUS_EXPIRED
public static final int RESERVATION_STATUS_EXPIREDReservation status is EXPIRED (resource type must be RESERVABLE)- See Also:
-
RESERVATION_STATUS_NOT_RESERVABLE
public static final int RESERVATION_STATUS_NOT_RESERVABLEReservation status is NOT_RESERVABLE (resource type must not be RESERVABLE)- See Also:
-
RESERVATION_STATUS_RE_LOCKING
public static final int RESERVATION_STATUS_RE_LOCKINGReservation status is ReLOCKING (resource type must be RESERVABLE)- See Also:
-
RESERVATION_STATUS_UNKNOWN
public static final int RESERVATION_STATUS_UNKNOWNReservation status is UNKNOWN- See Also:
-
RESERVATION_MODE_ANY_USER_CLOSED
Reservation mode is ANY_USER_CLOSED- See Also:
-
RESERVATION_MODE_ANY_USER_UNTIL_OPEN
Reservation mode is ANY_USER_UNTIL_OPEN- See Also:
-
RESERVATION_MODE_ANY_USER_OPEN
Reservation mode is ANY_USER_OPEN- See Also:
-
-
Method Details
-
getRSSI
public int getRSSI()Get RSSI of the resource if it has been found.- Returns:
- the RSSI, 0 if not available
-
isUniversal
public boolean isUniversal()Check if the resource is a Universal resource- Returns:
- true if the resource is Universal. False if the resource is not universal or if this term is not applicable, for example if this is a Mobile Access resource.
-
getMacAddress
Gets the MAC address of the BLE interface.- Returns:
- the MAC address, null if not available or applicable
-
getFriendlyName
Get the bluetooth friendly name of the resource.- Returns:
- the bluetooth friendly name, or null if resource was accessed via NFC or was not found over bluetooth.
-
getScanRecord
public android.bluetooth.le.ScanRecord getScanRecord()Get the can record sent by the resource, if resource was discovered using bluetooth.- Returns:
- the bluetooth scan record, or null if resource was accessed via NFC or was not found over bluetooth.
-
getResourceType
public int getResourceType()Get the resource type as reported by the resource (over Bluetooth).- Returns:
- the resource type (e.g., RESOURCE_TYPE_NORMAL or RESOURCE_TYPE_RESERVABLE).
-
getReservationStatus
public int getReservationStatus()Get the reservation status as reported by the resource (over Bluetooth). If resource type is a reservable, then resource returns the reservation status of the resource. If resource type is not reservable, the RESOURCE_STATUS_UNKNOWN is returned.- Returns:
- the reservation status
-
getResourceTypeFromServer
public int getResourceTypeFromServer()Get the resource type as reported by the server.- Returns:
- the resource type (e.g., RESOURCE_TYPE_NORMAL or RESOURCE_TYPE_RESERVABLE).
-
getResourceReservationReleasingTime
Get the resource reservation releasing time from server- Returns:
- the resource reservation releasing time
-
getResourceReservationOperationMode
Get the resource reservation operation mode from server- Returns:
- the resource reservation operation mode
-
getReservationStatusFromServer
public int getReservationStatusFromServer()Get the resource reservation status as reported by the server.- Returns:
- the resource reservation status (e.g., RESERVATION_STATUS_BOOKED_OPEN or RESERVATION_STATUS_BOOKED_LOCKED).
-
getResourceId
public byte[] getResourceId()Get the resource id.- Returns:
- the resource id, null if not available
-
getSerialNumber
public byte[] getSerialNumber()Get the serial number.- Returns:
- the serial number, null if not available
-
getLocationLatitude
public double getLocationLatitude()Latitude of the location of the resource- Returns:
- the latitude, zero if not available
-
getLocationLongitude
public double getLocationLongitude()Longitude of the location of the resource- Returns:
- the longitude, zero if not avaialble
-
getDescription
Get the description for resource- Returns:
- the description, null if not available
-
getAddress
Get the address of the resource- Returns:
- the address, null if not available
-
getLocationName
Get the location name of the resource- Returns:
- the location name, null if not available
-
getLocationId
public long getLocationId()Get the location Id of the resource- Returns:
- the location Id, zero if not available
-
getAccountName
Get the account name of the resource- Returns:
- the account name, null if not available
-
getAccountId
public long getAccountId()Get the account Id of the resource- Returns:
- the account Id, zero if not available
-
getSupportEmail
Get the support email for resource location- Returns:
- the support email, null if not available
-
getSupportNumber
Get the support number for resource location- Returns:
- the support number, null if not available
-
getFloorInfo
Get the floor information of the resource- Returns:
- the floor information, null if not available
-
getDoorId
Get the door ID of the resource- Returns:
- the door ID, null if not available
-
getBatteryLevel
public int getBatteryLevel()Get the battery level of the resource- Returns:
- the battery level in procentage (0-100%), -1 if not available
-
getAdditionalInfo
Get the additional info of the resource- Returns:
- the additional info
-
isValid
public boolean isValid()Check if access to the resource is valid now.- Returns:
- true if end user has access now, false if not
-
getValidityList
Deprecated.Deprecated, usegetAccessRightValidityList()instead to get access right validity, rather than token validity, which is usually limited to two days.- Returns:
- a list of validity periods
-
getAccessRightValidityList
Get the validity period(s) of Access Rights for the resource, i.e., when end user has access to the resource.- Returns:
- a list of validity periods
-
getAccessRightValidityInUse
Get the validity period(s) of the resource access right in use, i.e., when end user has access to the resource.- Returns:
- validity periods of access rights in use.
-
getAccessList
Get the access event list for the resource.- Returns:
- the access list
-
isSoftToken
public boolean isSoftToken()Determines whether resource is a soft token.- Returns:
- true if resource is soft token, otherwise false
-
getBitwardsSchedule
Deprecated.Deprecated, usegetBitwardsSchedule(long scheduleID)instead to get a specific schedule using it's scheduleID. ScheduleIDs can be obtained by callinggetAccessRightValidityList()which returns a Validity object, which has getScheduleId() method.- Returns:
- the schedule; null if no weekly schedule or exception days have not been set of the the resource.
-
getBitwardsSchedule
Gets the weekly schedule or exception days of when the end user has access to the resource.- Parameters:
scheduleID- ID of the schedule we want to retrieve. ScheduleIDs can be obtained by callinggetAccessRightValidityList()which returns a Validity object, which has getScheduleId() method.- Returns:
- the schedule; null if no weekly schedule or exception days have been set for the the resource.
-
getResourceHardware
Gets ResourceHardware instance that describes the hardware features of the resource.- Returns:
- the ResourceHardware instance, null if it is not available.
-
isMaintenancePending
public boolean isMaintenancePending()Determines whether there are pending maintenance messages to be sent to the resource.- Returns:
- true if there pending maintenance messages, false otherwise
-
isMaintenanceFailed
public boolean isMaintenanceFailed()Determines whether the most recent maintenance with the resource was successful or not.- Returns:
- true if maintenance failed, false if it was successful, intentionally skipped, or status is unknown.
-
getBitwardsAdminInfo
Get the administrator info of the the resource.- Returns:
- the BitwardsAdminInfo or null if an not specified
-
toString
-
needsBluetoothProximity
public boolean needsBluetoothProximity()
-