(event)
| 94 | |
| 95 | // triggered when a new IPv4 or IPv6 endpoint is detected on the LAN |
| 96 | function onNewEndpoint(event) { |
| 97 | var endpoint = event.data; |
| 98 | var msg = null; |
| 99 | |
| 100 | if( endpoint.mac in db.endpoints ){ |
| 101 | log('known endpoint ' + endpoint.mac + ' connected'); |
| 102 | |
| 103 | updateEndpoint(endpoint); |
| 104 | } else { |
| 105 | var msg = "🚨 Unknown endpoint connected:\n\n" + |
| 106 | decorateEndpoint(endpoint, ''); |
| 107 | |
| 108 | createEndpoint(endpoint); |
| 109 | } |
| 110 | |
| 111 | saveJSON(db, dbPath); |
| 112 | |
| 113 | if(notifyUknownEndpoints && msg != null) { |
| 114 | sendMessage(msg); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | // triggered when a new WiFi access point is detected |
| 119 | function onNewAP(event){ |
nothing calls this directly
no test coverage detected