Append an optional station log and announce the software after login.
A log path that cannot be written leaves the station on the reflector, and the reflector learns which program joined. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -24,9 +24,18 @@ type loggedIn struct {
|
||||
}
|
||||
|
||||
func login(t *testing.T, callsign, key string, tg int, id uint16, codecs []string) loggedIn {
|
||||
t.Helper()
|
||||
return loginLog(t, callsign, key, tg, id, codecs, "")
|
||||
}
|
||||
|
||||
func loginLog(t *testing.T, callsign, key string, tg int, id uint16, codecs []string, logPath string) loggedIn {
|
||||
t.Helper()
|
||||
refl := newReflector(t)
|
||||
path := writeConfigFile(t, configJSON("127.0.0.1", refl.port, callsign, key, tg))
|
||||
file := configJSON("127.0.0.1", refl.port, callsign, key, tg)
|
||||
if logPath != "" {
|
||||
file = configWithLog("127.0.0.1", refl.port, callsign, key, tg, logPath)
|
||||
}
|
||||
path := writeConfigFile(t, file)
|
||||
clock := newFakeClock()
|
||||
st, err := station.New(station.Options{ConfigPath: path, Clock: clock})
|
||||
if err != nil {
|
||||
@@ -63,6 +72,11 @@ func login(t *testing.T, callsign, key string, tg int, id uint16, codecs []strin
|
||||
refl.writeFrame(t, 12, nil)
|
||||
refl.writeFrame(t, 100, serverInfo(id, []string{"db0abc"}, codecs))
|
||||
typ, body = refl.readFrame(t)
|
||||
if typ != 111 {
|
||||
t.Fatalf("type %d, want software identity", typ)
|
||||
}
|
||||
requireSoftwareIdentity(t, body)
|
||||
typ, body = refl.readFrame(t)
|
||||
if typ != 106 {
|
||||
t.Fatalf("type %d, want select talk group", typ)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user