Class ExxChannelManager
java.lang.Object
com.exxothermic.audioeverywheresdk.ExxChannelManager
- Direct Known Subclasses:
ChannelManager
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 Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected android.content.ServiceConnection
protected android.content.Context
protected AudioChannel
protected Map<String,
AudioChannel> protected String
protected NotificationBuilder
protected String
protected PlaybackService
protected List<CustomButton>
protected DeviceInformation
protected boolean
protected boolean
protected boolean
protected MessagingHelper
protected String
protected android.os.Handler
protected PollingService
protected Profile
protected int
protected ExxtractorWebServiceFactory
protected boolean
protected long
protected long
protected android.os.Handler
protected boolean
protected boolean
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Method that will stop the playback internally, to stop the playback and avoid orphan streams from the app sidevoid
Clear the map of the neighbors and set the current audio channel to nullvoid
Method that will clean up the current playback service on the manager.Method that return the current audio channel, the one that is beginning to playint
Method that gets the current channel index on the channel listabstract List<AudioChannel>
Returns the current list of channelsMethod that will get the current custom button list on the applicationboolean
Gets the value of isAdminModeEnabled to verify if an admin session is open.boolean
Gets the value of mSha1Encryption to verify the type of the encryption that the app should use.getUrlEndpoint
(String ipAddress) Method that will build the endpoint for a retrofit service and validate if should use http or httpsboolean
Indicates if the endpoints will use https in the urlprotected 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.void
initializeTelephonyManager
(android.content.Context context) Method that will setup the telephony manager to handle the calls states of the deviceprotected boolean
Method that will check if the exxtractor IP address is present on the classvoid
If there is a polling service will try to execute the stop methodvoid
Method that will refresh the channel collection manually, forcing a polling to be made to the current connected exxtractorvoid
Method that resets the current Audio channelvoid
If there is a polling service will try to execute the stop method and clean the service.void
restartPlayback
(Boolean shouldPlayInStereo, String channelPassword, boolean useLoudspeaker) Method which restarts the device playbackvoid
setAvailableIpServers
(List<String> mConnectedServers) Sets the Ip list from connected serversvoid
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.void
setControllerAndNotificationText
(String notificationText) Method that will set the notification text for the current channel playback.void
setDeviceInformation
(DeviceInformation deviceInformation) Sets the DeviceInformation instance to be use for this managervoid
setIsAdminModeEnabled
(boolean isAdminModeEnabled) Sets the valud of isAdminModeEnabled to indicate that an admin session is open.void
setmSha1Encryption
(boolean mSha1Encryption) Sets the value of mSha1Encryption to indicate the type of the encryption that the app should use.void
Method that sets the current notification builder on the application.void
setPartnerId
(String mPartnerId) Sets the partner id to be use by this channel managervoid
setProfile
(Profile profile) Sets the listener profile object to be use by this channel managervoid
setUsingHttps
(boolean mUsingHttps) Sets the value of usingHttps to indicate if the app will use https or http.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 networkprotected void
startNewStream
(AudioChannel channel, String notificationContent, boolean inStereo, AudioEverywhereResponseHandler handler, boolean useLoudspeaker) Method that start a new stream for the channel specified as a parameterprotected 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 playbackvoid
startStreamOfChannel
(AudioChannel channel, String stringForNotification, boolean inStereo, AudioEverywhereResponseHandler handler, boolean useLoudspeaker) Entry method that will start a stream of a channel on the app.void
Executes some clean up after the request to stop the demo modevoid
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 inconsistencyvoid
stopStream
(AudioEverywhereResponseHandler handler) Method that will stop the current playing channels on the app.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
-
Field Details
-
mCurrentAudioChannel
-
mContext
protected android.content.Context mContext -
mUiCommuncationHandler
protected android.os.Handler mUiCommuncationHandler -
mPlaybackServiceMessageHandler
protected android.os.Handler mPlaybackServiceMessageHandler -
mCurrentService
-
mCurrentNotificationBuilder
-
mDeviceInformation
-
mPollingService
-
mConnection
protected android.content.ServiceConnection mConnection -
mCurrentAudioChannelMap
-
mNeighborsPreparedForStreaming
-
mCustomButtonList
-
mCurrentExxtractorIp
-
mCurrentNotificationString
-
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
-
mConnectedServers
-
mMessagingHelper
-
mServiceFactory
-
-
Constructor Details
-
ExxChannelManager
public ExxChannelManager()
-
-
Method Details
-
getCurrentChannelList
Returns the current list of channels- Returns:
- List with the current channels
-
setProfile
Sets the listener profile object to be use by this channel manager- Parameters:
profile
- entire listener profile that is using this manager
-
setAvailableIpServers
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
Sets the partner id to be use by this channel manager- Parameters:
mPartnerId
- Id of the Partner that is using this manager
-
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
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
Method that sets the current notification builder on the application. Value may be null- Parameters:
builder
- the builder that will be set
-
setDeviceInformation
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
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 streamedstringForNotification
- the string using for an optional notification on the status barhandler
- 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
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 availablechannelPassword
- 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 channelinStereo
- : If the streaming must be on mono or stereochannelPassword
- 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 requestaudioChannel
- the audio channel that wa used on the requesthandler
- 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 nothingnotificationContent
- the string used for the notification for the channel, if channel is not nullinStereo
- if the channel must be on mono or stereohandler
- the handler that will be used to notify the status of the request
-
getUrlEndpoint
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 playedstringForNotification
- Optional string for the notification on the apphandler
- The handler that will be used to notify the streaming
-