-
Notifications
You must be signed in to change notification settings - Fork 102
/
AprsUdp.scala
28 lines (23 loc) · 895 Bytes
/
AprsUdp.scala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package de.duenndns.aprsdroid
import _root_.android.content.SharedPreferences
import _root_.android.location.Location
import _root_.android.preference.PreferenceManager
import _root_.android.util.Log
import _root_.java.net.{InetAddress, DatagramSocket, DatagramPacket}
class AprsUdp(prefs : SharedPreferences) extends AprsIsUploader(prefs) {
val TAG = "AprsUdp"
lazy val socket = new DatagramSocket()
def start() {
}
def update(packet : String) {
val login = "user " + prefs.getString("callsign", null) +
" pass " + prefs.getString("passcode", null) + " vers APRSdroid beta"
var hostname = prefs.getString("host", null)
val addr = InetAddress.getByName(hostname)
val pbytes = (login + "\r\n" + packet + "\r\n").getBytes()
socket.send(new DatagramPacket(pbytes, pbytes.length, addr, 8080))
Log.d(TAG, "update(): sent " + packet + " to " + hostname)
}
def stop() {
}
}