PIR Library  2
 All Classes Files Functions Variables Typedefs Macros Pages
ipir.h
1 /*
2 
3 PIR-1/PIR-4 Driver v2
4 
5 Copyright (c) 2014, Promixis, LLC
6 All rights reserved.
7 
8 Redistribution and use in source and binary forms, with or
9 without modification, are permitted provided that the
10 following conditions are met:
11 
12 1. Redistributions of source code must retain the above
13 copyright notice, this list of conditions and the following
14 disclaimer.
15 
16 2. Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the following
18 disclaimer in the documentation and/or other materials
19 provided with the distribution.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
22 CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
23 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
26 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
33 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 
36 */
37 
38 #ifndef IPIR_H
39 #define IPIR_H
40 
41 #include <string>
42 #include <memory>
43 
47 class IPIR
48 {
49 public:
50  IPIR();
51  virtual ~IPIR();
52 
54  enum Type { PIR1, PIR4 };
55 
62  virtual std::string serial() const = 0;
68  virtual unsigned int version() const = 0;
69 
85  virtual bool sendCCF(const std::string ccf, unsigned char bitmask, unsigned char repeats) = 0;
89  virtual bool blink(unsigned char count) = 0;
93  virtual Type type() const = 0;
94 
98  virtual bool learn() = 0;
102  virtual bool cancelLearn() = 0;
103 };
104 
108 typedef std::shared_ptr<IPIR>IPIRPtr;
109 
110 #endif // IPIR_H
virtual bool blink(unsigned char count)=0
blinks the LED on the PIR-1
virtual bool sendCCF(const std::string ccf, unsigned char bitmask, unsigned char repeats)=0
sends CCF code.
The PIR interface class.
Definition: ipir.h:47
virtual unsigned int version() const =0
Returns the firmware version number.
virtual std::string serial() const =0
Returns the serial number.
virtual bool learn()=0
starts learn mode on a PIR-1
virtual Type type() const =0
returns the Type of the PIR
virtual bool cancelLearn()=0
ends learn mode on a PIR-1