Class ExxtractorConnection

java.lang.Object
com.exxothermic.audioeverywheresdk.ExxConnection
com.exxothermic.audioeverywheresdk.ExxtractorConnection

public class ExxtractorConnection extends ExxConnection
Class that will handle the current connection to the Exxtractor, working as an intermediate beetween SDK implementers and the current exxtractor detected on the network
Since:
11/4/14
  • Field Details

  • Constructor Details

    • ExxtractorConnection

      public ExxtractorConnection()
      Default constructor, used to set a connection to the box without allowing the ethernet ports on the devices
    • ExxtractorConnection

      public ExxtractorConnection(boolean withEthernetScan)
      Returns new Exxtractor Connection for any application to use. This method also populates the shared instance on the whole application
      Parameters:
      withEthernetScan - indicates if the SDK must use the ethernet port, if available, to scan
    • ExxtractorConnection

      public ExxtractorConnection(android.content.Context toUse, boolean withEthernetScan)
      Method that will build a new Exxtractor Connection for any application to use, this method also populates the shared instance on the whole application
      Parameters:
      toUse - the context that will be used to build this class
  • Method Details

    • getComponent

      public static ServicesComponent getComponent()
    • getInstance

      public static ExxtractorConnection getInstance()
      Method that will return the shared instance for this manager, if exists. If no instance is present, the method will populate the instance to return it
      Returns:
      a shared instance for this connection
    • scanNetworkForExxtractors

      public void scanNetworkForExxtractors(int scanTimeout, AudioEverywhereResponseHandler responseHandler)
      Description copied from class: ExxConnection
      Method that will start the scanning for Exxtractors. The service will scan until either a new service is found or the timeout provided is reached.
      Specified by:
      scanNetworkForExxtractors in class ExxConnection
      Parameters:
      scanTimeout - the timeout used on the service
      responseHandler - response that will be called when the scan finishes, either on success or failure status
    • pauseScan

      public void pauseScan()
      Description copied from class: ExxConnection
      Method that will pause the scan for this service, so no activity is done until AudioEverywhere#scan() is called
      Specified by:
      pauseScan in class ExxConnection
    • startStreamOfChannel

      public void startStreamOfChannel(AudioChannel channel, String stringForNotification, boolean inStereo, AudioEverywhereResponseHandler handler, boolean useLoudspeaker)
      Description copied from class: ExxConnection
      Tries to start the streaming of the receiver channel if the connection is established and send the update to the channel list using the Intent AudioEverywhereMessages.LIST_UPDATED
      Specified by:
      startStreamOfChannel in class ExxConnection
      Parameters:
      channel - Audio channel to start the streaming
      stringForNotification - Notification format to be use when the streaming starts
      inStereo - Indicates if the streaming must start in Stereo or not
      handler - Handler to use for process the result
    • stopStream

      public void stopStream(AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Tries to stop the current streaming if exists and the connection is established
      Specified by:
      stopStream in class ExxConnection
      Parameters:
      handler - Handler to use for process the result
    • startSyncingChannelWithExxtractor

      public void startSyncingChannelWithExxtractor(int deviceType)
      Description copied from class: ExxConnection
      Starts the scanning of the audio channels from the current ExXtractor connection
      Specified by:
      startSyncingChannelWithExxtractor in class ExxConnection
      Parameters:
      deviceType - Sets the device type that is using the SDK
    • refreshCurrentChanelCollection

      public void refreshCurrentChanelCollection()
      Description copied from class: ExxConnection
      Tries to refresh the list of channels
      Specified by:
      refreshCurrentChanelCollection in class ExxConnection
    • destroyManager

      public void destroyManager()
      Description copied from class: ExxConnection
      Method that will clean the manager, stopping all the services and unregistering receivers used during the app life cycle
      Specified by:
      destroyManager in class ExxConnection
    • restartPlayback

      public void restartPlayback(boolean shouldPlayInStereo, String channelPassword, boolean useLoudspeaker)
      Description copied from class: ExxConnection
      Method which restarts the device playback
      Specified by:
      restartPlayback in class ExxConnection
      Parameters:
      shouldPlayInStereo - Indicates that the playback should be in stereo if available
      channelPassword - Password of the current channel
      useLoudspeaker - Indicates that the audio should be played from the loudspeaker
    • getUrlEndpoint

      public String getUrlEndpoint()
      Method that will build the endpoint for a retrofit service and validate if should use http or https
      Returns:
      URL string that endpoints will use (protocol + IP + port)
    • requestPdfDocuments

      public void requestPdfDocuments(AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Method that will request a channel playback from a exxtractor, using a channel and a notification for this
      Specified by:
      requestPdfDocuments in class ExxConnection
      Parameters:
      handler - handler used to manage the request status
    • requestOffers

      public void requestOffers(int deviceType, AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Method that will request the list of offers from the exxtractor
      Specified by:
      requestOffers in class ExxConnection
      Parameters:
      deviceType - Type of device to use for retrieve the list of offers
      handler - handler used to manage the request status
    • validateIpAddress

      public boolean validateIpAddress(String ip)
      Description copied from class: ExxConnection
      Indicates whether an IP address is valid or not.
      Specified by:
      validateIpAddress in class ExxConnection
      Returns:
      True if the ip address is valid.
    • updateExtractorProfile

      public void updateExtractorProfile(AudioEverywhereResponseHandler handler)
      For profile: uses the web service to retrive the info and save it
      Specified by:
      updateExtractorProfile in class ExxConnection
    • getServerInfo

      public void getServerInfo()
    • mOperatorModeEnvironment

      public boolean mOperatorModeEnvironment()
      Specified by:
      mOperatorModeEnvironment in class ExxConnection
    • mOperatorModeEnabled

      public boolean mOperatorModeEnabled()
      Specified by:
      mOperatorModeEnabled in class ExxConnection
    • mDirtyListeners

      public boolean mDirtyListeners()
      Return a dirty flag to know if there are changes to save in the listeners profiles
      Specified by:
      mDirtyListeners in class ExxConnection
    • getChannelList

      public List<AudioChannel> getChannelList()
      Description copied from class: ExxConnection
      Returns the current list of channels from the channel manager
      Specified by:
      getChannelList in class ExxConnection
      Returns:
      Current list of channels
    • checkAvailableServers

      public void checkAvailableServers()
    • resetCurrentAudioChannel

      public void resetCurrentAudioChannel()
      Specified by:
      resetCurrentAudioChannel in class ExxConnection
    • askForProfileUpdate

      public void askForProfileUpdate()
    • getListenerProfileMenu

      public void getListenerProfileMenu(AudioEverywhereResponseHandler handler)
      Specified by:
      getListenerProfileMenu in class ExxConnection
    • updateExtractrLocation

      public void updateExtractrLocation(int deviceType, AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Method that will update the exxtractor location based on the request made to it. This request is only available on API v2 environments
      Specified by:
      updateExtractrLocation in class ExxConnection
      Parameters:
      deviceType - the device type that make the request
      handler - the handler called on complete
    • handleSuccessfulLocation

      public void handleSuccessfulLocation(Location location, AudioEverywhereResponseHandler handler)
    • changingAppMode

      public void changingAppMode()
      Description copied from class: ExxConnection
      Must be use when you are changing between real and demo mode; will clean up the streamings for the device
      Specified by:
      changingAppMode in class ExxConnection
    • connectToServer

      public void connectToServer(String targetVenueServer, int scanTimeout, AudioEverywhereResponseHandler responseHandler)
      Description copied from class: ExxConnection
      Attempts to connect to the audio streaming service at the provided address.
      Specified by:
      connectToServer in class ExxConnection
      Parameters:
      targetVenueServer - the hostname or IP address of the server to connect to.
      scanTimeout - the timeout used on the service.
      responseHandler - response that will be called when the scan finishes, either on success or failure status.
    • disconnect

      public void disconnect()
      Description copied from class: ExxConnection
      Finishes up the connection to an ExXtractor by cleaning up resources associated to it.
      Specified by:
      disconnect in class ExxConnection
    • disconnect

      public void disconnect(StateChangeInformation.ChangeReason reason)
      Description copied from class: ExxConnection
      Finishes up the connection to an ExXtractor by cleaning up resources associated to it. In addition, allows to indicate the reason for the disconnection.
      Specified by:
      disconnect in class ExxConnection
      Parameters:
      reason - An quick explanation for the disconection.
    • getIsBluetoothConnected

      public boolean getIsBluetoothConnected()
      Specified by:
      getIsBluetoothConnected in class ExxConnection
    • setIsBluetoothConnected

      public void setIsBluetoothConnected(boolean mBluetoothConnected)
      Specified by:
      setIsBluetoothConnected in class ExxConnection
    • isDemoModeEnabled

      public boolean isDemoModeEnabled()
      Description copied from class: ExxConnection
      Indicates if the demo mode is enabled or not; this depends if you are using the real or demo implementation
      Specified by:
      isDemoModeEnabled in class ExxConnection
      Returns:
      True if the implementation if for real or demo connection
    • getProfile

      public Profile getProfile()
      Description copied from class: ExxConnection
      Returns the current profile
      Overrides:
      getProfile in class ExxConnection
      Returns:
      profile from exxtractor
    • getConnectedServers

      public List<String> getConnectedServers()
      Description copied from class: ExxConnection
      Returns the current connected servers list
      Overrides:
      getConnectedServers in class ExxConnection
      Returns:
      connected server list
    • setProfile

      public void setProfile(Profile profile)
      Description copied from class: ExxConnection
      Modify the profile
      Overrides:
      setProfile in class ExxConnection
    • isScanningServiceCleaning

      public boolean isScanningServiceCleaning()
      Description copied from class: ExxConnection
      Method that will return to the caller the status of the cleaning process for the current service
      Specified by:
      isScanningServiceCleaning in class ExxConnection
      Returns:
      true if the service is in the cleaning process, false otherwise
    • isPrivateChannelsEnabled

      public boolean isPrivateChannelsEnabled(AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Indicates if private channels feature is enabled or not.
      Specified by:
      isPrivateChannelsEnabled in class ExxConnection
      Returns:
      True if private channels is enabled. False if private channels is disabled.
    • isDuplexEnabled

      public boolean isDuplexEnabled()
      Description copied from class: ExxConnection
      Indicates if duplex communication feature is enabled or not.
      Specified by:
      isDuplexEnabled in class ExxConnection
      Returns:
      True if duplex communication is enabled. False if is disabled.
    • getHashAlgorithm

      public String getHashAlgorithm()
      Description copied from class: ExxConnection
      Indicates the encryption code that the app will use.
      Specified by:
      getHashAlgorithm in class ExxConnection
      Returns:
      True if duplex communication is enabled. False if is disabled.
    • setHashAlgorithm

      public void setHashAlgorithm(String hashAlgorithmType)
      Description copied from class: ExxConnection
      Sets the value of hashAlgorithm to indicate the new type of encryption.
      Specified by:
      setHashAlgorithm in class ExxConnection
      Parameters:
      hashAlgorithmType - new type of encryption.
    • getUsingHttps

      public boolean getUsingHttps()
      Description copied from class: ExxConnection
      Indicates if the endpoints will use https in the url
      Specified by:
      getUsingHttps in class ExxConnection
      Returns:
      True if endpoints will use https, False for use http.
    • setUsingHttps

      public void setUsingHttps(boolean mUsingHttps)
      Description copied from class: ExxConnection
      Sets the value of usingHttps to indicate if the app will use https or http.
      Specified by:
      setUsingHttps in class ExxConnection
      Parameters:
      mUsingHttps - new state of usingHttps to indicate the protocol type.
    • getIsAdminModeEnabled

      public boolean getIsAdminModeEnabled()
      Description copied from class: ExxConnection
      Gets the value of isAdminModeEnabled to verify if an admin session is open.
      Specified by:
      getIsAdminModeEnabled in class ExxConnection
      Returns:
      isAdminModeEnabled value.
    • setIsAdminModeEnabled

      public void setIsAdminModeEnabled(boolean isAdminModeEnabled)
      Description copied from class: ExxConnection
      Sets the valud of isAdminModeEnabled to indicate that an admin session is open.
      Specified by:
      setIsAdminModeEnabled in class ExxConnection
      Parameters:
      isAdminModeEnabled - new state of admin mode feature.
    • adminLogin

      public void adminLogin(String password, AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Indicates if admin login is successfull or not.
      Specified by:
      adminLogin in class ExxConnection
    • loginUser

      public void loginUser(@NonNull VenueServerAuthenticator authenticator, AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Creates a user session in the venue server.
      Specified by:
      loginUser in class ExxConnection
    • logoutCurrentSession

      public void logoutCurrentSession(AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Close the session associated to the current user
      Specified by:
      logoutCurrentSession in class ExxConnection
    • logoutCurrentUser

      public void logoutCurrentUser(AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Destroys session associated to the current user
      Specified by:
      logoutCurrentUser in class ExxConnection
    • setChannelsPrivacy

      public void setChannelsPrivacy(List<AudioChannel> channels, AudioEverywhereResponseHandler handler)
      Specified by:
      setChannelsPrivacy in class ExxConnection
    • getCustomButtons

      public List<CustomButton> getCustomButtons()
      Description copied from class: ExxConnection
      Returns the current list of banners from the channel manager
      Specified by:
      getCustomButtons in class ExxConnection
      Returns:
      Current list of banners
    • setContext

      public void setContext(android.content.Context context)
      Method that will set the current context for the SDK
      Parameters:
      context - the context to set NOTE: The SDK used will be the application context, no matter which one is passed as a parameter
    • initializeTelephonyManager

      public void initializeTelephonyManager(android.content.Context context)
      Method that will setup the telephony manager to handle the calls states of the device
      Specified by:
      initializeTelephonyManager in class ExxConnection
      Parameters:
      context - the context that will be used. Note that the application context will be extracted from it in order to use it inside the SDK
    • isCurrentExxtractorVersionGreaterOrEqualThan

      public boolean isCurrentExxtractorVersionGreaterOrEqualThan(String otherVersion)
      Method that will compare the current exxtractor version, with the one given as a parameter, checking if one version is greater than the other
      Specified by:
      isCurrentExxtractorVersionGreaterOrEqualThan in class ExxConnection
      Parameters:
      otherVersion - the version that will be compared
      Returns:
      true if the Current exxtractor version is greater than the version given as a parameter false otherwise
    • handleNetworkConnectivityChange

      public void handleNetworkConnectivityChange()
      Method that will handle a Wifi Error on the library. It will notify is the wifi is lost. And also will update the ip address used for the session to the current address given by the system
    • saveLastConnectedServer

      public void saveLastConnectedServer(String targetVenueServer)
      Stores the provided target venue server for future use.
      Specified by:
      saveLastConnectedServer in class ExxConnection
      Parameters:
      targetVenueServer - The target venue server's hostname or CNAME.
    • loadLastConnectedServer

      public String loadLastConnectedServer()
      Loads the last connected venue server.
      Specified by:
      loadLastConnectedServer in class ExxConnection
      Returns:
      The stored value of the last connected venue server, if existing. Otherwise, it returns null.
    • connectToService

      public boolean connectToService(String address, String version, AudioEverywhereResponseHandler responseHandler, int scanTimeout)
    • operatorModeLogin

      public void operatorModeLogin(String username, String password, AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Indicates if operator login is successfull or not.
      Specified by:
      operatorModeLogin in class ExxConnection
    • loginOperator

      public void loginOperator(@NonNull VenueServerAuthenticator authenticator, AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Creates a operator session in the venue server.
      Specified by:
      loginOperator in class ExxConnection
    • LoadConfigsFilesFromServer

      public void LoadConfigsFilesFromServer()
    • loginOperatorFromAllServers

      public void loginOperatorFromAllServers(String ipAddress)
    • requestVenuesConfigsFile

      public void requestVenuesConfigsFile(String ipAddress, Token token)
    • requestUnitsConfigsFile

      public void requestUnitsConfigsFile(String ipAddress, Token token)
    • requestListenerMobile

      public void requestListenerMobile(String leid)
    • requestListenerReceiver

      public void requestListenerReceiver(String leid)
    • updatePrivacyChannel

      public void updatePrivacyChannel(AudioChannel audioChannel, boolean setToPrivate)
      Specified by:
      updatePrivacyChannel in class ExxConnection
    • updatePrivacyAllChannels

      public void updatePrivacyAllChannels(List<AudioChannel> channelsList, boolean setToPrivate)
      Specified by:
      updatePrivacyAllChannels in class ExxConnection
    • updateListenerMobileApp

      public void updateListenerMobileApp(Token token, String ipServer, Profile profile, AudioEverywhereResponseHandler handlerProfile)
    • updateListenerReceiver

      public void updateListenerReceiver(Token token, String ipServer, ReceiverConf receiver, AudioEverywhereResponseHandler handlerReceiver)
    • updateUnitConf

      public void updateUnitConf(Token token, String ipServer, UnitConf unit, AudioEverywhereResponseHandler handlerUnit)
    • updateVenueConf

      public void updateVenueConf(Token token, String ipServer, VenueConf venue, AudioEverywhereResponseHandler handlerVenue)
    • mSaveOperatorChanges

      public void mSaveOperatorChanges(AudioEverywhereResponseHandler handler)
      Description copied from class: ExxConnection
      Request to update all the privacy changes in the listeners files
      Specified by:
      mSaveOperatorChanges in class ExxConnection
    • mSaveReceiverFiles

      public void mSaveReceiverFiles(Map.Entry<String,Token> entry, AudioEverywhereResponseHandler handler)
    • mSaveUnitFiles

      public void mSaveUnitFiles(Map.Entry<String,Token> entry, AudioEverywhereResponseHandler handler)
    • mSaveVenueFiles

      public void mSaveVenueFiles(Map.Entry<String,Token> entry, AudioEverywhereResponseHandler handler)
    • bumpListenerVersion

      public void bumpListenerVersion()
    • getBeaconService

      public BeaconsService getBeaconService()
      Specified by:
      getBeaconService in class ExxConnection