Class ExxConnection
java.lang.Object
com.exxothermic.audioeverywheresdk.ExxConnection
- Direct Known Subclasses:
ExxtractorConnection
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 Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
static final int
protected android.content.ServiceConnection
protected android.content.Context
protected ExxChannelManager
protected String
protected String
protected FeaturesHelper
protected StateChangeInformation.ManagerState
protected BeaconsService
protected boolean
protected int
protected Location
protected MessagingHelper
protected boolean
protected String
protected Profile
protected int
protected boolean
protected int
protected int
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
adminLogin
(String password, AudioEverywhereResponseHandler handler) Indicates if admin login is successfull or not.boolean
If the current state is connected or polling will try to return if all the features are enable or notboolean
If the current state is connected or polling will try to return if there are files from the current feature helperboolean
If the current state is connected or polling will try to return if there are offers from the current feature helperabstract void
Must be use when you are changing between real and demo mode; will clean up the streamings for the deviceprotected boolean
Checks if there is a connection, if not then throw an Exceptionvoid
Clears the value of last connected venue server.abstract void
connectToServer
(String targetVenueServer, int scanTimeout, AudioEverywhereResponseHandler responseHandler) Attempts to connect to the audio streaming service at the provided address.abstract void
Method that will clean the manager, stopping all the services and unregistering receivers used during the app life cycleabstract void
Finishes up the connection to an ExXtractor by cleaning up resources associated to it.abstract void
Finishes up the connection to an ExXtractor by cleaning up resources associated to it.protected String
Generates a random string with a size of MAGIC_LENGTH and with letters between a and zabstract BeaconsService
abstract List<AudioChannel>
Returns the current list of channels from the channel managerReturns the current connected servers listMethod that will return the current Audio channel that is playing from the SDKint
Returns the index on the list of the current channelReturns the mCurrentExxtractorAddress property valueReturns the current version of the connected ExXtractorMethod that will return the current manager state for the SDKabstract List<CustomButton>
Returns the current list of banners from the channel managerint
Returns the mExxtractorsSeen property valueabstract String
Indicates the encryption code that the app will use.abstract boolean
Gets the value of isAdminModeEnabled to verify if an admin session is open.abstract boolean
abstract void
Returns the current Location definitionReturns the current profileint
Returns the mRequestedChannels property valueint
Returns the mSeenChannels property valueint
Returns the mTotalPlaybackTime property valueabstract boolean
Indicates if the endpoints will use https in the urlabstract void
initializeTelephonyManager
(android.content.Context context) Method that will setup the telephony manager to handle the calls states of the deviceboolean
Indicates if the current connection to an ExXtractor is established or notabstract 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 otherabstract boolean
Indicates if the demo mode is enabled or not; this depends if you are using the real or demo implementationboolean
Indicates if the demo transition is set to true or notabstract boolean
Indicates if duplex communication feature is enabled or not.boolean
If the current state is connected or polling will try to return if the Location is enabled or notboolean
If the current state is connected or polling will try to return if the partner information is enabledabstract boolean
Indicates if private channels feature is enabled or not.abstract boolean
Method that will return to the caller the status of the cleaning process for the current serviceboolean
Returns the current configuration of the scanOverEthernet option at the current ExXtractor connectionabstract String
Loads the last connected venue server.abstract void
loginOperator
(VenueServerAuthenticator authenticator, AudioEverywhereResponseHandler handler) Creates a operator session in the venue server.abstract void
loginUser
(VenueServerAuthenticator authenticator, AudioEverywhereResponseHandler handler) Creates a user session in the venue server.abstract void
Close the session associated to the current userabstract void
Destroys session associated to the current userabstract boolean
Return a dirty flag to know if there are changes to save in the listeners profilesabstract boolean
abstract boolean
abstract void
Request to update all the privacy changes in the listeners filesabstract void
operatorModeLogin
(String username, String password, AudioEverywhereResponseHandler handler) Indicates if operator login is successfull or not.abstract void
Method that will pause the scan for this service, so no activity is done until AudioEverywhere#scan() is calledabstract void
Tries to refresh the list of channelsvoid
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)void
registerRemoteControlReceiver
(android.content.BroadcastReceiver receiver) Method that will register the remote control receiverabstract void
requestOffers
(int deviceType, AudioEverywhereResponseHandler handler) Method that will request the list of offers from the exxtractorabstract void
Method that will request a channel playback from a exxtractor, using a channel and a notification for thisabstract void
abstract void
restartPlayback
(boolean shouldPlayInStereo, String channelPassword, boolean useLoudspeaker) Method which restarts the device playbackabstract void
saveLastConnectedServer
(String targetVenueServer) Stores the provided target venue server for future use.abstract void
scanNetworkForExxtractors
(int scanTimeout, AudioEverywhereResponseHandler responseHandler) Method that will start the scanning for Exxtractors.protected void
sendServiceStatusChange
(StateChangeInformation.ManagerState newState, StateChangeInformation.ChangeReason reason) Method that changes the state of the service, notifying about the changeabstract void
setChannelsPrivacy
(List<AudioChannel> channels, AudioEverywhereResponseHandler handler) void
setDemoTransition
(boolean transition) Sets the demoModeTransition propertyabstract void
setHashAlgorithm
(String hashAlgorithm) Sets the value of hashAlgorithm to indicate the new type of encryption.abstract void
setIsAdminModeEnabled
(boolean isAdminModeEnabled) Sets the valud of isAdminModeEnabled to indicate that an admin session is open.abstract void
setIsBluetoothConnected
(boolean mBluetoothConnected) protected void
Sets the new state depending of the current statevoid
Sets the Notification object to be usevoid
setPartnerId
(String partnerId) Sets the mPartnerId property for this class and for the mCurrentChannelManagervoid
setProfile
(Profile profile) Modify the profileabstract void
setUsingHttps
(boolean mUsingHttps) Sets the value of usingHttps to indicate if the app will use https or http.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_UPDATEDabstract void
startSyncingChannelWithExxtractor
(int deviceType) Starts the scanning of the audio channels from the current ExXtractor connectionvoid
Method that will stop any playback state that may be running without services.abstract void
stopStream
(AudioEverywhereResponseHandler handler) Tries to stop the current streaming if exists and the connection is establishedvoid
unregisterBroadcastReceiver
(android.content.BroadcastReceiver toUnregister) Unregisters the broadcast receiverabstract void
abstract void
updateExtractrLocation
(int deviceType, AudioEverywhereResponseHandler handler) Method that will update the exxtractor location based on the request made to it.void
updateNotificationAndRemoteControlText
(String notificationText) Updates the notification format to be use for channel descriptionabstract void
updatePrivacyAllChannels
(List<AudioChannel> channelsList, boolean setToPrivate) abstract void
updatePrivacyChannel
(AudioChannel audioChannel, boolean setToPrivate) abstract boolean
Indicates whether an IP address is valid or not.
-
Field Details
-
MAGIC_LENGTH
public static final int MAGIC_LENGTH- See Also:
-
mCurrentManagerState
-
mCurrentChannelManager
-
mLocation
-
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
-
mPartnerId
-
mCurrentExxtractorAddress
-
mExxtractorsSeen
protected int mExxtractorsSeen -
mSeenChannels
protected int mSeenChannels -
mRequestedChannels
protected int mRequestedChannels -
mTotalPlaybackTime
protected int mTotalPlaybackTime -
mProfile
-
mConnectedServers
-
mContext
protected android.content.Context mContext -
mCurrentService
-
mConnection
protected android.content.ServiceConnection mConnection -
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
Method that will return the current Audio channel that is playing from the SDK- Returns:
- the current Audio Channel
-
setNotificationBuilder
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
Returns the current Location definition- Returns:
- Location object of the current connection
-
getProfile
Returns the current profile- Returns:
- profile from exxtractor
-
getConnectedServers
Returns the current connected servers list- Returns:
- connected server list
-
setProfile
Modify the profile- Parameters:
profile
-
-
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
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
Returns the mCurrentExxtractorAddress property value- Returns:
- property value
-
setPartnerId
Sets the mPartnerId property for this class and for the mCurrentChannelManager- Parameters:
partnerId
- Id of the partner to set
-
updateNotificationAndRemoteControlText
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 servicereason
- 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
Generates a random string with a size of MAGIC_LENGTH and with letters between a and z- Returns:
- Random String
-
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 serviceresponseHandler
- 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 streamingstringForNotification
- Notification format to be use when the streaming startsinStereo
- Indicates if the streaming must start in Stereo or nothandler
- Handler to use for process the result
-
stopStream
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 availablechannelPassword
- Password of the current channeluseLoudspeaker
- Indicates that the audio should be played from the loudspeaker
-
getCustomButtons
Returns the current list of banners from the channel manager- Returns:
- Current list of banners
-
isCurrentExxtractorVersionGreaterOrEqualThan
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
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
Method that will request the list of offers from the exxtractor- Parameters:
deviceType
- Type of device to use for retrieve the list of offershandler
- handler used to manage the request status
-
updateExtractrLocation
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 requesthandler
- the handler called on complete
-
updateExtractorProfile
-
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
Request to update all the privacy changes in the listeners files -
resetCurrentAudioChannel
public abstract void resetCurrentAudioChannel() -
getListenerProfileMenu
-
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
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
Stores the provided target venue server for future use.- Parameters:
targetVenueServer
- The target venue server's hostname or CNAME.
-
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
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
Indicates whether an IP address is valid or not.- Returns:
- True if the ip address is valid.
-
getHashAlgorithm
Indicates the encryption code that the app will use.- Returns:
- True if duplex communication is enabled. False if is disabled.
-
setHashAlgorithm
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
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
Close the session associated to the current user -
logoutCurrentUser
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
-
updatePrivacyAllChannels
public abstract void updatePrivacyAllChannels(List<AudioChannel> channelsList, boolean setToPrivate) -
getBeaconService
-