LineLedControl

Dependencies:   LPD8806 mbed

Fork of LPD8806_Test by Jelmer Tiete

Committer:
sfjmt
Date:
Mon Aug 19 12:14:37 2013 +0000
Revision:
3:b0a1b4b24d3c
LPD8806 control

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sfjmt 3:b0a1b4b24d3c 1
sfjmt 3:b0a1b4b24d3c 2 /*
sfjmt 3:b0a1b4b24d3c 3 Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com)
sfjmt 3:b0a1b4b24d3c 4
sfjmt 3:b0a1b4b24d3c 5 Permission is hereby granted, free of charge, to any person obtaining a copy
sfjmt 3:b0a1b4b24d3c 6 of this software and associated documentation files (the "Software"), to deal
sfjmt 3:b0a1b4b24d3c 7 in the Software without restriction, including without limitation the rights
sfjmt 3:b0a1b4b24d3c 8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
sfjmt 3:b0a1b4b24d3c 9 copies of the Software, and to permit persons to whom the Software is
sfjmt 3:b0a1b4b24d3c 10 furnished to do so, subject to the following conditions:
sfjmt 3:b0a1b4b24d3c 11
sfjmt 3:b0a1b4b24d3c 12 The above copyright notice and this permission notice shall be included in
sfjmt 3:b0a1b4b24d3c 13 all copies or substantial portions of the Software.
sfjmt 3:b0a1b4b24d3c 14
sfjmt 3:b0a1b4b24d3c 15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
sfjmt 3:b0a1b4b24d3c 16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
sfjmt 3:b0a1b4b24d3c 17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
sfjmt 3:b0a1b4b24d3c 18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
sfjmt 3:b0a1b4b24d3c 19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
sfjmt 3:b0a1b4b24d3c 20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
sfjmt 3:b0a1b4b24d3c 21 THE SOFTWARE.
sfjmt 3:b0a1b4b24d3c 22 */
sfjmt 3:b0a1b4b24d3c 23
sfjmt 3:b0a1b4b24d3c 24 /**
sfjmt 3:b0a1b4b24d3c 25 \file Net Service base class header file
sfjmt 3:b0a1b4b24d3c 26 */
sfjmt 3:b0a1b4b24d3c 27
sfjmt 3:b0a1b4b24d3c 28 #ifndef NETSERVICE_H
sfjmt 3:b0a1b4b24d3c 29 #define NETSERVICE_H
sfjmt 3:b0a1b4b24d3c 30
sfjmt 3:b0a1b4b24d3c 31 #include <list>
sfjmt 3:b0a1b4b24d3c 32 using std::list;
sfjmt 3:b0a1b4b24d3c 33
sfjmt 3:b0a1b4b24d3c 34 ///Net Service base class
sfjmt 3:b0a1b4b24d3c 35 /**
sfjmt 3:b0a1b4b24d3c 36 Each connection-oriented object can register as service (by inheriting this class), so that it is polled regularly.
sfjmt 3:b0a1b4b24d3c 37 It notifies the pool when the connection is terminated so that it can be destroyed.
sfjmt 3:b0a1b4b24d3c 38 */
sfjmt 3:b0a1b4b24d3c 39 class NetService
sfjmt 3:b0a1b4b24d3c 40 {
sfjmt 3:b0a1b4b24d3c 41 public:
sfjmt 3:b0a1b4b24d3c 42 ///Instantiates a new service
sfjmt 3:b0a1b4b24d3c 43 /**
sfjmt 3:b0a1b4b24d3c 44 @param owned If true the object is owned by the pool and will be destroyed on closure.
sfjmt 3:b0a1b4b24d3c 45 */
sfjmt 3:b0a1b4b24d3c 46 NetService(bool owned = true); //Is owned by the pool?
sfjmt 3:b0a1b4b24d3c 47 virtual ~NetService();
sfjmt 3:b0a1b4b24d3c 48
sfjmt 3:b0a1b4b24d3c 49 ///This method can be inherited so that it is called on each @a Net::poll() call.
sfjmt 3:b0a1b4b24d3c 50 virtual void poll();
sfjmt 3:b0a1b4b24d3c 51
sfjmt 3:b0a1b4b24d3c 52 static void servicesPoll(); //Poll all registered services & destroy closed ones
sfjmt 3:b0a1b4b24d3c 53
sfjmt 3:b0a1b4b24d3c 54 protected:
sfjmt 3:b0a1b4b24d3c 55 ///This flags the service as to be destructed if owned by the pool.
sfjmt 3:b0a1b4b24d3c 56 void close();
sfjmt 3:b0a1b4b24d3c 57
sfjmt 3:b0a1b4b24d3c 58 private:
sfjmt 3:b0a1b4b24d3c 59 bool m_closed;
sfjmt 3:b0a1b4b24d3c 60 bool m_removed;
sfjmt 3:b0a1b4b24d3c 61 bool m_owned;
sfjmt 3:b0a1b4b24d3c 62
sfjmt 3:b0a1b4b24d3c 63 static list<NetService*>& lpServices(); //Helper to prevent static initialization fiasco
sfjmt 3:b0a1b4b24d3c 64
sfjmt 3:b0a1b4b24d3c 65 };
sfjmt 3:b0a1b4b24d3c 66
sfjmt 3:b0a1b4b24d3c 67 #endif