Class ExxChannelManager

java.lang.Object
com.exxothermic.audioeverywheresdk.ExxChannelManager
Direct Known Subclasses:
ChannelManager

public abstract class ExxChannelManager extends Object
Basic definition of the ChannelManager interface with the require methods to be part of both the real and the demo implementations of this
Since:
07/04/2016
  • Field Details

    • mCurrentAudioChannel

      protected AudioChannel mCurrentAudioChannel
    • mContext

      protected android.content.Context mContext
    • mUiCommuncationHandler

      protected android.os.Handler mUiCommuncationHandler
    • mPlaybackServiceMessageHandler

      protected android.os.Handler mPlaybackServiceMessageHandler
    • mCurrentService

      protected PlaybackService mCurrentService
    • mCurrentNotificationBuilder

      protected NotificationBuilder mCurrentNotificationBuilder
    • mDeviceInformation

      protected DeviceInformation mDeviceInformation
    • mPollingService

      protected PollingService mPollingService
    • mConnection

      protected android.content.ServiceConnection mConnection
    • mCurrentAudioChannelMap

      protected Map<String,AudioChannel> mCurrentAudioChannelMap
    • mNeighborsPreparedForStreaming

      protected Map<String,Boolean> mNeighborsPreparedForStreaming
    • mCustomButtonList

      protected List<CustomButton> mCustomButtonList
    • mCurrentExxtractorIp

      protected String mCurrentExxtractorIp
    • mCurrentNotificationString

      protected String mCurrentNotificationString
    • mPartnerId

      protected String mPartnerId
    • mInDemoMode

      protected boolean mInDemoMode
    • mIsBusy

      protected boolean mIsBusy
    • mIsPlaying

      protected boolean mIsPlaying
    • mUseEthernetforConnection

      protected boolean mUseEthernetforConnection
    • playWhenCallingFinish

      protected boolean playWhenCallingFinish
    • isAdminModeEnabled

      protected boolean isAdminModeEnabled
    • mSha1Encryption

      protected boolean mSha1Encryption
    • mTotalPlaybackTime

      protected long mTotalPlaybackTime
    • mStartDate

      protected long mStartDate
    • mRequestedChannels

      protected int mRequestedChannels
    • mUsingHttps

      protected boolean mUsingHttps
    • mProfile

      protected Profile mProfile
    • mConnectedServers

      protected List<String> mConnectedServers
    • mMessagingHelper

      @Inject protected MessagingHelper mMessagingHelper
    • mServiceFactory

      @Inject protected ExxtractorWebServiceFactory mServiceFactory
  • Constructor Details

    • ExxChannelManager

      public ExxChannelManager()
  • Method Details

    • getCurrentChannelList

      public abstract List<AudioChannel> getCurrentChannelList()
      Returns the current list of channels
      Returns:
      List with the current channels
    • setProfile

      public void setProfile(Profile profile)
      Sets the listener profile object to be use by this channel manager
      Parameters:
      profile - entire listener profile that is using this manager
    • setAvailableIpServers

      public void setAvailableIpServers(List<String> mConnectedServers)
      Sets the Ip list from connected servers
      Parameters:
      mConnectedServers - Ip list from connected servers
    • startChannelScanningFromExxtractorAddress

      public abstract void startChannelScanningFromExxtractorAddress(String exxtractorIpAddress, AudioEverywhereResponseHandler responseHandler, FeaturesHelper.ExxtractorApiVersion exxtractorApiVersion, int deviceType, boolean isPrivateChannelsAvailable)
      Method that will start the synchronization for the channels with the current exxtractor over the network
    • setPartnerId

      public void setPartnerId(String mPartnerId)
      Sets the partner id to be use by this channel manager
      Parameters:
      mPartnerId - Id of the Partner that is using this manager
    • getCurrentAudioChannel

      public AudioChannel getCurrentAudioChannel()
      Method that return the current audio channel, the one that is beginning to play
      Returns:
      the current Audio channel
    • getCurrentChannelIndex

      public int getCurrentChannelIndex()
      Method that gets the current channel index on the channel list
      Returns:
      the current index for the channel list on the current channel list, or -1 if the channel is not found
    • setControllerAndNotificationText

      public void setControllerAndNotificationText(String notificationText)
      Method that will set the notification text for the current channel playback. Used to update the notification on the status bar of the device.

      Note that this will work only if a notification builder was set on the class

      Parameters:
      notificationText - the notification that will be used
    • setNotificationBuilder

      public void setNotificationBuilder(NotificationBuilder builder)
      Method that sets the current notification builder on the application. Value may be null
      Parameters:
      builder - the builder that will be set
    • setDeviceInformation

      public void setDeviceInformation(DeviceInformation deviceInformation)
      Sets the DeviceInformation instance to be use for this manager
      Parameters:
      deviceInformation - DeviceInformation instance to use
    • setUsingHttps

      public 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.
    • getUsingHttps

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

      public void stopStream(AudioEverywhereResponseHandler handler)
      Method that will stop the current playing channels on the app.
      Parameters:
      handler - handler that will be called when the operation is completed
    • startStreamOfChannel

      public void startStreamOfChannel(AudioChannel channel, String stringForNotification, boolean inStereo, AudioEverywhereResponseHandler handler, boolean useLoudspeaker)
      Entry method that will start a stream of a channel on the app. Channel will be streamed from the network
      Parameters:
      channel - the channel that will be streamed
      stringForNotification - the string using for an optional notification on the status bar
      handler - the handler that will be used to notify the streaming
    • pauseScan

      public void pauseScan()
      If there is a polling service will try to execute the stop method
    • resetScan

      public void resetScan()
      If there is a polling service will try to execute the stop method and clean the service.
    • cleanPreparedExxtractors

      public void cleanPreparedExxtractors()
      Clear the map of the neighbors and set the current audio channel to null
    • cleanUpServices

      public void cleanUpServices()
      Method that will clean up the current playback service on the manager. It will stop the current playback and unbind the playback service from the context
    • stopPlaybackWithoutService

      public void stopPlaybackWithoutService()
      Method that will stop the current channel playback, in case that the current service is not running, but the channels report it status as playing, showing an inconsistency
    • resetCurrentAudioChannel

      public void resetCurrentAudioChannel()
      Method that resets the current Audio channel
    • getCustomButtons

      public List<CustomButton> getCustomButtons()
      Method that will get the current custom button list on the application
      Returns:
      the current custom button list
    • setContext

      public void setContext(android.content.Context context)
      Method that will set the context for this class, and use it for the different Context realted operations during the app life.
      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
    • initializeTelephonyManager

      public 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
    • cleanPlaybackStatus

      public void cleanPlaybackStatus()
      Method that will stop the playback internally, to stop the playback and avoid orphan streams from the app side
    • restartPlayback

      public 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
    • stopDemoMode

      public void stopDemoMode()
      Executes some clean up after the request to stop the demo mode
    • refreshCurrentChannelCollection

      public void refreshCurrentChannelCollection()
      Method that will refresh the channel collection manually, forcing a polling to be made to the current connected exxtractor
    • getIsAdminModeEnabled

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

      public 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.
    • getmSha1Encryption

      public boolean getmSha1Encryption()
      Gets the value of mSha1Encryption to verify the type of the encryption that the app should use.
      Returns:
      isSha1EncryptionType value.
    • setmSha1Encryption

      public void setmSha1Encryption(boolean mSha1Encryption)
      Sets the value of mSha1Encryption to indicate the type of the encryption that the app should use.
      Parameters:
      mSha1Encryption - new state of encryption type.
    • startStreamingPlayback

      protected void startStreamingPlayback(String notificationContent, boolean inStereo, String channelPassword, boolean useLoudspeaker)
      Method that will start the streaming for the app side, starting the decoder and the thread for the playback
      Parameters:
      notificationContent - the string used for the notification for the channel
      inStereo - : If the streaming must be on mono or stereo
      channelPassword - Password of the current channel
    • handleHttpErrorForPlaybackOperation

      protected void handleHttpErrorForPlaybackOperation(ServiceException error, AudioChannel audioChannel, AudioEverywhereResponseHandler handler)
      Method that will handle, and notify, when a reqeust for playback has failed to start or stop the streaming from the current channel.
      Parameters:
      error - service error throw by the request
      audioChannel - the audio channel that wa used on the request
      handler - the handler that need to be called when the error finish the processing
    • isExxtractorIpPresent

      protected boolean isExxtractorIpPresent()
      Method that will check if the exxtractor IP address is present on the class
      Returns:
      true if the IP is present, false otherwise
    • startNewStream

      protected void startNewStream(AudioChannel channel, String notificationContent, boolean inStereo, AudioEverywhereResponseHandler handler, boolean useLoudspeaker)
      Method that start a new stream for the channel specified as a parameter
      Parameters:
      channel - the channel that will be streamed. If null, the method does nothing
      notificationContent - the string used for the notification for the channel, if channel is not null
      inStereo - if the channel must be on mono or stereo
      handler - the handler that will be used to notify the status of the request
    • getUrlEndpoint

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

      public void stopStreamingWithChannel(AudioChannel audioChannel, String stringForNotification, boolean inStereo, AudioEverywhereResponseHandler handler, boolean useLoudspeaker)
      Method that will stop an streaming, replacing it with the channel given as a parameter
      Parameters:
      audioChannel - the channel that will be played after the streaming is stopped. If null, the stream will be stopped and no other channel will be played
      stringForNotification - Optional string for the notification on the app
      handler - The handler that will be used to notify the streaming