Set PTT with Terminal or Script

Ice/DBus, Web-Interfaces, Management tools

Set PTT with Terminal or Script

Postby stephensworld » Sun Oct 04, 2015 2:58 pm

Hi,

is it possible to set the PTT and get the status if someone is talking for example on terminal or with script?

Background: We would like to connect two or more amateur radio repeaters.
We don't want to use VOX because there is too much delay and we have the possibility to get the information if someone is talking on the repeater.

If someone ist talking on repeater 1 I get a high level on gpio or rs232 and the mumble client should set the PTT and send the audio. On the other side repeater 2 see that someone is talking on mumble. So mumble should set a gpio to high and repeater 2 goes on air.

Thank you very much.

Stephan
stephensworld
 
Posts: 6
Joined: Sun Oct 04, 2015 2:44 pm

Re: Set PTT with Terminal or Script

Postby stephensworld » Sun Oct 18, 2015 11:59 pm

Hi,

thank you to hacst who helped me to find a solution.

Stephan


on raspberry pi2 i had to extend the swap file

Code: Select all
sudo su -c 'echo "CONF_SWAPSIZE=2048" > /etc/dphys-swapfile'
sudo dphys-swapfile setup
sudo dphys-swapfile swapon


add this line in main.pro
Code: Select all
LIBS = -lwiringPi -lwiringPiDev


new public slot in MainWindow.h
Code: Select all
void onGpioPoll();


MainWindow.cpp
Code: Select all
void MainWindow::onGpioPoll() {

 static bool pttGpioPrevState = false;
 static bool pttGpioState = false;
 if (digitalRead(25)==1) {
        pttGpioState=true;
 }

if (digitalRead(25)==0) {
        pttGpioState=false;
 }

if (pttGpioState != pttGpioPrevState) {
   on_PushToTalk_triggered(pttGpioState, QVariant());
   pttGpioPrevState = pttGpioState;
 }

 QList<ClientUser *> talkingUsers = ClientUser::getTalking();
 // For someone else to be talking we have to be connected to the
 //server and there must be at least one person talking that isn't ourselves
 static bool pttPrev = false;
 const bool someoneElseTalking = g.sh && !(talkingUsers.empty() ||
 (talkingUsers.size() == 1 && g.uiSession ==
 talkingUsers.first()->uiSession));

 if (someoneElseTalking) {
        if(!pttPrev){
                digitalWrite(10, 1);
                pttPrev=true;
        }
 }

if(!someoneElseTalking){
        if (pttPrev){
                digitalWrite(10, 0);
                pttPrev=false;
         }
}

}



Code: Select all
   
QTimer *gpioPollingTimer = new QTimer(this);
connect(gpioPollingTimer, SIGNAL(timeout()), this, SLOT(onGpioPoll()));
gpioPollingTimer->start(100); // 100ms polling Intervall


main.cpp
Code: Select all
#include <wiringPi.h>
.....
wiringPiSetupSys();
pinMode(10,OUTPUT);
pinMode(25,INPUT);
Last edited by stephensworld on Sun Apr 10, 2016 2:54 pm, edited 3 times in total.
stephensworld
 
Posts: 6
Joined: Sun Oct 04, 2015 2:44 pm

Re: Set PTT with Terminal or Script

Postby freakbeat » Wed Dec 02, 2015 9:23 pm

Hello, did the code work?? do you have it compiled? how i can get a copy of it? i would like to try on a radio-LINK

thanks
freakbeat
 
Posts: 6
Joined: Tue Dec 01, 2015 4:58 pm

Re: Set PTT with Terminal or Script

Postby stephensworld » Thu Dec 03, 2015 1:21 am

Yes it is working. We use it on the 2m repeater DB0FFL
I have a compiled version for Raspberry 2.

Stephan, DL4STE
stephensworld
 
Posts: 6
Joined: Sun Oct 04, 2015 2:44 pm

Re: Set PTT with Terminal or Script

Postby freakbeat » Thu Dec 03, 2015 10:15 pm

Stephan, can you give me some clues on this?? i have a little knowledge about linux and C++, tell me if i'm right, do you built the environment to compile mumble? then you modified the files MainWindow.cpp MainWindow.h and main.cpp and after that did you compile the code? let me know if you can share the modified files and help me compiling under Pi 2.

thanks
freakbeat
 
Posts: 6
Joined: Tue Dec 01, 2015 4:58 pm

Re: Set PTT with Terminal or Script

Postby freakbeat » Thu Dec 03, 2015 10:25 pm

Another question, on the INPUT pin what do you connect? i can see that the OUTPUT is to activate the TX on the repeaters but i don't know if using only for radio link i need to take out from the code.
freakbeat
 
Posts: 6
Joined: Tue Dec 01, 2015 4:58 pm

Re: Set PTT with Terminal or Script

Postby stephensworld » Sun Dec 06, 2015 12:51 am

I did the following steps

you need to install some development packages:
Code: Select all
apt-get install build-essential pkg-config qt4-dev-tools libqt4-dev libspeex1 \
                libspeex-dev libboost-dev libasound2-dev libssl-dev g++ \
                libspeechd-dev libzeroc-ice-dev ice-slice libpulse-dev slice2cpp \
                libcap-dev libspeexdsp-dev libprotobuf-dev protobuf-compiler \
                libogg-dev libavahi-compat-libdnssd-dev libsndfile1-dev \
                libg15daemon-client-dev libxi-dev

for more information please see http://wiki.mumble.info/wiki/BuildingLinux

Code: Select all
git clone https://github.com/mumble-voip/mumble.git


you have to edit the source files as shown above.

on the raspberry 2 I compiled with the following commands

Code: Select all
qmake -recursive main.pro CONFIG+="qt4-legacy-compat no-g15 no-server" LIBS+="-lwiringPi"
make


If you have any further questions don't hesitate to contact me.

The solution is great. We have many users on the repeater with mumble. Our next step is to connect two or more repeater.
Last edited by stephensworld on Mon Apr 11, 2016 5:08 pm, edited 1 time in total.
stephensworld
 
Posts: 6
Joined: Sun Oct 04, 2015 2:44 pm

Re: Set PTT with Terminal or Script

Postby freakbeat » Mon Dec 07, 2015 10:36 pm

Nice, i will try!! just another question, the INPUT PIN 25 where it goes?? i know the output is for put the repeater on TX and send the audio but the input pin? i don't get it. thanks
freakbeat
 
Posts: 6
Joined: Tue Dec 01, 2015 4:58 pm

Re: Set PTT with Terminal or Script

Postby stephensworld » Mon Dec 07, 2015 11:19 pm

With the input pin you can set the mumble PTT in direction repeater receiver to mumble.
You do not have to use the mumble vox. So you can reduce the delay.
stephensworld
 
Posts: 6
Joined: Sun Oct 04, 2015 2:44 pm

Re: Set PTT with Terminal or Script

Postby Nonolivier » Tue Jan 19, 2016 3:57 pm

Hello,

I have post the same question few month ago.

I complete the request if someone feels the soul to develop.

In the left column we would like to add a section "radio bridge".

1. generality

In this section on the right window, you can enable or disable the PTT feature.

If enabled, you must be able to choose between a GPIO for raspberry or Send a message to a COM port or a sinusoidal signal on the left or right channel of the sound card.


2. How to PTT

For the GPIO should be able to choose the number of GPIO.

For the COM port should be selected COM port and send the message for transmission of activation and the message to stop transmission.

For sinusoidal no particular things set apart which will be sent to the maximum level that can go out the sound card (1v ridge to ridge).


3. Secondary functions


a) TOT
Then we should have a TOT function (stop talker) which limits the time the relay is transmitting.


b) delays
There should be minimal delay before activating the transmission, to avoid tripping intenpestifs (value set in the window, but by default 500ms).

Finally, it should have a minimum time after the end of discution that the relay does not stop intenpestivement (value set in the window, but by default 500ms).


Thank you in advance if the soul of a friendly developer wants to contribute to our efforts.
Several team of amateur radio or CB enthusiasts create parallel communication networks thanks to that, but we do not have enough developers.
Nonolivier
 
Posts: 4
Joined: Thu Sep 24, 2015 12:05 pm

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest