Interface CommunicationManager


  • public interface CommunicationManager
    The Communication manager allows you to make asynchronous requests to the server, mostly to fetch data.
    • Method Detail

      • fetchOrganizationTheme

        boolean fetchOrganizationTheme​(@NonNull
                                       Handler<OrganizationTheme> callback)
        Get organization theme: company name, logo and colors
        Parameters:
        callback - Callback to asynchronously receive the organization theme. Not null.
        Returns:
        True if request is sent. False if request can't be sent:
      • logout

        boolean logout​(Handler<Object> callback)
        Invalidate user's token and remove it from internal credentials, if exist. If not exist, return false. After invalidation, first network request will cause a login, to obtain another valid token.
        Parameters:
        callback - invoked when logout is finished
        Returns:
        True if request is correctly sent. False if can't be sent: there is no user token.
      • prefetchPositioningInfo

        boolean prefetchPositioningInfo​(@NonNull
                                        Handler<String> callback)
        Download all the necessary information to start positioning. This includes Building, BuildingInfo and the building's model. Downloaded information will be saved in cache. Previous to version 2.50.2 the model was only obtained while starting positioning inside a Building
        Parameters:
        callback - Callback to asynchronously receive the result of this call. An error will be notified if anything fails during the download, only the most critical error will be sent
      • prefetchPositioningInfo

        boolean prefetchPositioningInfo​(CommunicationConfig config,
                                        Handler<String> callback)
        Download all the necessary information to start positioning. This includes Building, BuildingInfo and the building's model. Downloaded information will be saved in cache. Previous to version 2.50.2 the model was only obtained while starting positioning inside a Building
        Parameters:
        callback - Callback to asynchronously receive the result of this call. An error will be notified if anything fails during the download, only the most critical error will be sent
        config - request specific configuration. Can be null.
      • prefetchPositioningInfo

        boolean prefetchPositioningInfo​(@NonNull
                                        List<String> buildingIds,
                                        @NonNull
                                        Handler<String> callback)
        Download all the necessary information to start positioning in the selected buildings. This includes Building, BuildingInfo and the building's model. Downloaded information will be saved in cache. Previous to version 2.50.2 the model was only obtained while starting positioning inside a Building
        Parameters:
        buildingIds - List with the ids of the buildings you want to prefetch
        callback - Callback to asynchronously receive the result of this call. An error will be notified if anything fails during the download, only the most critical error will be sent
      • prefetchPositioningInfo

        boolean prefetchPositioningInfo​(@NonNull
                                        List<String> buildingIds,
                                        CommunicationConfig config,
                                        Handler<String> callback)
        Download all the necessary information to start positioning in the selected buildings. This includes Building, BuildingInfo and the building's model. Downloaded information will be saved in cache. Previous to version 2.50.2 the model was only obtained while starting positioning inside a Building
        Parameters:
        buildingIds - List with the ids of the buildings you want to prefetch
        callback - Callback to asynchronously receive the result of this call. An error will be notified if anything fails during the download, only the most critical error will be sent
        config - request specific configuration. Can be null.
      • fetchBuildings

        boolean fetchBuildings​(@NonNull
                               Handler<Collection<Building>> callback)
        Download all the buildings for the current user
        Parameters:
        callback - Callback to asynchronously receive the buildings. Not null.
      • fetchBuildings

        boolean fetchBuildings​(CommunicationConfig config,
                               @NonNull
                               Handler<Collection<Building>> callback)
        Download all the buildings for the current user
        Parameters:
        config - request specific configuration. Can be null.
        callback - Callback to asynchronously receive the buildings. Not null.
      • fetchBuildingInfo

        boolean fetchBuildingInfo​(String buildingId,
                                  @NonNull
                                  Handler<BuildingInfo> callback)
        Download all the building data for the selected building. This info includes floors, indoor and outdoor POIs, events and paths. Also it download floor maps and POI category icons to local storage.
        Parameters:
        buildingId - selected building for download info. Not null.
        callback - Callback to asynchronously receive the buildings. Not null.
      • fetchBuildingInfo

        boolean fetchBuildingInfo​(@NonNull
                                  String buildingId,
                                  CommunicationConfig config,
                                  @NonNull
                                  Handler<BuildingInfo> callback)
        Download all the building data from the selected building. This info includes floors, indoor and outdoor POIs, events and paths. Also it download floor maps and POI category icons to local storage.
        Parameters:
        buildingId - selected building for download info. Not null.
        config - request specific configuration. Can be null.
        callback - Callback to asynchronously receive the buildings. Not null.
      • fetchFloorsFromBuilding

        boolean fetchFloorsFromBuilding​(@NonNull
                                        String buildingId,
                                        @NonNull
                                        Handler<Collection<Floor>> callback)
        Download all the floors of a building
        Parameters:
        buildingId - the building identifier. Not null.
        callback - Callback to asynchronously receive the floors. Not null.
      • fetchFloorsFromBuilding

        boolean fetchFloorsFromBuilding​(@NonNull
                                        String buildingId,
                                        CommunicationConfig config,
                                        @NonNull
                                        Handler<Collection<Floor>> callback)
        Download all the floors of a building
        Parameters:
        buildingId - the building identifier. Not null.
        config - request specific configuration. Can be null.
        callback - Callback to asynchronously receive the floors. Not null.
      • fetchMapFromFloor

        boolean fetchMapFromFloor​(@NonNull
                                  Floor floor,
                                  @NonNull
                                  Handler<android.graphics.Bitmap> callback)
        Download the map image of a floor
        Parameters:
        floor - the floor. Not null.
        callback - callback to asynchronously receive the floor image. Not null.
      • fetchMapFromFloor

        boolean fetchMapFromFloor​(@NonNull
                                  Floor floor,
                                  CommunicationConfig config,
                                  @NonNull
                                  Handler<android.graphics.Bitmap> callback)
        Download the map image of a floor
        Parameters:
        floor - the floor. Not null.
        config - request specific configuration. Can be null.
        callback - callback to asynchronously receive the image. Not null.
      • fetchIndoorPOIsFromBuilding

        boolean fetchIndoorPOIsFromBuilding​(@NonNull
                                            String buildingId,
                                            @NonNull
                                            Handler<Collection<Poi>> callback)
        Download the indoor POIs of a building
        Parameters:
        buildingId - the building identifier. Not null.
        callback - Callback to asynchronously receive the points of interest. Not null.
      • fetchIndoorPOIsFromBuilding

        boolean fetchIndoorPOIsFromBuilding​(@NonNull
                                            String buildingId,
                                            CommunicationConfig config,
                                            @NonNull
                                            Handler<Collection<Poi>> callback)
        Download the indoor POIs of a building
        Parameters:
        buildingId - the building identifier. Not null.
        config - request specific configuration. Can be null.
        callback - callback to asynchronously receive the points of interest. Not null.
      • fetchAllPOIsFromUser

        boolean fetchAllPOIsFromUser​(@NonNull
                                     Handler<Collection<Poi>> callback)
        Download the POIs from all the buildings of the user
        Parameters:
        callback - callback to asynchronously receive the points of interest. Not null.
      • fetchAllPOIsFromUser

        boolean fetchAllPOIsFromUser​(CommunicationConfig config,
                                     @NonNull
                                     Handler<Collection<Poi>> callback)
        Download the POIs from all the buildings of the user
        Parameters:
        config - request specific configuration. Can be null.
        callback - callback to asynchronously receive the points of interest. Not null.
      • fetchPoiCategoryIcon

        boolean fetchPoiCategoryIcon​(@NonNull
                                     PoiCategory category,
                                     boolean selected,
                                     @NonNull
                                     Handler<android.graphics.Bitmap> callback)
        Get the normal category icon for a category
        Parameters:
        category - the category. Not null.
        selected - fetch icon for selected or normal state.
        callback - the callback. Not null.
      • fetchPoiCategoryIcon

        boolean fetchPoiCategoryIcon​(@NonNull
                                     PoiCategory category,
                                     boolean selected,
                                     CommunicationConfig config,
                                     @NonNull
                                     Handler<android.graphics.Bitmap> callback)
        Get the normal category icon for a category
        Parameters:
        category - the category. Not null.
        selected - fetch icon for selected or normal state.
        config - the request specific configuration. Can be null.
        callback - the callback. Not null.
      • fetchOutdoorPOIsFromBuilding

        boolean fetchOutdoorPOIsFromBuilding​(@NonNull
                                             String buildingId,
                                             @NonNull
                                             Handler<Collection<Poi>> callback)
        Download the outdoor POIs of a building
        Parameters:
        buildingId - the building identifier. Not null.
        callback - Callback to asynchronously receive the points of interest. Not null.
      • fetchOutdoorPOIsFromBuilding

        boolean fetchOutdoorPOIsFromBuilding​(@NonNull
                                             String buildingId,
                                             CommunicationConfig config,
                                             @NonNull
                                             Handler<Collection<Poi>> callback)
        Download the outdoor POIs of a building
        Parameters:
        buildingId - the building identifier. Not null.
        config - requerst specific configuration. Can be null.
        callback - Callback to asynchronously receive the points of interest. Not null.
      • fetchEventsFromBuilding

        boolean fetchEventsFromBuilding​(@NonNull
                                        String buildingId,
                                        @NonNull
                                        Handler<Collection<SitumEvent>> callback)
        Download the events of a building
        Parameters:
        buildingId - the building identifier. Not null.
        callback - Callback to asynchronously receive the events of a building. Not null.
      • fetchEventsFromBuilding

        boolean fetchEventsFromBuilding​(@NonNull
                                        String buildingId,
                                        CommunicationConfig config,
                                        @NonNull
                                        Handler<Collection<SitumEvent>> callback)
        Download the events of a building
        Parameters:
        buildingId - the building identifier. Not null.
        config - request specific configuration. Can be null.
        callback - Callback to asynchronously receive the events of a building. Not null.
      • createOccurrenceForEvent

        boolean createOccurrenceForEvent​(@NonNull
                                         SitumEvent event,
                                         @NonNull
                                         Handler<EventOccurrence> callback)
        Create an occurrence for an event.
        Parameters:
        event - the event that occurred. Not null.
        callback - receives an event occurrence, necessary to notify a click and conversion of the same event. Not null.
        See Also:
        EventOccurrence
      • updateOccurrence

        boolean updateOccurrence​(@NonNull
                                 EventOccurrence occurrence,
                                 EventAction action,
                                 @NonNull
                                 Handler<EventOccurrence> callback)
        Update an event occurrence The time when the action was produced can be provided in the occurrence; if not, new Date() is assumed.
        Parameters:
        occurrence - event occurrence. Not null. occurrence.getId() not null.
        action - action performed on the event.
        callback - receives the updated occurrence, necessary to notify a conversion of the same event. Not null.
        See Also:
        EventOccurrence
      • fetchGeofencesFromBuilding

        boolean fetchGeofencesFromBuilding​(@NonNull
                                           Building building,
                                           @NonNull
                                           Handler<List<Geofence>> callback)
        Get the geofences of a building
        Parameters:
        building - the building. Not null.
        callback - the callback. Not null.
      • fetchGeofencesFromBuilding

        boolean fetchGeofencesFromBuilding​(@NonNull
                                           Building building,
                                           CommunicationConfig config,
                                           @NonNull
                                           Handler<List<Geofence>> callback)
        Get the geofences of a building
        Parameters:
        building - the building. Not null.
        config - request specific configuration. Can be null.
        callback - the callback. Not null.
      • fetchRailWidth

        boolean fetchRailWidth​(@NonNull
                               String buildingId,
                               @NonNull
                               Handler<Float> callback)
        Get the calibrations rail width used in a building
        Parameters:
        buildingId - the building identifier. Not null
        callback - the callback. Not null
      • updateRailWidth

        boolean updateRailWidth​(@NonNull
                                String building,
                                float railWidth,
                                @NonNull
                                Handler<Object> callback)
        Update the calibrations rail width for a building
        Parameters:
        building - the building identifier. Not null
        railWidth - the new rail width
        callback - the callback. Not null
      • fetchRemoteConfig

        boolean fetchRemoteConfig​(@NonNull
                                  Handler<RemoteConfig> callback)
        Get the RemoteConfig for the current user.
        Parameters:
        callback - Callback to asynchronously receive the remote config. Not null.
      • fetchRemoteConfig

        boolean fetchRemoteConfig​(@NonNull
                                  LocationRequest locationRequest,
                                  @NonNull
                                  Handler<RemoteConfig> callback)
        Get the RemoteConfig for the current user. The given LocationRequest will be used do override the remote location request.
        Parameters:
        locationRequest - Local location request used to override remote values. Not null.
        callback - Callback to asynchronously receive the remote config. Not null.
      • invalidateCache

        void invalidateCache()
        Invalidate all the resources in the cache
      • getHttpRequestExecutor

        @NonNull
        HttpRequestExecutor getHttpRequestExecutor()
        Return the HTTP Request Executor to make custom requests to the Dashboard
      • fetchBuildingInfo

        @Deprecated
        boolean fetchBuildingInfo​(Building building,
                                  @NonNull
                                  Handler<BuildingInfo> callback)
        Deprecated.
        Download all the building data for the selected building. This info includes floors, indoor and outdoor POIs, events and paths. Also it download floor maps and POI category icons to local storage.
        Parameters:
        building - selected building for download info. Not null.
        callback - Callback to asynchronously receive the buildings. Not null.
      • fetchCalibratedArea

        @Deprecated
        boolean fetchCalibratedArea​(@NonNull
                                    Building building,
                                    @NonNull
                                    Floor floor,
                                    @NonNull
                                    Handler<Collection<CalibrationArea>> callback)
        Deprecated.
        Use CalibrationManager.fetchActiveGtScans(Floor, Handler)
        Get the calibrated areas for a floor. This call will try to fetch the last updated data if possible.
        Parameters:
        building - the building. Not null
        floor - the floor. Not null
        callback - the callback. Not null
      • fetchCalibrationWifiScans

        @Deprecated
        boolean fetchCalibrationWifiScans​(@NonNull
                                          Building building,
                                          @NonNull
                                          Floor floor,
                                          @NonNull
                                          Handler<Scans> callback)
        Deprecated.
        Use CalibrationManager.fetchActiveWifiScans(Floor, Handler)
        Get the wifi scanned points for a floor. This call will try to fetch the last updated data if possible.
        Parameters:
        building - the building. Not null
        floor - the floor. Not null
        callback - the callback. Not null
      • fetchCalibrationBleScans

        @Deprecated
        boolean fetchCalibrationBleScans​(@NonNull
                                         Building building,
                                         @NonNull
                                         Floor floor,
                                         @NonNull
                                         Handler<Scans> callback)
        Deprecated.
        Use CalibrationManager.fetchActiveBleScans(Floor, Handler)
        Get the BLE scanned points for a floor. This call will try to fetch the last updated data if possible.
        Parameters:
        building - the building. Not null
        floor - the floor. Not null
        callback - the callback. Not null
      • updateRailWidth

        @Deprecated
        boolean updateRailWidth​(@NonNull
                                Building building,
                                float railWidth,
                                @NonNull
                                Handler<Object> callback)
        Update the calibrations rail width for a building
        Parameters:
        building - the building. Not null
        railWidth - the new rail width
        callback - the callback. Not null