Arduino driver library for Decawave DW1000  Dec 20 2016
DW1000Device.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 by Thomas Trojer <thomas@trojer.net> and Leopold Sayous <leosayous@gmail.com>
3  * Decawave DW1000 library for arduino.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * @file DW1000Device.h
18  * Arduino global library (header file) working with the DW1000 library
19  * for the Decawave DW1000 UWB transceiver IC.
20  *
21  * @todo complete this class
22  */
23 
24 
25 #define INACTIVITY_TIME 1000
26 
27 #ifndef _DW1000Device_H_INCLUDED
28 #define _DW1000Device_H_INCLUDED
29 
30 #include "DW1000Time.h"
31 #include "DW1000Mac.h"
32 
33 class DW1000Mac;
34 
35 class DW1000Device;
36 
37 class DW1000Device {
38 public:
39  //Constructor and destructor
40  DW1000Device();
41  DW1000Device(byte address[], byte shortAddress[]);
42  DW1000Device(byte address[], boolean shortOne = false);
43  ~DW1000Device();
44 
45  //setters:
46  void setReplyTime(uint16_t replyDelayTimeUs);
47  void setAddress(char address[]);
48  void setAddress(byte* address);
49  void setShortAddress(byte address[]);
50 
51  void setRange(float range);
52  void setRXPower(float power);
53  void setFPPower(float power);
54  void setQuality(float quality);
55 
56  void setReplyDelayTime(int16_t time) { _replyDelayTimeUS = time; }
57 
58  void setIndex(int8_t index) { _index = index; }
59 
60  //getters
61  uint16_t getReplyTime() { return _replyDelayTimeUS; }
62 
63  byte* getByteAddress();
64 
65  int8_t getIndex() { return _index; }
66 
67  //String getAddress();
68  byte* getByteShortAddress();
69  uint16_t getShortAddress();
70  //String getShortAddress();
71 
72  float getRange();
73  float getRXPower();
74  float getFPPower();
75  float getQuality();
76 
77  boolean isAddressEqual(DW1000Device* device);
78  boolean isShortAddressEqual(DW1000Device* device);
79 
80  //functions which contains the date: (easier to put as public)
81  // timestamps to remember
88 
89  void noteActivity();
90  boolean isInactive();
91 
92 
93 private:
94  //device ID
95  byte _ownAddress[8];
96  byte _shortAddress[2];
97  int32_t _activity;
98  uint16_t _replyDelayTimeUS;
99  int8_t _index; // not used
100 
101  int16_t _range;
102  int16_t _RXPower;
103  int16_t _FPPower;
104  int16_t _quality;
105 
106  void randomShortAddress();
107 
108 };
109 
110 
111 #endif
boolean isInactive()
Definition: DW1000Device.cpp:136
float getRange()
Definition: DW1000Device.cpp:117
DW1000Time timePollAckSent
Definition: DW1000Device.h:84
void setFPPower(float power)
Definition: DW1000Device.cpp:73
boolean isAddressEqual(DW1000Device *device)
Definition: DW1000Device.cpp:108
Definition: DW1000Device.h:37
Definition: DW1000Mac.h:45
uint16_t getReplyTime()
Definition: DW1000Device.h:61
~DW1000Device()
Definition: DW1000Device.cpp:52
void noteActivity()
Definition: DW1000Device.cpp:131
float getRXPower()
Definition: DW1000Device.cpp:119
DW1000Time timeRangeSent
Definition: DW1000Device.h:86
void setQuality(float quality)
Definition: DW1000Device.cpp:75
void setAddress(char address[])
Definition: DW1000Device.cpp:58
DW1000Time timeRangeReceived
Definition: DW1000Device.h:87
byte * getByteAddress()
Definition: DW1000Device.cpp:78
void setReplyDelayTime(int16_t time)
Definition: DW1000Device.h:56
DW1000Device()
Definition: DW1000Device.cpp:29
float getFPPower()
Definition: DW1000Device.cpp:121
Definition: DW1000Time.h:43
void setRXPower(float power)
Definition: DW1000Device.cpp:71
float getQuality()
Definition: DW1000Device.cpp:123
DW1000Time timePollReceived
Definition: DW1000Device.h:83
boolean isShortAddressEqual(DW1000Device *device)
Definition: DW1000Device.cpp:112
void setReplyTime(uint16_t replyDelayTimeUs)
Definition: DW1000Device.cpp:56
byte * getByteShortAddress()
Definition: DW1000Device.cpp:90
DW1000Time timePollAckReceived
Definition: DW1000Device.h:85
int8_t getIndex()
Definition: DW1000Device.h:65
void setIndex(int8_t index)
Definition: DW1000Device.h:58
DW1000Time timePollSent
Definition: DW1000Device.h:82
uint16_t getShortAddress()
Definition: DW1000Device.cpp:103
void setRange(float range)
Definition: DW1000Device.cpp:69
void setShortAddress(byte address[])
Definition: DW1000Device.cpp:64