00001 00012 /* 00013 00014 Copyright (c) 2007, Tim Burrell 00015 Licensed under the Apache License, Version 2.0 (the "License"); 00016 you may not use this file except in compliance with the License. 00017 You may obtain a copy of the License at 00018 00019 http://www.apache.org/licenses/LICENSE-2.0 00020 00021 Unless required by applicable law or agreed to in writing, software 00022 distributed under the License is distributed on an "AS IS" BASIS, 00023 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00024 See the License for the specific language governing permissions and 00025 limitations under the License. 00026 00027 */ 00028 00029 #ifndef __AlsaEvent_h 00030 #define __AlsaEvent_h 00031 00032 #if HAVE_CONFIG_H 00033 #include "config.h" 00034 #endif 00035 00036 #include <string> 00037 #include <vector> 00038 #include <alsa/asoundlib.h> 00039 #include <boost/shared_ptr.hpp> 00040 #include <boost/archive/text_oarchive.hpp> 00041 #include <boost/archive/text_iarchive.hpp> 00042 #include <boost/serialization/base_object.hpp> 00043 00045 // Namespace 00047 00048 namespace Gizmod { 00049 00051 // Typedefs 00053 00058 typedef enum { 00059 ALSAEVENT_ERROR, 00060 ALSAEVENT_SOUNDCARD_ATTACH, 00061 ALSAEVENT_SOUNDCARD_DETACH, 00062 ALSAEVENT_MIXERELEMENT_ATTACH, 00063 ALSAEVENT_MIXERELEMENT_CHANGE, 00064 ALSAEVENT_MIXERELEMENT_DETACH 00065 } AlsaEventType; 00066 00068 // AlsaEvent Class Definition 00070 00075 class AlsaEvent { 00076 public: 00077 // public member variables 00078 AlsaEventType Type; 00079 unsigned int Mask; 00080 00081 // event variables 00082 bool IsActiveChanged; 00083 bool ElementsChanged; 00084 bool VolumePlaybackChanged; 00085 bool VolumeCaptureChanged; 00086 bool SwitchPlaybackChanged; 00087 bool SwitchCaptureChanged; 00088 00089 // public functions 00090 00091 // construction / deconstruction 00092 AlsaEvent(); 00093 AlsaEvent(AlsaEventType type, unsigned int mask = 0); 00094 AlsaEvent(AlsaEvent const & Event); 00095 virtual ~AlsaEvent(); 00096 00097 private: 00098 // private functions 00099 00100 // private member variables 00101 00102 private: 00103 // serialization 00104 friend class boost::serialization::access; 00105 template<class Archive> 00106 void serialize(Archive & ar, const unsigned int version) { 00107 ar & Type; 00108 ar & Mask; 00109 ar & IsActiveChanged; 00110 ar & ElementsChanged; 00111 ar & VolumePlaybackChanged; 00112 ar & VolumeCaptureChanged; 00113 ar & SwitchPlaybackChanged; 00114 ar & SwitchCaptureChanged; 00115 } 00116 }; 00117 00119 00120 } // Gizmod namespace 00121 00122 #endif // __AlsaEvent_h