michael@0: /* Copyright 2012 Mozilla Foundation and Mozilla contributors michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: #ifndef mozilla_dom_system_b2g_audiomanager_h__ michael@0: #define mozilla_dom_system_b2g_audiomanager_h__ michael@0: michael@0: #include "mozilla/Observer.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsIAudioManager.h" michael@0: #include "nsIObserver.h" michael@0: #include "AudioChannelAgent.h" michael@0: #include "android_audio/AudioSystem.h" michael@0: michael@0: // {b2b51423-502d-4d77-89b3-7786b562b084} michael@0: #define NS_AUDIOMANAGER_CID {0x94f6fd70, 0x7615, 0x4af9, \ michael@0: {0x89, 0x10, 0xf9, 0x3c, 0x55, 0xe6, 0x62, 0xec}} michael@0: #define NS_AUDIOMANAGER_CONTRACTID "@mozilla.org/telephony/audiomanager;1" michael@0: michael@0: namespace mozilla { michael@0: namespace hal { michael@0: class SwitchEvent; michael@0: typedef Observer SwitchObserver; michael@0: } // namespace hal michael@0: michael@0: namespace dom { michael@0: namespace gonk { michael@0: class RecoverTask; michael@0: class AudioChannelVolInitCallback; michael@0: class AudioManager : public nsIAudioManager michael@0: , public nsIObserver michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIAUDIOMANAGER michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: AudioManager(); michael@0: ~AudioManager(); michael@0: michael@0: // When audio backend is dead, recovery task needs to read all volume michael@0: // settings then set back into audio backend. michael@0: friend class RecoverTask; michael@0: friend class AudioChannelVolInitCallback; michael@0: michael@0: protected: michael@0: int32_t mPhoneState; michael@0: int mCurrentStreamVolumeTbl[AUDIO_STREAM_CNT]; michael@0: michael@0: nsresult SetStreamVolumeIndex(int32_t aStream, int32_t aIndex); michael@0: nsresult GetStreamVolumeIndex(int32_t aStream, int32_t *aIndex); michael@0: michael@0: private: michael@0: nsAutoPtr mObserver; michael@0: nsCOMPtr mPhoneAudioAgent; michael@0: #ifdef MOZ_B2G_RIL michael@0: bool mMuteCallToRIL; michael@0: // mIsMicMuted is only used for toggling mute call to RIL. michael@0: bool mIsMicMuted; michael@0: #endif michael@0: michael@0: void HandleBluetoothStatusChanged(nsISupports* aSubject, michael@0: const char* aTopic, michael@0: const nsCString aAddress); michael@0: }; michael@0: michael@0: } /* namespace gonk */ michael@0: } /* namespace dom */ michael@0: } /* namespace mozilla */ michael@0: michael@0: #endif // mozilla_dom_system_b2g_audiomanager_h__