Class ExxtractorConnection
java.lang.Object
com.exxothermic.audioeverywheresdk.ExxConnection
com.exxothermic.audioeverywheresdk.ExxtractorConnection
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Inner class which handles the jmdns events -
Field Summary
FieldsFields inherited from class com.exxothermic.audioeverywheresdk.ExxConnection
demoModeTransition, headsetConnected, MAGIC_LENGTH, mConnection, mContext, mCurrentChannelManager, mCurrentExxtractorAddress, mCurrentExxtractorVersion, mCurrentFeatureHelper, mCurrentManagerState, mCurrentService, mEthernetConnectionDetected, mExxtractorsSeen, mLocation, mMessagingHelper, mNetworkHandlerAlreadyCalled, mPartnerId, mRequestedChannels, mScanOverEthernet, mSeenChannels, mTotalPlaybackTime, mWifiConnectionDetected
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor, used to set a connection to the box without allowing the ethernet ports on the devicesExxtractorConnection
(boolean withEthernetScan) Returns new Exxtractor Connection for any application to use.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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
adminLogin
(String password, AudioEverywhereResponseHandler handler) Indicates if admin login is successfull or not.void
void
void
Must be use when you are changing between real and demo mode; will clean up the streamings for the devicevoid
void
connectToServer
(String targetVenueServer, int scanTimeout, AudioEverywhereResponseHandler responseHandler) Attempts to connect to the audio streaming service at the provided address.boolean
connectToService
(String address, String version, AudioEverywhereResponseHandler responseHandler, int scanTimeout) void
Method that will clean the manager, stopping all the services and unregistering receivers used during the app life cyclevoid
Finishes up the connection to an ExXtractor by cleaning up resources associated to it.void
Finishes up the connection to an ExXtractor by cleaning up resources associated to it.Returns the current list of channels from the channel managerstatic ServicesComponent
Returns the current connected servers listReturns the current list of banners from the channel managerIndicates the encryption code that the app will use.static ExxtractorConnection
Method that will return the shared instance for this manager, if exists.boolean
Gets the value of isAdminModeEnabled to verify if an admin session is open.boolean
void
Returns the current profilevoid
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 urlvoid
Method that will handle a Wifi Error on the library.void
handleSuccessfulLocation
(Location location, AudioEverywhereResponseHandler handler) void
initializeTelephonyManager
(android.content.Context context) Method that will setup the telephony manager to handle the calls states of the deviceboolean
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 otherboolean
Indicates if the demo mode is enabled or not; this depends if you are using the real or demo implementationboolean
Indicates if duplex communication feature is enabled or not.boolean
Indicates if private channels feature is enabled or not.boolean
Method that will return to the caller the status of the cleaning process for the current servicevoid
Loads the last connected venue server.void
loginOperator
(VenueServerAuthenticator authenticator, AudioEverywhereResponseHandler handler) Creates a operator session in the venue server.void
loginOperatorFromAllServers
(String ipAddress) void
loginUser
(VenueServerAuthenticator authenticator, AudioEverywhereResponseHandler handler) Creates a user session in the venue server.void
Close the session associated to the current uservoid
Destroys session associated to the current userboolean
Return a dirty flag to know if there are changes to save in the listeners profilesboolean
boolean
void
Request to update all the privacy changes in the listeners filesvoid
mSaveReceiverFiles
(Map.Entry<String, Token> entry, AudioEverywhereResponseHandler handler) void
mSaveUnitFiles
(Map.Entry<String, Token> entry, AudioEverywhereResponseHandler handler) void
mSaveVenueFiles
(Map.Entry<String, Token> entry, AudioEverywhereResponseHandler handler) void
operatorModeLogin
(String username, String password, AudioEverywhereResponseHandler handler) Indicates if operator login is successfull or not.void
Method that will pause the scan for this service, so no activity is done until AudioEverywhere#scan() is calledvoid
Tries to refresh the list of channelsvoid
requestListenerMobile
(String leid) void
void
requestOffers
(int deviceType, AudioEverywhereResponseHandler handler) Method that will request the list of offers from the exxtractorvoid
Method that will request a channel playback from a exxtractor, using a channel and a notification for thisvoid
requestUnitsConfigsFile
(String ipAddress, Token token) void
requestVenuesConfigsFile
(String ipAddress, Token token) void
void
restartPlayback
(boolean shouldPlayInStereo, String channelPassword, boolean useLoudspeaker) Method which restarts the device playbackvoid
saveLastConnectedServer
(String targetVenueServer) Stores the provided target venue server for future use.void
scanNetworkForExxtractors
(int scanTimeout, AudioEverywhereResponseHandler responseHandler) Method that will start the scanning for Exxtractors.void
setChannelsPrivacy
(List<AudioChannel> channels, AudioEverywhereResponseHandler handler) void
setContext
(android.content.Context context) Method that will set the current context for the SDKvoid
setHashAlgorithm
(String hashAlgorithmType) Sets the value of hashAlgorithm to indicate the new type of encryption.void
setIsAdminModeEnabled
(boolean isAdminModeEnabled) Sets the valud of isAdminModeEnabled to indicate that an admin session is open.void
setIsBluetoothConnected
(boolean mBluetoothConnected) void
setProfile
(Profile profile) Modify the profilevoid
setUsingHttps
(boolean mUsingHttps) Sets the value of usingHttps to indicate if the app will use https or http.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_UPDATEDvoid
startSyncingChannelWithExxtractor
(int deviceType) Starts the scanning of the audio channels from the current ExXtractor connectionvoid
stopStream
(AudioEverywhereResponseHandler handler) Tries to stop the current streaming if exists and the connection is establishedvoid
For profile: uses the web service to retrive the info and save itvoid
updateExtractrLocation
(int deviceType, AudioEverywhereResponseHandler handler) Method that will update the exxtractor location based on the request made to it.void
updateListenerMobileApp
(Token token, String ipServer, Profile profile, AudioEverywhereResponseHandler handlerProfile) void
updateListenerReceiver
(Token token, String ipServer, ReceiverConf receiver, AudioEverywhereResponseHandler handlerReceiver) void
updatePrivacyAllChannels
(List<AudioChannel> channelsList, boolean setToPrivate) void
updatePrivacyChannel
(AudioChannel audioChannel, boolean setToPrivate) void
updateUnitConf
(Token token, String ipServer, UnitConf unit, AudioEverywhereResponseHandler handlerUnit) void
updateVenueConf
(Token token, String ipServer, VenueConf venue, AudioEverywhereResponseHandler handlerVenue) boolean
Indicates whether an IP address is valid or not.Methods inherited from class com.exxothermic.audioeverywheresdk.ExxConnection
areAllFeaturesEnabled, areFilesEnabled, areOffersAvailable, checkIfClientIsConnected, clearLastConnectedServer, generateRandomMagicForInstallation, getCurrentAudioChannel, getCurrentChannelIndex, getCurrentExxtractorAddress, getCurrentExxtractorVersion, getCurrentManagerState, getExxtractorsSeen, getLocation, getRequestedChannels, getSeenChannels, getTotalPlaybackTime, isConnected, isDemoTransition, isLocationEnabled, isPartnerInformationAvailable, isScanOverEthernet, registerBroadcastReceiver, registerRemoteControlReceiver, sendServiceStatusChange, setDemoTransition, setNewState, setNotificationBuilder, setPartnerId, stopPlaybackWithoutService, unregisterBroadcastReceiver, updateNotificationAndRemoteControlText
-
Field Details
-
PREFERENCES_FILE_NAME
- See Also:
-
ID_FIELD_NAME
- See Also:
-
LAST_CONNECTED_SERVER_ID
- See Also:
-
-
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
-
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 classExxConnection
- 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 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 classExxConnection
-
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 classExxConnection
- 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
Description copied from class:ExxConnection
Tries to stop the current streaming if exists and the connection is established- Specified by:
stopStream
in classExxConnection
- 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 classExxConnection
- 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 classExxConnection
-
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 classExxConnection
-
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 classExxConnection
- 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
-
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
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 classExxConnection
- Parameters:
handler
- handler used to manage the request status
-
requestOffers
Description copied from class:ExxConnection
Method that will request the list of offers from the exxtractor- Specified by:
requestOffers
in classExxConnection
- Parameters:
deviceType
- Type of device to use for retrieve the list of offershandler
- handler used to manage the request status
-
validateIpAddress
Description copied from class:ExxConnection
Indicates whether an IP address is valid or not.- Specified by:
validateIpAddress
in classExxConnection
- Returns:
- True if the ip address is valid.
-
updateExtractorProfile
For profile: uses the web service to retrive the info and save it- Specified by:
updateExtractorProfile
in classExxConnection
-
getServerInfo
public void getServerInfo() -
mOperatorModeEnvironment
public boolean mOperatorModeEnvironment()- Specified by:
mOperatorModeEnvironment
in classExxConnection
-
mOperatorModeEnabled
public boolean mOperatorModeEnabled()- Specified by:
mOperatorModeEnabled
in classExxConnection
-
mDirtyListeners
public boolean mDirtyListeners()Return a dirty flag to know if there are changes to save in the listeners profiles- Specified by:
mDirtyListeners
in classExxConnection
-
getChannelList
Description copied from class:ExxConnection
Returns the current list of channels from the channel manager- Specified by:
getChannelList
in classExxConnection
- Returns:
- Current list of channels
-
checkAvailableServers
public void checkAvailableServers() -
resetCurrentAudioChannel
public void resetCurrentAudioChannel()- Specified by:
resetCurrentAudioChannel
in classExxConnection
-
askForProfileUpdate
public void askForProfileUpdate() -
getListenerProfileMenu
- Specified by:
getListenerProfileMenu
in classExxConnection
-
updateExtractrLocation
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 classExxConnection
- Parameters:
deviceType
- the device type that make the requesthandler
- the handler called on complete
-
handleSuccessfulLocation
-
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 classExxConnection
-
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 classExxConnection
- 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 classExxConnection
-
disconnect
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 classExxConnection
- Parameters:
reason
- An quick explanation for the disconection.
-
getIsBluetoothConnected
public boolean getIsBluetoothConnected()- Specified by:
getIsBluetoothConnected
in classExxConnection
-
setIsBluetoothConnected
public void setIsBluetoothConnected(boolean mBluetoothConnected) - Specified by:
setIsBluetoothConnected
in classExxConnection
-
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 classExxConnection
- Returns:
- True if the implementation if for real or demo connection
-
getProfile
Description copied from class:ExxConnection
Returns the current profile- Overrides:
getProfile
in classExxConnection
- Returns:
- profile from exxtractor
-
getConnectedServers
Description copied from class:ExxConnection
Returns the current connected servers list- Overrides:
getConnectedServers
in classExxConnection
- Returns:
- connected server list
-
setProfile
Description copied from class:ExxConnection
Modify the profile- Overrides:
setProfile
in classExxConnection
-
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 classExxConnection
- Returns:
- true if the service is in the cleaning process, false otherwise
-
isPrivateChannelsEnabled
Description copied from class:ExxConnection
Indicates if private channels feature is enabled or not.- Specified by:
isPrivateChannelsEnabled
in classExxConnection
- 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 classExxConnection
- Returns:
- True if duplex communication is enabled. False if is disabled.
-
getHashAlgorithm
Description copied from class:ExxConnection
Indicates the encryption code that the app will use.- Specified by:
getHashAlgorithm
in classExxConnection
- Returns:
- True if duplex communication is enabled. False if is disabled.
-
setHashAlgorithm
Description copied from class:ExxConnection
Sets the value of hashAlgorithm to indicate the new type of encryption.- Specified by:
setHashAlgorithm
in classExxConnection
- 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 classExxConnection
- 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 classExxConnection
- 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 classExxConnection
- 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 classExxConnection
- Parameters:
isAdminModeEnabled
- new state of admin mode feature.
-
adminLogin
Description copied from class:ExxConnection
Indicates if admin login is successfull or not.- Specified by:
adminLogin
in classExxConnection
-
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 classExxConnection
-
logoutCurrentSession
Description copied from class:ExxConnection
Close the session associated to the current user- Specified by:
logoutCurrentSession
in classExxConnection
-
logoutCurrentUser
Description copied from class:ExxConnection
Destroys session associated to the current user- Specified by:
logoutCurrentUser
in classExxConnection
-
setChannelsPrivacy
- Specified by:
setChannelsPrivacy
in classExxConnection
-
getCustomButtons
Description copied from class:ExxConnection
Returns the current list of banners from the channel manager- Specified by:
getCustomButtons
in classExxConnection
- 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 classExxConnection
- 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
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 classExxConnection
- 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
Stores the provided target venue server for future use.- Specified by:
saveLastConnectedServer
in classExxConnection
- Parameters:
targetVenueServer
- The target venue server's hostname or CNAME.
-
loadLastConnectedServer
Loads the last connected venue server.- Specified by:
loadLastConnectedServer
in classExxConnection
- 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 classExxConnection
-
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 classExxConnection
-
LoadConfigsFilesFromServer
public void LoadConfigsFilesFromServer() -
loginOperatorFromAllServers
-
requestVenuesConfigsFile
-
requestUnitsConfigsFile
-
requestListenerMobile
-
requestListenerReceiver
-
updatePrivacyChannel
- Specified by:
updatePrivacyChannel
in classExxConnection
-
updatePrivacyAllChannels
- Specified by:
updatePrivacyAllChannels
in classExxConnection
-
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
Description copied from class:ExxConnection
Request to update all the privacy changes in the listeners files- Specified by:
mSaveOperatorChanges
in classExxConnection
-
mSaveReceiverFiles
public void mSaveReceiverFiles(Map.Entry<String, Token> entry, AudioEverywhereResponseHandler handler) -
mSaveUnitFiles
-
mSaveVenueFiles
-
bumpListenerVersion
public void bumpListenerVersion() -
getBeaconService
- Specified by:
getBeaconService
in classExxConnection
-