1 /*
2 * Copyright (C) 2018 Alberto Irurueta Carro (alberto@irurueta.com)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package com.irurueta.navigation.indoor;
17
18 import com.irurueta.algebra.Matrix;
19 import com.irurueta.geometry.Point;
20
21 /**
22 * Data related to a Wi-Fi access point with estimated transmitted power and
23 * known location.
24 *
25 * @param <P> a {@link Point} type.
26 */
27 public class WifiAccessPointWithPowerAndLocated<P extends Point<?>> extends WifiAccessPointWithPower implements
28 RadioSourceWithPowerAndLocated<P> {
29
30 /**
31 * Position where access point is located.
32 */
33 private P position;
34
35 /**
36 * Covariance of inhomogeneous coordinates of current position (if available).
37 */
38 private Matrix positionCovariance;
39
40 /**
41 * Constructor.
42 *
43 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
44 * xx:xx:xx:xx:xx:xx.
45 * @param frequency frequency used by this Access Point (expressed in Hz).
46 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
47 * @param position position where access point is located.
48 * @throws IllegalArgumentException if BSSID is null or frequency is negative.
49 */
50 public WifiAccessPointWithPowerAndLocated(
51 final String bssid, final double frequency, final double transmittedPower, final P position) {
52 super(bssid, frequency, transmittedPower);
53
54 if (position == null) {
55 throw new IllegalArgumentException();
56 }
57
58 this.position = position;
59 }
60
61 /**
62 * Constructor.
63 *
64 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
65 * xx:xx:xx:xx:xx:xx.
66 * @param frequency frequency used by this Access Point (expressed in Hz).
67 * @param ssid service set identifier (SSID) of this 802.11 network.
68 * @param transmittedPower transmitted power by this access point (expressed in dBM's).
69 * @param position position where access point is located.
70 * @throws IllegalArgumentException if BSSID is null or frequency is negative.
71 */
72 public WifiAccessPointWithPowerAndLocated(
73 final String bssid, final double frequency, final String ssid, final double transmittedPower,
74 final P position) {
75 super(bssid, frequency, ssid, transmittedPower);
76
77 if (position == null) {
78 throw new IllegalArgumentException();
79 }
80
81 this.position = position;
82 }
83
84 /**
85 * Constructor.
86 *
87 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
88 * xx:xx:xx:xx:xx:xx.
89 * @param frequency frequency used by this Access Point (expressed in Hz).
90 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
91 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
92 * if unknown.
93 * @param position position where access point is located.
94 * @throws IllegalArgumentException if either BSSID is null, frequency is negative
95 * or transmitted power standard deviation is negative.
96 */
97 public WifiAccessPointWithPowerAndLocated(
98 final String bssid, final double frequency, final double transmittedPower,
99 final Double transmittedPowerStandardDeviation, final P position) {
100 super(bssid, frequency, transmittedPower, transmittedPowerStandardDeviation);
101
102 if (position == null) {
103 throw new IllegalArgumentException();
104 }
105
106 this.position = position;
107 }
108
109 /**
110 * Constructor.
111 *
112 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
113 * xx:xx:xx:xx:xx:xx.
114 * @param frequency frequency used by this Access Point (expressed in Hz).
115 * @param ssid service set identifier (SSID) of this 802.11 network.
116 * @param transmittedPower transmitted power by this access point (expressed in dBM's).
117 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
118 * if unknown.
119 * @param position position where access point is located.
120 * @throws IllegalArgumentException if either BSSID is null, frequency is negative,
121 * or transmitted power standard deviation is negative.
122 */
123 public WifiAccessPointWithPowerAndLocated(
124 final String bssid, final double frequency, final String ssid, final double transmittedPower,
125 final Double transmittedPowerStandardDeviation, final P position) {
126 super(bssid, frequency, ssid, transmittedPower, transmittedPowerStandardDeviation);
127
128 if (position == null) {
129 throw new IllegalArgumentException();
130 }
131
132 this.position = position;
133 }
134
135 /**
136 * Constructor.
137 *
138 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
139 * xx:xx:xx:xx:xx:xx.
140 * @param frequency frequency used by this Access Point (expressed in Hz).
141 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
142 * @param position position where access point is located.
143 * @param positionCovariance covariance of inhomogeneous coordinates of current
144 * position (if available).
145 * @throws IllegalArgumentException if BSSID is null, frequency is negative or
146 * covariance has invalid size.
147 */
148 public WifiAccessPointWithPowerAndLocated(
149 final String bssid, final double frequency, final double transmittedPower, final P position,
150 final Matrix positionCovariance) {
151 this(bssid, frequency, transmittedPower, position);
152
153 if (positionCovariance != null && (positionCovariance.getRows() != position.getDimensions()
154 || positionCovariance.getColumns() != position.getDimensions())) {
155 throw new IllegalArgumentException();
156 }
157 this.positionCovariance = positionCovariance;
158 }
159
160 /**
161 * Constructor.
162 *
163 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
164 * xx:xx:xx:xx:xx:xx.
165 * @param frequency frequency used by this Access Point (expressed in Hz).
166 * @param ssid service set identifier (SSID) of this 802.11 network.
167 * @param transmittedPower transmitted power by this access point (expressed in dBM's).
168 * @param position position where access point is located.
169 * @param positionCovariance covariance of inhomogeneous coordinates of current
170 * position (if available).
171 * @throws IllegalArgumentException if BSSID is null, frequency is negative
172 * or covariance has invalid size.
173 */
174 public WifiAccessPointWithPowerAndLocated(
175 final String bssid, final double frequency, final String ssid, final double transmittedPower,
176 final P position, final Matrix positionCovariance) {
177 this(bssid, frequency, ssid, transmittedPower, position);
178
179 if (positionCovariance != null && (positionCovariance.getRows() != position.getDimensions()
180 || positionCovariance.getColumns() != position.getDimensions())) {
181 throw new IllegalArgumentException();
182 }
183 this.positionCovariance = positionCovariance;
184 }
185
186 /**
187 * Constructor.
188 *
189 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
190 * xx:xx:xx:xx:xx:xx.
191 * @param frequency frequency used by this Access Point (expressed in Hz).
192 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
193 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
194 * if unknown.
195 * @param position position where access point is located.
196 * @param positionCovariance covariance of inhomogeneous coordinates of current
197 * position (if available).
198 * @throws IllegalArgumentException if either BSSID is null, frequency is negative,
199 * transmitted power standard deviation is negative or covariance is invalid size.
200 */
201 public WifiAccessPointWithPowerAndLocated(
202 final String bssid, final double frequency, final double transmittedPower,
203 final Double transmittedPowerStandardDeviation, final P position, final Matrix positionCovariance) {
204 this(bssid, frequency, transmittedPower, transmittedPowerStandardDeviation, position);
205
206 if (positionCovariance != null && (positionCovariance.getRows() != position.getDimensions()
207 || positionCovariance.getColumns() != position.getDimensions())) {
208 throw new IllegalArgumentException();
209 }
210 this.positionCovariance = positionCovariance;
211 }
212
213 /**
214 * Constructor.
215 *
216 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
217 * xx:xx:xx:xx:xx:xx.
218 * @param frequency frequency used by this Access Point (expressed in Hz).
219 * @param ssid service set identifier (SSID) of this 802.11 network.
220 * @param transmittedPower transmitted power by this access point (expressed in dBM's).
221 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
222 * if unknown.
223 * @param position position where access point is located.
224 * @param positionCovariance covariance of inhomogeneous coordinates of current
225 * position (if available).
226 * @throws IllegalArgumentException if either BSSID is null, frequency is negative,
227 * transmitted power standard deviation is negative or covariance has invalid size.
228 */
229 public WifiAccessPointWithPowerAndLocated(
230 final String bssid, final double frequency, final String ssid, final double transmittedPower,
231 final Double transmittedPowerStandardDeviation, final P position, final Matrix positionCovariance) {
232 this(bssid, frequency, ssid, transmittedPower, transmittedPowerStandardDeviation, position);
233
234 if (positionCovariance != null && (positionCovariance.getRows() != position.getDimensions()
235 || positionCovariance.getColumns() != position.getDimensions())) {
236 throw new IllegalArgumentException();
237 }
238 this.positionCovariance = positionCovariance;
239 }
240
241 /**
242 * Constructor.
243 *
244 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
245 * xx:xx:xx:xx:xx:xx.
246 * @param frequency frequency used by this Access Point (expressed in Hz).
247 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
248 * @param pathLossExponent path loss exponent. By default, this is 2.0.
249 * @param position position where access point is located.
250 * @throws IllegalArgumentException if either BSSID is null or frequency is negative
251 */
252 public WifiAccessPointWithPowerAndLocated(
253 final String bssid, final double frequency, final double transmittedPower, final double pathLossExponent,
254 final P position) {
255 super(bssid, frequency, transmittedPower, pathLossExponent);
256
257 if (position == null) {
258 throw new IllegalArgumentException();
259 }
260
261 this.position = position;
262 }
263
264 /**
265 * Constructor.
266 *
267 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
268 * xx:xx:xx:xx:xx:xx.
269 * @param frequency frequency used by this Access Point (expressed in Hz).
270 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
271 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
272 * if unknown.
273 * @param pathLossExponent path loss exponent. By default, this is 2.0.
274 * @param position position where access point is located.
275 * @throws IllegalArgumentException if either BSSID is null, frequency is negative
276 * or transmitted power standard deviation is negative.
277 */
278 public WifiAccessPointWithPowerAndLocated(
279 final String bssid, final double frequency, final double transmittedPower,
280 final Double transmittedPowerStandardDeviation, final double pathLossExponent,
281 final P position) {
282 super(bssid, frequency, transmittedPower, transmittedPowerStandardDeviation, pathLossExponent);
283
284 if (position == null) {
285 throw new IllegalArgumentException();
286 }
287
288 this.position = position;
289 }
290
291 /**
292 * Constructor.
293 *
294 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
295 * xx:xx:xx:xx:xx:xx.
296 * @param frequency frequency used by this Access Point (expressed in Hz).
297 * @param ssid service set identifier (SSID) of this 802.11 network.
298 * @param transmittedPower transmitted power by this access point (expressed in dBM's).
299 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
300 * if unknown.
301 * @param pathLossExponent path loss exponent. By default, this is 2.0.
302 * @param position position where access point is located.
303 * @throws IllegalArgumentException if either BSSID is null, frequency is negative,
304 * or transmitted power standard deviation is negative.
305 */
306 public WifiAccessPointWithPowerAndLocated(
307 final String bssid, final double frequency, final String ssid, final double transmittedPower,
308 final Double transmittedPowerStandardDeviation, final double pathLossExponent, final P position) {
309 super(bssid, frequency, ssid, transmittedPower, transmittedPowerStandardDeviation, pathLossExponent);
310
311 if (position == null) {
312 throw new IllegalArgumentException();
313 }
314
315 this.position = position;
316 }
317
318 /**
319 * Constructor.
320 *
321 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
322 * xx:xx:xx:xx:xx:xx.
323 * @param frequency frequency used by this Access Point (expressed in Hz).
324 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
325 * @param pathLossExponent path loss exponent. By default, this is 2.0.
326 * @param position position where access point is located.
327 * @param positionCovariance covariance of inhomogeneous coordinates of current
328 * position (if available).
329 * @throws IllegalArgumentException if either BSSID is null, frequency is negative
330 * or covariance has invalid size.
331 */
332 public WifiAccessPointWithPowerAndLocated(
333 final String bssid, final double frequency, final double transmittedPower, final double pathLossExponent,
334 final P position, final Matrix positionCovariance) {
335 this(bssid, frequency, transmittedPower, pathLossExponent, position);
336
337 if (positionCovariance != null && (positionCovariance.getRows() != position.getDimensions()
338 || positionCovariance.getColumns() != position.getDimensions())) {
339 throw new IllegalArgumentException();
340 }
341 this.positionCovariance = positionCovariance;
342 }
343
344 /**
345 * Constructor.
346 *
347 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
348 * xx:xx:xx:xx:xx:xx.
349 * @param frequency frequency used by this Access Point (expressed in Hz).
350 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
351 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
352 * if unknown.
353 * @param pathLossExponent path loss exponent. By default, this is 2.0.
354 * @param position position where access point is located.
355 * @param positionCovariance covariance of inhomogeneous coordinates of current
356 * position (if available).
357 * @throws IllegalArgumentException if either BSSID is null, frequency is negative,
358 * transmitted power standard deviation is negative or covariance has invalid size.
359 */
360 public WifiAccessPointWithPowerAndLocated(
361 final String bssid, final double frequency, final double transmittedPower,
362 final Double transmittedPowerStandardDeviation, final double pathLossExponent, final P position,
363 final Matrix positionCovariance) {
364 this(bssid, frequency, transmittedPower, transmittedPowerStandardDeviation, pathLossExponent, position);
365
366 if (positionCovariance != null && (positionCovariance.getRows() != position.getDimensions()
367 || positionCovariance.getColumns() != position.getDimensions())) {
368 throw new IllegalArgumentException();
369 }
370 this.positionCovariance = positionCovariance;
371 }
372
373 /**
374 * Constructor.
375 *
376 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
377 * xx:xx:xx:xx:xx:xx.
378 * @param frequency frequency used by this Access Point (expressed in Hz).
379 * @param ssid service set identifier (SSID) of this 802.11 network.
380 * @param transmittedPower transmitted power by this access point (expressed in dBM's).
381 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
382 * if unknown.
383 * @param pathLossExponent path loss exponent. By default, this is 2.0.
384 * @param position position where access point is located.
385 * @param positionCovariance covariance of inhomogeneous coordinates of current
386 * position (if available).
387 * @throws IllegalArgumentException if either BSSID is null, frequency is negative,
388 * transmitted power standard deviation is negative or covariance has invalid size.
389 */
390 public WifiAccessPointWithPowerAndLocated(
391 final String bssid, final double frequency, final String ssid, final double transmittedPower,
392 final Double transmittedPowerStandardDeviation, final double pathLossExponent, final P position,
393 final Matrix positionCovariance) {
394 this(bssid, frequency, ssid, transmittedPower, transmittedPowerStandardDeviation, pathLossExponent, position);
395
396 if (positionCovariance != null && (positionCovariance.getRows() != position.getDimensions()
397 || positionCovariance.getColumns() != position.getDimensions())) {
398 throw new IllegalArgumentException();
399 }
400 this.positionCovariance = positionCovariance;
401 }
402
403 /**
404 * Constructor.
405 *
406 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
407 * xx:xx:xx:xx:xx:xx.
408 * @param frequency frequency used by this Access Point (expressed in Hz).
409 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
410 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
411 * if unknown.
412 * @param pathLossExponent path loss exponent. By default, this is 2.0.
413 * @param pathLossExponentStandardDeviation standard deviation of path loss exponent or null if
414 * unknown.
415 * @param position position where access point is located.
416 * @throws IllegalArgumentException if either BSSID is null, frequency is negative
417 * or any standard deviation is negative.
418 */
419 public WifiAccessPointWithPowerAndLocated(
420 final String bssid, final double frequency, final double transmittedPower,
421 final Double transmittedPowerStandardDeviation, final double pathLossExponent,
422 final Double pathLossExponentStandardDeviation, final P position) {
423 super(bssid, frequency, transmittedPower, transmittedPowerStandardDeviation, pathLossExponent,
424 pathLossExponentStandardDeviation);
425
426 if (position == null) {
427 throw new IllegalArgumentException();
428 }
429
430 this.position = position;
431 }
432
433 /**
434 * Constructor.
435 *
436 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
437 * xx:xx:xx:xx:xx:xx.
438 * @param frequency frequency used by this Access Point (expressed in Hz).
439 * @param ssid service set identifier (SSID) of this 802.11 network.
440 * @param transmittedPower transmitted power by this access point (expressed in dBM's).
441 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
442 * if unknown.
443 * @param pathLossExponent path loss exponent. By default, this is 2.0.
444 * @param pathLossExponentStandardDeviation standard deviation of path loss exponent or null if
445 * unknown.
446 * @param position position where access point is located.
447 * @throws IllegalArgumentException if either BSSID is null, frequency is negative,
448 * or any standard deviation is negative.
449 */
450 public WifiAccessPointWithPowerAndLocated(
451 final String bssid, final double frequency, final String ssid, final double transmittedPower,
452 final Double transmittedPowerStandardDeviation, final double pathLossExponent,
453 final Double pathLossExponentStandardDeviation, final P position) {
454 super(bssid, frequency, ssid, transmittedPower, transmittedPowerStandardDeviation, pathLossExponent,
455 pathLossExponentStandardDeviation);
456
457 if (position == null) {
458 throw new IllegalArgumentException();
459 }
460
461 this.position = position;
462 }
463
464 /**
465 * Constructor.
466 *
467 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
468 * xx:xx:xx:xx:xx:xx.
469 * @param frequency frequency used by this Access Point (expressed in Hz).
470 * @param transmittedPower transmitted power by this access point (expressed in dBm's).
471 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
472 * if unknown.
473 * @param pathLossExponent path loss exponent. By default, this is 2.0.
474 * @param pathLossExponentStandardDeviation standard deviation of path loss exponent or null if
475 * unknown.
476 * @param position position where access point is located.
477 * @param positionCovariance covariance of inhomogeneous coordinates of current
478 * position (if available).
479 * @throws IllegalArgumentException if either BSSID is null, frequency is negative,
480 * any standard deviation is negative or covariance has invalid size.
481 */
482 public WifiAccessPointWithPowerAndLocated(
483 final String bssid, final double frequency, final double transmittedPower,
484 final Double transmittedPowerStandardDeviation, final double pathLossExponent,
485 final Double pathLossExponentStandardDeviation, final P position,
486 final Matrix positionCovariance) {
487 this(bssid, frequency, transmittedPower, transmittedPowerStandardDeviation, pathLossExponent,
488 pathLossExponentStandardDeviation, position);
489
490 if (positionCovariance != null && (positionCovariance.getRows() != position.getDimensions()
491 || positionCovariance.getColumns() != position.getDimensions())) {
492 throw new IllegalArgumentException();
493 }
494 this.positionCovariance = positionCovariance;
495 }
496
497 /**
498 * Constructor.
499 *
500 * @param bssid basic service set identifier of this access point in the form of a six-byte MAC address:
501 * xx:xx:xx:xx:xx:xx.
502 * @param frequency frequency used by this Access Point (expressed in Hz).
503 * @param ssid service set identifier (SSID) of this 802.11 network.
504 * @param transmittedPower transmitted power by this access point (expressed in dBM's).
505 * @param transmittedPowerStandardDeviation standard deviation of transmitted power value or null
506 * if unknown.
507 * @param pathLossExponent path loss exponent. By default, this is 2.0.
508 * @param pathLossExponentStandardDeviation standard deviation of path loss exponent or null if
509 * unknown.
510 * @param position position where access point is located.
511 * @param positionCovariance covariance of inhomogeneous coordinates of current
512 * position (if available).
513 * @throws IllegalArgumentException if either BSSID is null, frequency is negative,
514 * any standard deviation is negative or covariance has invalid size.
515 */
516 public WifiAccessPointWithPowerAndLocated(
517 final String bssid, final double frequency, final String ssid, final double transmittedPower,
518 final Double transmittedPowerStandardDeviation, final double pathLossExponent,
519 final Double pathLossExponentStandardDeviation, final P position, final Matrix positionCovariance) {
520 this(bssid, frequency, ssid, transmittedPower, transmittedPowerStandardDeviation, pathLossExponent,
521 pathLossExponentStandardDeviation, position);
522
523 if (positionCovariance != null && (positionCovariance.getRows() != position.getDimensions()
524 || positionCovariance.getColumns() != position.getDimensions())) {
525 throw new IllegalArgumentException();
526 }
527 this.positionCovariance = positionCovariance;
528 }
529
530 /**
531 * Empty constructor.
532 */
533 protected WifiAccessPointWithPowerAndLocated() {
534 super();
535 }
536
537 /**
538 * Gets position where access point is located.
539 *
540 * @return position where access point is located.
541 */
542 public P getPosition() {
543 return position;
544 }
545
546 /**
547 * Gets covariance of inhomogeneous coordinates of current position (if available).
548 *
549 * @return covariance of position or null.
550 */
551 public Matrix getPositionCovariance() {
552 return positionCovariance;
553 }
554 }