foist
[kismet-logviewer.git] / logviewer / static / js / kismet.ui.uav.js
1
2 "use strict";
3
4 /* Highlight UAV devices */
5 kismet_ui.AddDeviceRowHighlight({
6     name: "UAV/Drones",
7     description: "UAV and Drone devices",
8     priority: 100,
9     defaultcolor: "#f49e42",
10     defaultenable: true,
11     fields: [
12         'uav.device'
13     ],
14     selector: function(data) {
15         return ('uav.device' in data && data['uav.device'] != 0);
16     }
17 });
18
19 kismet_ui.AddDeviceDetail("uav", "UAV/Drone", 0, {
20     filter: function(data) {
21         return ('uav.device' in data && data['uav.device'] != 0);
22     },
23     draw: function(data, target) {
24         target.devicedata(data, {
25             "id": "uavdata",
26             "fields": [
27             {
28                 field: "uav.device/uav.manufacturer",
29                 title: "Manufacturer",
30                 empty: "<i>Unknown</i>",
31                 help: "The UAV manufacturer may be derived from characteristics such as MAC address and SSID, or from embedded data such as the DroneID information.",
32             },
33             {
34                 field: "uav.device/uav.model",
35                 title: "Model",
36                 filterOnEmpty: true,
37                 help: "The UAV model may be derived from characteristics such as MAC address and SSID, or from embedded data such as the DroneID information.",
38             },
39             {
40                 field: "uav.device/uav.serialnumber",
41                 title: "Serial Number",
42                 filterOnEmpty: true,
43                 help: "Serial numbers are available from UAV devices which broadcast the DroneID protocol.  Currently only DJI devices advertise this protocol.",
44             },
45             {
46                 field: "uav.device/uav.match_type",
47                 title: "ID Method",
48                 empty: "<i>Unknown</i>",
49                 help: "Kismet can identify a UAV device by several methods; 'WifiMatch' compares the MAC address and SSID.  'DroneID' matches the DJI DroneID protocol added to packets from the device.",
50             },
51             {
52                 field: "home_location",
53                 title: "Home Location",
54                 render: function(opts) {
55                     var loc =
56                         kismet.ObjectByString(opts['data'], "uav.device/uav.telemetry.home_location/kismet.common.location.geopoint[1]") + ", " +
57                         kismet.ObjectByString(opts['data'], "uav.device/uav.telemetry.home_location/kismet.common.location.geopoint[0]");
58
59                     return loc;
60                 },
61                 help: "Last advertised <b>home</b> location.  The home location is where a UAV will return to if signal is lost or a return-to-home is received.",
62             },
63             {
64                 field: "app_location",
65                 title: "App Location",
66                 render: function(opts) {
67                     var loc =
68                         kismet.ObjectByString(opts['data'], "uav.device/uav.telemetry.app_location/kismet.common.location.geopoint[1]") + ", " +
69                         kismet.ObjectByString(opts['data'], "uav.device/uav.telemetry.app_location/kismet.common.location.geopoint[0]");
70
71                     return loc;
72                 },
73                 help: "Last advertised <b>application</b> location.  This is the last-known location of the operator application.",
74             },
75             {
76                 field: "uav.device/uav.last_telemetry",
77                 groupTitle: "Telemetry",
78                 filterOnEmpty: true,
79                 filterOnZero: true,
80                 id: "last_telem",
81                 fields: [
82                 {
83                     field: "uav.device/uav.last_telemetry/uav.telemetry.motor_on",
84                     title: "Motor",
85                     render: function(opts) {
86                         if (opts['value'])
87                             return "On";
88                         return "Off";
89                     },
90                     empty: "<i>Unknown</i>",
91                     help: "The UAV device advertised that the props are currently on",
92                 },
93                 {
94                     field: "uav.device/uav.last_telemetry/uav.telemetry.airborne",
95                     title: "Airborne",
96                     render: function(opts) {
97                         if (opts['value'])
98                             return "Yes";
99                         return "No";
100                     },
101                     empty: "<i>Unknown</i>",
102                     help: "The UAV device advertised that it is airborne",
103                 },
104                 {
105                     field: "uav_location",
106                     title: "Last Location",
107                     render: function(opts) {
108                         var loc =
109                             kismet.ObjectByString(opts['data'], "uav.device/uav.last_telemetry/uav.telemetry.location/kismet.common.location.geopoint[1]") + ", " +
110                             kismet.ObjectByString(opts['data'], "uav.device/uav.last_telemetry/uav.telemetry.location/kismet.common.location.geopoint[0]");
111
112                         return loc;
113                     },
114                     help: "Last advertised location",
115                 },
116                 {
117                     field: "uav.device/uav.last_telemetry/uav.telemetry.location/kismet.common.location.alt",
118                     title: "Altitude",
119                     help: "Last advertised altitude",
120                     filter: function(opts) {
121                         return (kismet.ObjectByString(opts['data'], "uav.device/uav.last_telemetry/uav.telemetry.location/kismet.common.location.fix") >= 3);
122                     },
123                     render: function(opts) {
124                         console.log(opts['value']);
125                         return kismet_ui.renderHeightDistance(opts['value']);
126                     }
127                 },
128                 {
129                     field: "uav.device/uav.last_telemetry/uav.telemetry.height",
130                     title: "Height",
131                     render: function(opts) {
132                         console.log(opts['value']);
133                         return kismet_ui.renderHeightDistance(opts['value']);
134                     },
135                     help: "Advertised height above ground",
136                 },
137
138                 ],
139             }
140
141             ],
142         });
143     },
144 });
145