Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Beeper.hh

Go to the documentation of this file.
00001 // $Id: Beeper.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2010
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Thorsten Horstmann <tho@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 #ifndef HH_SENF_Utils_Beeper_
00027 #define HH_SENF_Utils_Beeper_ 1
00028 
00029 // Custom includes
00030 #include <string>
00031 #include <senf/Scheduler/TimerEvent.hh>
00032 
00033 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00034 
00035 namespace senf {
00036 
00048     class Beeper
00049     {
00050     public:
00051         Beeper(std::string const & device = "/dev/console");
00053         ~Beeper();
00054 
00055         void beep_sync(float freq, unsigned length, unsigned count = 1, unsigned delay = 100);
00057 
00062         void beep_async(float freq, unsigned length, unsigned count = 1, unsigned delay = 100);
00064 
00070         void stop_beep();               
00071         bool start_beep(float freq);    
00072 
00076     private:
00077         static const unsigned CLOCK_TICK_RATE = 1193180;
00078 
00079         int fd_;
00080         scheduler::TimerEvent timer_;
00081 
00082 #ifndef DOXYGEN
00083         struct {
00084             float freq;
00085             unsigned length;
00086             unsigned count;
00087             unsigned delay;
00088             bool action;
00089         } params_;
00090 #endif
00091 
00092         void timeout();
00093     };
00094 
00095 }
00096 
00097 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00098 #include "Beeper.cci"
00099 //#include "Beeper.ct"
00100 //#include "Beeper.cti"
00101 #endif
00102 
00103 
00104 // Local Variables:
00105 // mode: c++
00106 // fill-column: 100
00107 // c-file-style: "senf"
00108 // indent-tabs-mode: nil
00109 // ispell-local-dictionary: "american"
00110 // compile-command: "scons -u test"
00111 // comment-column: 40
00112 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research