Class BitwardsResource

java.lang.Object
fi.bitwards.service.BitwardsResource

public class BitwardsResource extends Object
Bitwards resource entity.
  • Field Details

    • RESOURCE_TYPE_NORMAL

      public static final int RESOURCE_TYPE_NORMAL
      Resource type NORMAL
      See Also:
    • RESOURCE_TYPE_RESERVABLE

      public static final int RESOURCE_TYPE_RESERVABLE
      Resource type RESERVABLE, actual reservation status is obtained with getReservationStatus() method.
      See Also:
    • RESERVATION_STATUS_ASSIGNED

      public static final int RESERVATION_STATUS_ASSIGNED
      Reservation status is ASSIGNED (resource type must not be RESERVABLE)
      See Also:
    • RESERVATION_STATUS_FREE

      public static final int RESERVATION_STATUS_FREE
      Reservation status is FREE (resource type must be RESERVABLE)
      See Also:
    • RESERVATION_STATUS_BOOKED_LOCKED

      public static final int RESERVATION_STATUS_BOOKED_LOCKED
      Reservation status is BOOKED_LOCKED (resource type must be RESERVABLE)
      See Also:
    • RESERVATION_STATUS_RELEASING

      public static final int RESERVATION_STATUS_RELEASING
      Reservation status is RELEASING (resource type must be RESERVABLE)
      See Also:
    • RESERVATION_STATUS_EXPIRED

      public static final int RESERVATION_STATUS_EXPIRED
      Reservation status is EXPIRED (resource type must be RESERVABLE)
      See Also:
    • RESERVATION_STATUS_NOT_RESERVABLE

      public static final int RESERVATION_STATUS_NOT_RESERVABLE
      Reservation status is NOT_RESERVABLE (resource type must not be RESERVABLE)
      See Also:
    • RESERVATION_STATUS_RE_LOCKING

      public static final int RESERVATION_STATUS_RE_LOCKING
      Reservation status is ReLOCKING (resource type must be RESERVABLE)
      See Also:
    • RESERVATION_STATUS_UNKNOWN

      public static final int RESERVATION_STATUS_UNKNOWN
      Reservation status is UNKNOWN
      See Also:
    • RESERVATION_MODE_ANY_USER_CLOSED

      public static final String RESERVATION_MODE_ANY_USER_CLOSED
      Reservation mode is ANY_USER_CLOSED
      See Also:
    • RESERVATION_MODE_ANY_USER_UNTIL_OPEN

      public static final String RESERVATION_MODE_ANY_USER_UNTIL_OPEN
      Reservation mode is ANY_USER_UNTIL_OPEN
      See Also:
    • RESERVATION_MODE_ANY_USER_OPEN

      public static final String 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

      public String getMacAddress()
      Gets the MAC address of the BLE interface.
      Returns:
      the MAC address, null if not available or applicable
    • getFriendlyName

      public String 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

      public String getResourceReservationReleasingTime()
      Get the resource reservation releasing time from server
      Returns:
      the resource reservation releasing time
    • getResourceReservationOperationMode

      public String 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

      public String getDescription()
      Get the description for resource
      Returns:
      the description, null if not available
    • getAddress

      public String getAddress()
      Get the address of the resource
      Returns:
      the address, null if not available
    • getLocationName

      public String 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

      public String 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

      public String getSupportEmail()
      Get the support email for resource location
      Returns:
      the support email, null if not available
    • getSupportNumber

      public String getSupportNumber()
      Get the support number for resource location
      Returns:
      the support number, null if not available
    • getFloorInfo

      public String getFloorInfo()
      Get the floor information of the resource
      Returns:
      the floor information, null if not available
    • getDoorId

      public String 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

      public String 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 public List<BitwardsResource.Validity> getValidityList()
      Deprecated.
      Deprecated, use getAccessRightValidityList() instead to get access right validity, rather than token validity, which is usually limited to two days.
      Returns:
      a list of validity periods
    • getAccessRightValidityList

      public List<BitwardsResource.Validity> 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

      public BitwardsResource.Validity 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

      public List<BitwardsResource.AccessEvent> 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 public BitwardsSchedule getBitwardsSchedule()
      Deprecated.
      Deprecated, use getBitwardsSchedule(long scheduleID) instead to get a specific schedule using it's scheduleID. ScheduleIDs can be obtained by calling getAccessRightValidityList() 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

      public BitwardsSchedule getBitwardsSchedule(long scheduleID)
      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 calling getAccessRightValidityList() 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

      public BitwardsResource.ResourceHardware 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

      public BitwardsAdminInfo getBitwardsAdminInfo()
      Get the administrator info of the the resource.
      Returns:
      the BitwardsAdminInfo or null if an not specified
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • needsBluetoothProximity

      public boolean needsBluetoothProximity()