forked from talkkonnect/talkkonnect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclientcommands.go
696 lines (598 loc) · 18.7 KB
/
clientcommands.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
/*
* talkkonnect headless mumble client/gateway with lcd screen and channel control
* Copyright (C) 2018-2019, Suvir Kumar <[email protected]>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* talkkonnect is the based on talkiepi and barnard by Daniel Chote and Tim Cooper
*
* The Initial Developer of the Original Code is
* Suvir Kumar <[email protected]>
* Portions created by the Initial Developer are Copyright (C) Suvir Kumar. All Rights Reserved.
*
* Contributor(s):
*
* Suvir Kumar <[email protected]>
*
* My Blog is at www.talkkonnect.com
* The source code is hosted at github.com/talkkonnect
*
*
*/
package talkkonnect
import (
"fmt"
"log"
"net"
"os"
"sort"
"strconv"
"time"
"github.com/talkkonnect/gumble/gumble"
"github.com/talkkonnect/gumble/gumbleffmpeg"
term "github.com/talkkonnect/termbox-go"
"github.com/talkkonnect/volume-go"
)
func FatalCleanUp(message string) {
term.Close()
fmt.Println(message)
time.Sleep(5 * time.Second)
fmt.Println("Talkkonnect Terminated Abnormally with the Error(s) As Described Perviously, Ignore any GPIO errors if you are not using Single Board Computer.")
os.Exit(1)
}
func CleanUp() {
if Config.Global.Hardware.TargetBoard == "rpi" {
t := time.Now()
if LCDEnabled {
LcdText = [4]string{"talkkonnect stopped", t.Format("02-01-2006 15:04:05"), "EUMP", "Adaptive Systems S.A."}
LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress)
}
if OLEDEnabled {
Oled.DisplayOn()
LCDIsDark = false
oledDisplay(true, 0, 1, "systema parado")
oledDisplay(false, 1, 1, t.Format("02-01-2006 15:04:05"))
oledDisplay(false, 6, 1, "EUMP")
oledDisplay(false, 7, 1, "Adaptive Systems S.A.")
}
GPIOOutAll("led/relay", "off")
MyLedStripGPIOOffAll()
}
term.Close()
fmt.Println("SIGHUP Termination of Program Requested by User...shutting down talkkonnect")
os.Exit(0)
}
func (b *Talkkonnect) Connect() {
IsConnected = false
IsPlayStream = false
NowStreaming = false
KillHeartBeat = false
var err error
_, err = gumble.DialWithDialer(new(net.Dialer), b.Address, b.Config, &b.TLSConfig)
if err != nil {
log.Printf("error: Connection Error %v connecting to %v failed, attempting again...", err, b.Address)
log.Println("debug: In the Connect Function & Trying With Username ", Username)
b.ReConnect()
} else {
b.OpenStream()
}
}
func (b *Talkkonnect) ReConnect() {
IsConnected = false
IsPlayStream = false
NowStreaming = false
if b.Client != nil {
log.Println("info: Attempting Reconnection With Server")
b.Client.Disconnect()
}
if ConnectAttempts < 3 {
ConnectAttempts++
b.Connect()
} else {
if Config.Global.Hardware.TargetBoard == "rpi" {
if LCDEnabled {
LcdText = [4]string{"Failed to Connect!", "nil", "nil", "nil"}
LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress)
}
if OLEDEnabled {
oledDisplay(false, 2, 1, "Fallo al Connectar!")
}
}
FatalCleanUp("Unable to Connect to mumble server, Giving Up!")
}
}
func (b *Talkkonnect) TransmitStart() {
if !(IsConnected) {
return
}
b.BackLightTimer()
LastSpeaker = ""
if Config.Global.Software.Settings.SimplexWithMute {
err := volume.Mute(Config.Global.Software.Settings.OutputDevice)
if err != nil {
log.Println("error: Unable to Mute ", err)
} else {
log.Println("info: Speaker Muted ")
}
}
if IsPlayStream {
IsPlayStream = false
NowStreaming = false
for _, sound := range Config.Global.Software.Sounds.Sound {
if sound.Enabled {
if sound.Event == "stream" {
if s, err := strconv.ParseFloat(sound.Volume, 32); err == nil {
b.playIntoStream(sound.File, float32(s))
}
}
}
}
}
if Config.Global.Hardware.TargetBoard == "rpi" {
// use groutine so no need to wait for local screen cause it causes delay
go GPIOOutPin("transmit", "on")
go MyLedStripTransmitLEDOn()
go txScreen()
}
b.IsTransmitting = true
if pstream.State() == gumbleffmpeg.StatePlaying {
pstream.Stop()
}
b.StartSource()
}
func (b *Talkkonnect) TransmitStop(withBeep bool) {
if !(IsConnected) {
return
}
b.BackLightTimer()
if Config.Global.Hardware.TargetBoard == "rpi" {
GPIOOutPin("transmit", "off")
MyLedStripTransmitLEDOff()
if LCDEnabled {
LcdText[0] = b.Name // b.Address
LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress)
}
if OLEDEnabled {
oledDisplay(false, 0, 1, b.Name) //b.Address
}
}
b.IsTransmitting = false
b.StopSource()
if Config.Global.Software.Settings.SimplexWithMute {
err := volume.Unmute(Config.Global.Software.Settings.OutputDevice)
if err != nil {
log.Println("error: Unable to Unmute ", err)
} else {
log.Println("info: Speaker UnMuted ")
}
}
}
func (b *Talkkonnect) ChangeChannel(ChannelName string) {
if !(IsConnected) {
return
}
b.BackLightTimer()
channel := b.Client.Channels.Find(ChannelName)
if channel != nil {
b.Client.Self.Move(channel)
if Config.Global.Hardware.TargetBoard == "rpi" {
if LCDEnabled {
LcdText[1] = "Joined " + ChannelName
LcdText[2] = Username[AccountIndex]
LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress)
}
if OLEDEnabled {
oledDisplay(false, 0, 1, "Unido "+ChannelName)
oledDisplay(false, 1, 1, Username[AccountIndex])
}
}
log.Println("info: Joined Channel Name: ", channel.Name, " ID ", channel.ID)
prevChannelID = b.Client.Self.Channel.ID
} else {
log.Println("warn: Unable to Find Channel Name: ", ChannelName)
prevChannelID = 0
}
}
func (b *Talkkonnect) ParticipantLEDUpdate(verbose bool) {
if !(IsConnected) {
return
}
b.BackLightTimer()
var participantCount = len(b.Client.Self.Channel.Users)
var eventSound = EventSoundStruct{}
eventSound = findEventSound("joinedchannel")
if eventSound.Enabled {
if participantCount > prevParticipantCount {
if v, err := strconv.Atoi(eventSound.Volume); err == nil {
localMediaPlayer(eventSound.FileName, v, eventSound.Blocking, 0, 1)
}
}
}
eventSound = findEventSound("leftchannel")
if eventSound.Enabled {
if participantCount < prevParticipantCount {
if v, err := strconv.Atoi(eventSound.Volume); err == nil {
localMediaPlayer(eventSound.FileName, v, eventSound.Blocking, 0, 1)
}
}
}
if participantCount > 1 {
for _, tts := range Config.Global.Software.TTS.Sound {
if tts.Action == "participants" {
if tts.Enabled {
tempStatus := Config.Global.Software.TTSMessages.TTSTone.ToneEnabled
Config.Global.Software.TTSMessages.TTSTone.ToneEnabled = false
b.Speak("There Are Currently "+strconv.Itoa(participantCount)+" Users in The Channel "+b.Client.Self.Channel.Name, "local", 1, 0, 1, Config.Global.Software.TTSMessages.TTSLanguage)
Config.Global.Software.TTSMessages.TTSTone.ToneEnabled = tempStatus
}
}
}
prevParticipantCount = len(b.Client.Self.Channel.Users)
if verbose {
log.Println("info: Current Channel ", b.Client.Self.Channel.Name, " has (", participantCount, ") participants")
b.ListUsers()
if Config.Global.Hardware.TargetBoard == "rpi" {
if LCDEnabled {
LcdText[0] = b.Name //b.Address
LcdText[1] = "(" + strconv.Itoa(participantCount) + ")" + b.Client.Self.Channel.Name
LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress)
}
if OLEDEnabled {
oledDisplay(false, 0, 1, b.Name) //b.Address
oledDisplay(false, 1, 1, "("+strconv.Itoa(participantCount)+")"+b.Client.Self.Channel.Name)
oledDisplay(false, 6, 1, "EUMP")
oledDisplay(false, 7, 1, "Adaptive Systems S.A.")
}
}
}
}
if participantCount > 1 {
if Config.Global.Hardware.TargetBoard == "rpi" {
GPIOOutPin("participants", "on")
}
} else {
if verbose {
for _, tts := range Config.Global.Software.TTS.Sound {
if tts.Action == "participants" {
if tts.Enabled {
b.Speak("You are Currently Alone in The Channel "+b.Client.Self.Channel.Name, "local", 1, 0, 1, Config.Global.Software.TTSMessages.TTSLanguage)
}
}
}
log.Println("info: Channel ", b.Client.Self.Channel.Name, " has no other participants")
prevParticipantCount = 0
if Config.Global.Hardware.TargetBoard == "rpi" {
GPIOOutPin("participants", "off")
if LCDEnabled {
LcdText = [4]string{b.Name, "(0)" + b.Client.Self.Channel.Name, "", "nil"} //b.Address
LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress)
}
if OLEDEnabled {
oledDisplay(false, 0, 1, b.Name) //b.Address
oledDisplay(false, 1, 1, "(0)"+b.Client.Self.Channel.Name)
}
}
}
}
}
func (b *Talkkonnect) ListUsers() {
if !(IsConnected) {
return
}
item := 0
for _, usr := range b.Client.Users {
if usr.Channel.ID == b.Client.Self.Channel.ID {
item++
log.Println(fmt.Sprintf("info: %d. User %#v is online. [%v]", item, usr.Name, usr.Comment))
}
}
}
func (b *Talkkonnect) ListChannels(verbose bool) {
if !(IsConnected) {
return
}
ChannelsList = make([]ChannelsListStruct, len(b.Client.Channels))
counter := 0
ChannelIDs := []int{}
for _, ch := range b.Client.Channels {
ChannelIDs = append(ChannelIDs, int(ch.ID))
counter++
}
sort.Ints(ChannelIDs)
counter = 0
for _, cid := range ChannelIDs {
ChannelsList[counter].chanIndex = counter
ChannelsList[counter].chanID = cid
b.findChannelDetailsByID(uint32(cid), counter)
counter++
}
if verbose {
for i := 0; i < len(b.Client.Channels); i++ {
log.Println("debug: ", ChannelsList[i])
}
}
}
func (b *Talkkonnect) ChannelUp() {
if !(IsConnected) {
return
}
ChannelAction = "channelup"
TTSEvent("channelup")
Channel := b.Client.Channels.Find()
currentIndex := b.findChannelIndex(b.Client.Self.Channel.ID)
NextIndex := currentIndex
if currentIndex+1 < len(b.Client.Channels) {
Channel = b.Client.Channels.Find(ChannelsList[currentIndex+1].chanName)
NextIndex = currentIndex + 1
}
if ChannelsList[NextIndex].chanenterPermissions {
if Channel != nil {
b.Client.Self.Move(Channel)
}
} else {
for i := NextIndex + 1; i <= len(b.Client.Channels); i++ {
//special handling for when highest channel has no token
if i == len(b.Client.Channels) {
Channel = b.Client.Channels.Find()
b.Client.Self.Move(Channel)
return
} else {
Channel = b.Client.Channels.Find(ChannelsList[i].chanName)
}
if ChannelsList[i].chanenterPermissions {
b.Client.Self.Move(Channel)
break
}
}
}
}
func (b *Talkkonnect) ChannelDown() {
if !(IsConnected) {
return
}
ChannelAction = "channeldown"
TTSEvent("channeldown")
Channel := b.Client.Channels.Find(ChannelsList[len(b.Client.Channels)-1].chanName)
currentIndex := b.findChannelIndex(b.Client.Self.Channel.ID)
NextIndex := currentIndex
if currentIndex == 0 {
//special handling of max channel without token
Channel = b.Client.Channels.Find(ChannelsList[len(b.Client.Channels)-1].chanName)
NextIndex = len(b.Client.Channels) - 1
}
if currentIndex == 1 {
Channel = b.Client.Channels.Find()
NextIndex = currentIndex - 1
}
if currentIndex > 1 {
Channel = b.Client.Channels.Find(ChannelsList[currentIndex-1].chanName)
NextIndex = currentIndex - 1
}
if ChannelsList[NextIndex].chanenterPermissions {
if Channel != nil {
b.Client.Self.Move(Channel)
}
} else {
for i := NextIndex - 1; i >= 0; i-- {
Channel = b.Client.Channels.Find(ChannelsList[i].chanName)
if ChannelsList[i].chanenterPermissions {
b.Client.Self.Move(Channel)
break
}
}
}
}
func (b *Talkkonnect) Scan() {
if !(IsConnected) {
return
}
log.Println("alert: New Scan Not Implemented Yet")
}
func (b *Talkkonnect) SendMessage(textmessage string, PRecursive bool) {
if !(IsConnected) {
return
}
b.Client.Self.Channel.Send(textmessage, PRecursive)
}
func (b *Talkkonnect) SetComment(comment string) {
if IsConnected {
b.BackLightTimer()
b.Client.Self.SetComment(comment)
t := time.Now()
if Config.Global.Hardware.TargetBoard == "rpi" {
if LCDEnabled {
LcdText[2] = "Status at " + t.Format("15:04:05")
time.Sleep(500 * time.Millisecond)
LcdText[3] = b.Client.Self.Comment
LcdDisplay(LcdText, LCDRSPin, LCDEPin, LCDD4Pin, LCDD5Pin, LCDD6Pin, LCDD7Pin, LCDInterfaceType, LCDI2CAddress)
}
if OLEDEnabled {
oledDisplay(false, 1, 1, "Status at "+t.Format("15:04:05"))
oledDisplay(false, 4, 1, b.Client.Self.Comment)
}
}
}
}
func (b *Talkkonnect) BackLightTimer() {
BackLightTime = *BackLightTimePtr
if Config.Global.Hardware.TargetBoard != "rpi" || (!LCDBackLightTimerEnabled && !OLEDEnabled && !LCDEnabled) {
return
}
if LCDEnabled {
GPIOOutPin("backlight", "on")
}
if OLEDEnabled {
Oled.DisplayOn()
}
BackLightTime.Reset(time.Duration(LCDBackLightTimeout) * time.Second)
}
func (b *Talkkonnect) TxLockTimer() {
if Config.Global.Hardware.PanicFunction.TxLockEnabled {
TxLockTicker := time.NewTicker(time.Duration(Config.Global.Hardware.PanicFunction.TxLockTimeOutSecs) * time.Second)
log.Println("info: TX Locked for ", Config.Global.Hardware.PanicFunction.TxLockTimeOutSecs, " seconds")
b.TransmitStop(false)
b.TransmitStart()
go func() {
<-TxLockTicker.C
b.TransmitStop(true)
log.Println("info: TX UnLocked After ", Config.Global.Hardware.PanicFunction.TxLockTimeOutSecs, " seconds")
}()
}
}
func (b *Talkkonnect) pingServers() {
currentconn := " Not Connected "
for i := 0; i < len(Server); i++ {
resp, err := gumble.Ping(Server[i], time.Second*1, time.Second*5)
if b.Address == Server[i] {
currentconn = " ** Connected ** "
} else {
currentconn = ""
}
log.Println("info: Server # ", i+1, "["+Name[i]+"]"+currentconn)
if err != nil {
log.Println(fmt.Sprintf("error: Ping Error %q", err))
continue
}
major, minor, patch := resp.Version.SemanticVersion()
log.Println("info: Server Address: ", resp.Address)
log.Println("info: Server Ping: ", resp.Ping)
log.Println("info: Server Version: ", major, ".", minor, ".", patch)
log.Println("info: Server Users: ", resp.ConnectedUsers, "/", resp.MaximumUsers)
log.Println("info: Server Maximum Bitrate: ", resp.MaximumBitrate)
}
}
func (b *Talkkonnect) repeatTx() {
if Config.Global.Software.Settings.RepeatTXTimes == 0 || Config.Global.Software.Settings.RepeatTXDelay == 0 {
return
}
for i := 0; i < Config.Global.Software.Settings.RepeatTXTimes; i++ {
b.TransmitStart()
b.IsTransmitting = true
time.Sleep(Config.Global.Software.Settings.RepeatTXDelay * time.Second)
b.TransmitStop(true)
b.IsTransmitting = false
time.Sleep(Config.Global.Software.Settings.RepeatTXDelay * time.Second)
if i > 0 {
log.Println("info: TX Cycle ", i)
if isrepeattx {
log.Println("info: Repeat Tx Loop Text Forcefully Stopped")
}
}
if isrepeattx {
break
}
}
}
func (b *Talkkonnect) cmdSendVoiceTargets(targetID uint32) {
GenericCounter = 0
for _, account := range Config.Accounts.Account {
if account.Default {
for _, vtvalue := range account.Voicetargets.ID {
if GenericCounter == AccountIndex {
if vtvalue.Value == targetID {
log.Println("debug: Account Index ", GenericCounter, vtvalue)
log.Printf("debug: User Requested VT-ID %v\n", vtvalue.Value)
for _, vtuser := range vtvalue.Users.User {
b.VoiceTargetUserSet(vtvalue.Value, vtuser)
}
for _, vtchannel := range vtvalue.Channels.Channel {
b.VoiceTargetChannelSet(vtvalue.Value, vtchannel.Name, vtchannel.Recursive, vtchannel.Links, vtchannel.Group)
}
}
}
}
GenericCounter++
}
}
}
func (b *Talkkonnect) VoiceTargetUserSet(TargetID uint32, TargetUser string) {
if len(TargetUser) == 0 && TargetID == 0 {
TargetUser = b.Client.Self.Name
}
vtUser := b.Client.Users.Find(TargetUser)
if (vtUser != nil) && (TargetID <= 31) {
vtarget := &gumble.VoiceTarget{}
vtarget.ID = TargetID
vtarget.AddUser(vtUser)
b.Client.VoiceTarget = vtarget
if TargetID > 0 {
log.Printf("debug: Added User %v to VT ID %v\n", TargetUser, TargetID)
b.sevenSegment("voicetarget", strconv.Itoa(int(TargetID)))
GPIOOutPin("voicetarget", "on")
} else {
//b.VoiceTarget.Clear()
GPIOOutPin("voicetarget", "off")
log.Println("debug: Cleared Voice Targets")
b.sevenSegment("voicetarget", strconv.Itoa(int(TargetID)))
}
b.Client.Send(vtarget)
} else {
log.Printf("error: Cannot Add User %v to VT ID %v\n", TargetUser, TargetID)
}
}
func (b *Talkkonnect) VoiceTargetChannelSet(targetID uint32, targetChannelName string, recursive bool, links bool, group string) {
if len(targetChannelName) == 0 {
return
}
vtarget := &gumble.VoiceTarget{}
vtarget.ID = targetID
vChannel := b.Client.Channels.Find(targetChannelName)
//find root channel name workarround
var RootChannelName string
var RootChannel *gumble.Channel
for _, v := range b.Client.Channels {
if v.ID == 0 {
RootChannelName = v.Name
RootChannel = v
}
}
if targetChannelName == RootChannelName {
vChannel = RootChannel
vtarget.AddChannel(vChannel, recursive, links, group)
b.Client.VoiceTarget = vtarget
b.Client.Send(vtarget)
log.Printf("debug: Shouting to Root Channel %v to VT ID %v with recursive %v links %v group %v\n", vChannel.Name, targetID, recursive, links, group)
GPIOOutPin("voicetarget", "off")
b.sevenSegment("voicetarget", strconv.Itoa(int(targetID)))
return
}
if vChannel == nil {
log.Printf("error: Child Channel %v Not Found!\n", targetChannelName)
return
}
vtarget.AddChannel(vChannel, recursive, links, group)
b.Client.VoiceTarget = vtarget
b.Client.Send(vtarget)
log.Printf("debug: Shouting to Child Channel %v to VT ID %v with recursive %v links %v group %v\n", vChannel.Name, targetID, recursive, links, group)
b.sevenSegment("voicetarget", strconv.Itoa(int(targetID)))
if targetID > 0 {
GPIOOutPin("voicetarget", "on")
}
}
func (b *Talkkonnect) findChannelIndex(currentChannelID uint32) int {
index := 0
for _, ch := range ChannelsList {
if ch.chanID == int(currentChannelID) {
return index
}
index++
}
return 0
}
func (b *Talkkonnect) findChannelDetailsByID(ChannelID uint32, index int) {
for _, ch := range b.Client.Channels {
if ch.ID == ChannelID {
ChannelsList[index].chanName = ch.Name
ChannelsList[index].chanParent = ch.Parent
ChannelsList[index].chanUsers = ch.Users
ChannelsList[index].chanenterPermissions = true
}
}
}