Class ExxConnection

java.lang.Object
com.exxothermic.audioeverywheresdk.ExxConnection
Direct Known Subclasses:
ExxtractorConnection

public abstract class ExxConnection extends Object
Abstract class with the definition of the required methods and the shared code to handle the connection real or simulated to an ExXtractor
Since:
07/04/2016
  • Field Details

    • MAGIC_LENGTH

      public static final int MAGIC_LENGTH
      See Also:
    • mCurrentManagerState

      protected StateChangeInformation.ManagerState mCurrentManagerState
    • mCurrentChannelManager

      protected ExxChannelManager mCurrentChannelManager
    • mLocation

      protected Location mLocation
    • mCurrentFeatureHelper

      protected FeaturesHelper mCurrentFeatureHelper
    • mScanOverEthernet

      protected boolean mScanOverEthernet
    • demoModeTransition

      protected boolean demoModeTransition
    • mNetworkHandlerAlreadyCalled

      protected boolean mNetworkHandlerAlreadyCalled
    • mEthernetConnectionDetected

      protected boolean mEthernetConnectionDetected
    • mWifiConnectionDetected

      protected boolean mWifiConnectionDetected
    • headsetConnected

      protected boolean headsetConnected
    • mCurrentExxtractorVersion

      protected String mCurrentExxtractorVersion
    • mPartnerId

      protected String mPartnerId
    • mCurrentExxtractorAddress

      protected String mCurrentExxtractorAddress
    • mExxtractorsSeen

      protected int mExxtractorsSeen
    • mSeenChannels

      protected int mSeenChannels
    • mRequestedChannels

      protected int mRequestedChannels
    • mTotalPlaybackTime

      protected int mTotalPlaybackTime
    • mProfile

      protected Profile mProfile
    • mConnectedServers

      protected List<String> mConnectedServers
    • mContext

      protected android.content.Context mContext
    • mCurrentService

      protected BeaconsService mCurrentService
    • mConnection

      protected android.content.ServiceConnection mConnection
    • mMessagingHelper

      @Inject protected MessagingHelper mMessagingHelper
  • Constructor Details

    • ExxConnection

      public ExxConnection()
  • Method Details

    • isScanOverEthernet

      public boolean isScanOverEthernet()
      Returns the current configuration of the scanOverEthernet option at the current ExXtractor connection
      Returns:
      True if the scan over ethernet is set to true, False otherwise
    • registerBroadcastReceiver

      public void registerBroadcastReceiver(android.content.BroadcastReceiver toRegister)
      Method that will register the broadcast receiver for the messages on the application Callers must store the reference passed to this method, so the broadcast can be unregistered by calling ExxtractorConnection#unregisterBroadcastReceiver(BroadcastReceiver toUnregister)
      Parameters:
      toRegister - the broadcast that will be registered
    • registerRemoteControlReceiver

      public void registerRemoteControlReceiver(android.content.BroadcastReceiver receiver)
      Method that will register the remote control receiver
      Parameters:
      receiver - broadcast that will be registered
    • unregisterBroadcastReceiver

      public void unregisterBroadcastReceiver(android.content.BroadcastReceiver toUnregister)
      Unregisters the broadcast receiver
      Parameters:
      toUnregister - Receiver to be unregistered
    • getCurrentAudioChannel

      public AudioChannel getCurrentAudioChannel()
      Method that will return the current Audio channel that is playing from the SDK
      Returns:
      the current Audio Channel
    • setNotificationBuilder

      public void setNotificationBuilder(NotificationBuilder builder)
      Sets the Notification object to be use
      Parameters:
      builder - NotificationObject to use for channels updates and others
    • isDemoTransition

      public boolean isDemoTransition()
      Indicates if the demo transition is set to true or not
      Returns:
      True or False depending if the property is True or False
    • areOffersAvailable

      public boolean areOffersAvailable()
      If the current state is connected or polling will try to return if there are offers from the current feature helper
      Returns:
      True or False depending if there are offers for the current connection
    • areFilesEnabled

      public boolean areFilesEnabled()
      If the current state is connected or polling will try to return if there are files from the current feature helper
      Returns:
      True or False depending if there are files for the current connection
    • isLocationEnabled

      public boolean isLocationEnabled()
      If the current state is connected or polling will try to return if the Location is enabled or not
      Returns:
      True or False depending if the Location is enabled or not
    • areAllFeaturesEnabled

      public boolean areAllFeaturesEnabled()
      If the current state is connected or polling will try to return if all the features are enable or not
      Returns:
      True or False depending if all the features are enabled or not
    • isPartnerInformationAvailable

      public boolean isPartnerInformationAvailable()
      If the current state is connected or polling will try to return if the partner information is enabled
      Returns:
      True or False depending if the partner information is enabled
    • stopPlaybackWithoutService

      public void stopPlaybackWithoutService()
      Method that will stop any playback state that may be running without services. The app may do this when the exxtractor is disconnected from the network, turned off, or other external reasons
    • getLocation

      public Location getLocation()
      Returns the current Location definition
      Returns:
      Location object of the current connection
    • getProfile

      public Profile getProfile()
      Returns the current profile
      Returns:
      profile from exxtractor
    • getConnectedServers

      public List<String> getConnectedServers()
      Returns the current connected servers list
      Returns:
      connected server list
    • setProfile

      public void setProfile(Profile profile)
      Modify the profile
      Parameters:
      profile -
    • getCurrentExxtractorVersion

      public String getCurrentExxtractorVersion()
      Returns the current version of the connected ExXtractor
      Returns:
      Version of the connected ExXtractor
    • getCurrentChannelIndex

      public int getCurrentChannelIndex()
      Returns the index on the list of the current channel
      Returns:
      Index from the list of the current channel
    • getCurrentManagerState

      public StateChangeInformation.ManagerState getCurrentManagerState()
      Method that will return the current manager state for the SDK
      Returns:
      the state manager
    • setDemoTransition

      public void setDemoTransition(boolean transition)
      Sets the demoModeTransition property
      Parameters:
      transition - boolean with the new configuration
    • getExxtractorsSeen

      public int getExxtractorsSeen()
      Returns the mExxtractorsSeen property value
      Returns:
      property value
    • getSeenChannels

      public int getSeenChannels()
      Returns the mSeenChannels property value
      Returns:
      property value
    • getRequestedChannels

      public int getRequestedChannels()
      Returns the mRequestedChannels property value
      Returns:
      property value
    • getTotalPlaybackTime

      public int getTotalPlaybackTime()
      Returns the mTotalPlaybackTime property value
      Returns:
      property value
    • getCurrentExxtractorAddress

      public String getCurrentExxtractorAddress()
      Returns the mCurrentExxtractorAddress property value
      Returns:
      property value
    • setPartnerId

      public void setPartnerId(String partnerId)
      Sets the mPartnerId property for this class and for the mCurrentChannelManager
      Parameters:
      partnerId - Id of the partner to set
    • updateNotificationAndRemoteControlText

      public void updateNotificationAndRemoteControlText(String notificationText)
      Updates the notification format to be use for channel description
      Parameters:
      notificationText - New format to be use
    • setNewState

      protected void setNewState()
      Sets the new state depending of the current state
    • sendServiceStatusChange

      protected void sendServiceStatusChange(StateChangeInformation.ManagerState newState, StateChangeInformation.ChangeReason reason)
      Method that changes the state of the service, notifying about the change
      Parameters:
      newState - the new state that will be set on the service
      reason - This model will included the new state, the previous state and a reason for the change
    • isConnected

      public boolean isConnected()
      Indicates if the current connection to an ExXtractor is established or not
      Returns:
      True or False depending if it's connected or not
    • checkIfClientIsConnected

      protected boolean checkIfClientIsConnected()
      Checks if there is a connection, if not then throw an Exception
    • generateRandomMagicForInstallation

      protected String generateRandomMagicForInstallation()
      Generates a random string with a size of MAGIC_LENGTH and with letters between a and z
      Returns:
      Random String
    • getChannelList

      public abstract List<AudioChannel> getChannelList()
      Returns the current list of channels from the channel manager
      Returns:
      Current list of channels
    • scanNetworkForExxtractors

      public abstract void scanNetworkForExxtractors(int scanTimeout, AudioEverywhereResponseHandler responseHandler)
      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.
      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 abstract void pauseScan()
      Method that will pause the scan for this service, so no activity is done until AudioEverywhere#scan() is called
    • startStreamOfChannel

      public abstract void startStreamOfChannel(AudioChannel channel, String stringForNotification, boolean inStereo, AudioEverywhereResponseHandler handler, boolean useLoudspeaker)
      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
      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 abstract void stopStream(AudioEverywhereResponseHandler handler)
      Tries to stop the current streaming if exists and the connection is established
      Parameters:
      handler - Handler to use for process the result
    • startSyncingChannelWithExxtractor

      public abstract void startSyncingChannelWithExxtractor(int deviceType)
      Starts the scanning of the audio channels from the current ExXtractor connection
      Parameters:
      deviceType - Sets the device type that is using the SDK
    • refreshCurrentChanelCollection

      public abstract void refreshCurrentChanelCollection()
      Tries to refresh the list of channels
    • destroyManager

      public abstract void destroyManager()
      Method that will clean the manager, stopping all the services and unregistering receivers used during the app life cycle
    • restartPlayback

      public abstract void restartPlayback(boolean shouldPlayInStereo, String channelPassword, boolean useLoudspeaker)
      Method which restarts the device playback
      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
    • getCustomButtons

      public abstract List<CustomButton> getCustomButtons()
      Returns the current list of banners from the channel manager
      Returns:
      Current list of banners
    • isCurrentExxtractorVersionGreaterOrEqualThan

      public abstract 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
      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
    • requestPdfDocuments

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

      public abstract void requestOffers(int deviceType, AudioEverywhereResponseHandler handler)
      Method that will request the list of offers from the exxtractor
      Parameters:
      deviceType - Type of device to use for retrieve the list of offers
      handler - handler used to manage the request status
    • updateExtractrLocation

      public abstract void updateExtractrLocation(int deviceType, AudioEverywhereResponseHandler handler)
      Method that will update the exxtractor location based on the request made to it. This request is only available on API v2 environments
      Parameters:
      deviceType - the device type that make the request
      handler - the handler called on complete
    • updateExtractorProfile

      public abstract void updateExtractorProfile(AudioEverywhereResponseHandler handler)
    • mOperatorModeEnabled

      public abstract boolean mOperatorModeEnabled()
    • mOperatorModeEnvironment

      public abstract boolean mOperatorModeEnvironment()
    • mDirtyListeners

      public abstract boolean mDirtyListeners()
      Return a dirty flag to know if there are changes to save in the listeners profiles
    • mSaveOperatorChanges

      public abstract void mSaveOperatorChanges(AudioEverywhereResponseHandler handler)
      Request to update all the privacy changes in the listeners files
    • resetCurrentAudioChannel

      public abstract void resetCurrentAudioChannel()
    • getListenerProfileMenu

      public abstract void getListenerProfileMenu(AudioEverywhereResponseHandler handler)
    • changingAppMode

      public abstract void changingAppMode()
      Must be use when you are changing between real and demo mode; will clean up the streamings for the device
    • connectToServer

      public abstract void connectToServer(String targetVenueServer, int scanTimeout, AudioEverywhereResponseHandler responseHandler)
      Attempts to connect to the audio streaming service at the provided address.
      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 abstract void disconnect()
      Finishes up the connection to an ExXtractor by cleaning up resources associated to it.
    • initializeTelephonyManager

      public abstract void initializeTelephonyManager(android.content.Context context)
      Method that will setup the telephony manager to handle the calls states of the device
      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
    • disconnect

      public abstract void disconnect(StateChangeInformation.ChangeReason reason)
      Finishes up the connection to an ExXtractor by cleaning up resources associated to it. In addition, allows to indicate the reason for the disconnection.
      Parameters:
      reason - An quick explanation for the disconection.
    • saveLastConnectedServer

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

      public abstract String loadLastConnectedServer()
      Loads the last connected venue server.
      Returns:
      The stored value of the last connected venue server, if existing. Otherwise, it returns null.
    • clearLastConnectedServer

      public void clearLastConnectedServer()
      Clears the value of last connected venue server.
    • isDemoModeEnabled

      public abstract boolean isDemoModeEnabled()
      Indicates if the demo mode is enabled or not; this depends if you are using the real or demo implementation
      Returns:
      True if the implementation if for real or demo connection
    • getIsBluetoothConnected

      public abstract boolean getIsBluetoothConnected()
    • setIsBluetoothConnected

      public abstract void setIsBluetoothConnected(boolean mBluetoothConnected)
    • isScanningServiceCleaning

      public abstract boolean isScanningServiceCleaning()
      Method that will return to the caller the status of the cleaning process for the current service
      Returns:
      true if the service is in the cleaning process, false otherwise
    • isPrivateChannelsEnabled

      public abstract boolean isPrivateChannelsEnabled(AudioEverywhereResponseHandler handler)
      Indicates if private channels feature is enabled or not.
      Returns:
      True if private channels is enabled. False if private channels is disabled.
    • isDuplexEnabled

      public abstract boolean isDuplexEnabled()
      Indicates if duplex communication feature is enabled or not.
      Returns:
      True if duplex communication is enabled. False if is disabled.
    • validateIpAddress

      public abstract boolean validateIpAddress(String ip)
      Indicates whether an IP address is valid or not.
      Returns:
      True if the ip address is valid.
    • getHashAlgorithm

      public abstract String getHashAlgorithm()
      Indicates the encryption code that the app will use.
      Returns:
      True if duplex communication is enabled. False if is disabled.
    • setHashAlgorithm

      public abstract void setHashAlgorithm(String hashAlgorithm)
      Sets the value of hashAlgorithm to indicate the new type of encryption.
      Parameters:
      hashAlgorithm - new type of encryption.
    • getUsingHttps

      public abstract boolean getUsingHttps()
      Indicates if the endpoints will use https in the url
      Returns:
      True if endpoints will use https, False for use http.
    • setUsingHttps

      public abstract void setUsingHttps(boolean mUsingHttps)
      Sets the value of usingHttps to indicate if the app will use https or http.
      Parameters:
      mUsingHttps - new state of usingHttps to indicate the protocol type.
    • adminLogin

      public abstract void adminLogin(String password, AudioEverywhereResponseHandler handler)
      Indicates if admin login is successfull or not.
    • operatorModeLogin

      public abstract void operatorModeLogin(String username, String password, AudioEverywhereResponseHandler handler)
      Indicates if operator login is successfull or not.
    • loginUser

      public abstract void loginUser(VenueServerAuthenticator authenticator, AudioEverywhereResponseHandler handler)
      Creates a user session in the venue server.
    • loginOperator

      public abstract void loginOperator(VenueServerAuthenticator authenticator, AudioEverywhereResponseHandler handler)
      Creates a operator session in the venue server.
    • logoutCurrentSession

      public abstract void logoutCurrentSession(AudioEverywhereResponseHandler handler)
      Close the session associated to the current user
    • logoutCurrentUser

      public abstract void logoutCurrentUser(AudioEverywhereResponseHandler handler)
      Destroys session associated to the current user
    • setChannelsPrivacy

      public abstract void setChannelsPrivacy(List<AudioChannel> channels, AudioEverywhereResponseHandler handler)
    • setIsAdminModeEnabled

      public abstract void setIsAdminModeEnabled(boolean isAdminModeEnabled)
      Sets the valud of isAdminModeEnabled to indicate that an admin session is open.
      Parameters:
      isAdminModeEnabled - new state of admin mode feature.
    • getIsAdminModeEnabled

      public abstract boolean getIsAdminModeEnabled()
      Gets the value of isAdminModeEnabled to verify if an admin session is open.
      Returns:
      isAdminModeEnabled value.
    • updatePrivacyChannel

      public abstract void updatePrivacyChannel(AudioChannel audioChannel, boolean setToPrivate)
    • updatePrivacyAllChannels

      public abstract void updatePrivacyAllChannels(List<AudioChannel> channelsList, boolean setToPrivate)
    • getBeaconService

      public abstract BeaconsService getBeaconService()