The B9X Voice Client Library For Android works seamlessly with the B4A- Basic For Android development environment. Just save the two library files to your Additional Libraries folder, load the example project, compile, and install the example on your Android phone/Tablet/device. The B9X Voice Client SDK For Android includes a B4A library Module. This is free of charge and distributable, as an embedded library, in your .apk file or app bundle file. There are no royalties when used with any purchased version of B9X Voice Server(TM).
The above link is to the B9X Voice Client SDK For Android. This file includes the required b4a library and a sample app. You can install it on the computer running Basic For Android(b4a) from Anywhere Software. With the sample app on your phone, you can connect to B9X Voice Server(TM) using the ip, of the machine that is running our server, and the default port of 18000. In the example project, be sure to first set the IP of the PC running the B9X Voice Server(TM).
With 2 smart phones connected to our server, the 2 smart phones can communicate with each other. If more smart phones are connected, they can also communicate with the group.
The description of the library’s methods and subs are described below. The ‘Additional Methods’ section are only provided if communicating with one or more B9X Radios:
Initialize(vCallback As Object, vEventName As String) – Initialize the library. This must be called before calling any other methods.
- vCallback – set to Me.
- vEventName – This is the name of the event that will receive status messages. If the eventName is set to “vx”, then a sub you create, “Sub vx_messageReceived(msg As String)” will be called when status messages are received.
vSetkey(sKey As String) – This sets the key for encryption of the connection to and from the server.
- sKey – This key is required, must be exactly 32 bytes long, and must be identical to the key set at the server.
vClearKey – This clears the key. The library will not be able to connect to the server if the key is cleared.
vConnect(password As String)- This method connects to the B9X Voice Server(TM). Once connected to the server, real time audio chat with other clients can take place.
- password – The password is required. The server has two passwords to set. The Admin Password, at the server, allows for both voice chat and broadcast messages. The Password, at the server, allows only voice chat.
Returns: The “[CONNECT_OK]” message will be returned in the vx_messageReceived event indicating that a successful connection was established with the server.
vClose(password As String) – This method closes the previous vConnect to the B9X Voice Server(TM). Once vClose is called, real time audio chat with other stops.
- password -The password is required. You should use the same password that you used to vConnect.The server has two passwords to set. The Admin Password, at the server, allows for both voice chat and broadcast messages. The Password, at the server, allows only voice chat.
Returns: The “[CLOSE_OK]” message will be returned in the vx_messageReceived event indicating that the current connection was closed with the server.
vSetHost(sHost As String) – This method sets the host or ip used to connect to, along with other activities, B9X Voice Server(TM).
- sHost – the ip address or hostname of the server.
vSetPort(sPort As Int) – This method sets the port used to connect to, along with other activities, B9X Voice Server(TM).
- sPort – the port number of the server.
vSetListenPort(sPort As Int) – This method sets the port number that your app will listen on. This port will receive the audio and broadcast messages from the server.
- sPort – The port number this client will listen on. This port number must be unique and cannot be a reserved or well established UDP ports. This port cannot be the same as the port set at the server.
vStartListening() – This method will start your app to listen for audio and status messages. Received audio will be heard by your phone’s speaker, etc.
Returns: “[VOICE_RECEIVE_ON][ip][port]” indicating voice audio was received from the server, at the ip and port of the server.
and “[VOICE_RECEIVE_OFF]” indicates that receiving voice audio stopped. These messages are received in the vx_messageReceived event.
vStopListening() – This method will stop your app from listening for audio and status messages
vStartSending() – This method will start sending audio, from your phone’s mic, to the server and any connected clients at the server.
Returns: “[START_SENDING]” – the vStartSending method was invoked. This message is received in the vx_messageReceived event.
vStopSending() – This method will stop sending audio to the server and any connected clients at the server.
Returns: “[STOP_SENDING]” – the vStopSending method was invoked. This message is received in the vx_messageReceived event.
vBroadcast(bMsg As String) – This method will send text to the server and any of its connected clients. You must have previously connected to the server with the Admin Password that was set at the server. You cannot use the characters: ‘[‘, ‘]’, ‘<‘ or ‘>’
Returns: “[BCAST_OK]” – the text you sent was sent successfuly to the server. This text, bMsg, is also sent to any server connected clients via UDP. This message is received in the vx_messageReceived event.
vSetVOXTrigger(voxValue As Int) – This method will enable or disable voice activated sending of audio.
- voxValue – VOX sensitivity. To disable the VOX, set this value to zero. To enable the VOX set this value to a value greater than zero. A typical value is 3000 is a good VOX sensitivity.
Returns: “[VOX_TRIGGER_ON]” – the voice from the mic was triggered and “[VOX_TRIGGER_OFF]” – the voice from the mic stopped. These messages are received in the vx_messageReceived event.
vx_messageReceived(msg As String) – Define this sub so that your app will receive status messages. The prefix “vx” is set in the Initialize method as the string parameter vEventName.
Additional messages not defined below are:
“[VOX_TRIGGER_ON]” – the voice from the mic was triggered.
“[VOX_TRIGGER_OFF]” – the voice from the mic stopped.
“[PING]” – this string is sent periodically by the server to this client indicating an active connection to the server.
<SQUELCH_ON><nodeName of radio><signal level> – squelch open on radio with identifier nodeName.
<SQUELCH_OFF><nodeName of radio> – squelch closed on radio with identifier nodeName.
<DTMF_DIGITS><nodeName of radio><digits received> – dtmf digits received on radio with identifier nodeName.
Sub vx_messageReceived(msg As String)
'to do
End Sub
Additional Methods
vGetSMeter(nodeName as String) – This method will retrieve the signal strength of any signals received on B9XRadio that has nodeName as its identifier.
Returns: <GETSMETER_OK><nodeName of radio><signal level> This message is received in the vx_messageReceived event.
vSetChannel(nodeName As String, channel As String) – This method sets the channel of the B9XRadio with the provided nodeName. Channels are defined in the channels.txt file that can be found on the sdcard’s top directory. The sdcard is found on B9XRadio’s sdcard slot.
Returns: <SETCHANNEL_OK><nodeName of radio> This message is received in the vx_messageReceived event.
vSetRadio(nodeName As String, rv As RadioValues) – This method sets the B9XRadio’s frequency and other operating parameters of the B9XRadio with the provided nodeName. The structure rv are the values that you can set. The RadioValues structure is defined as:
Type RadioValues(bandwidth As Int, transmitFreq As Double, receiveFreq As Double, txCTCSS As Double, squelch As Int, rxCTCSS As Double)
- bandwidth – 0 sets 12.5khz and 1 sets 25khz
- transmitFreq – the B9XRadio’s frequency to transmit on. A value of 425.4 is 425.4 Mhz
- receiveFreq – the B9XRadio’s frequency to receive on. A value of 425.4 is 425.4 Mhz
- txCTCSS – the B9XRadio’s CTCSS tone(any standard tone) to include when transmitting.
- squelch – the squelch level. Can be a value of 1 to 8. 0 value opens the squelch where you hear channel noise.
- rxCTCSS – the B9XRadio’s CTCSS tone(any standard tone) to open the squelch when receiving.
Returns: <SETRADIO_OK><nodeName of radio> This message is received in the vx_messageReceived event.
vStartPlay(nodeName as String) – This method will initialize the transmitting of .wav files from B9XRadio’s sdcard that has nodeName as its identifier.
Returns: <TTSSTART_OK><nodeName> of radio> This message is received in the vx_messageReceived event.
vAddFileToPlay(nodeName as String, fname as string) – This method will queue a wav file to transmit from B9XRadio’s sdcard that has nodeName as its identifier and fname as wav file. The fname uses the 8×3 convention like “xxxxxxxx.wav”. Files found in top level directory do not require a drive or path name, like xxxxxxxx.wav. If they are in a directory like myfiles, you specify the string as “myfiles/xxxxxxxx.wav”.
Returns: <TTSADDFILE_OK><nodeName of radio> This message is received in the vx_messageReceived event.
vAddNumberToPlay(nodeName as String, num as double) – This method will queue a number, num, to transmit over the B9XRadio that has nodeName as its identifier.
Returns: <TTSADDFILE_OK><nodeName of radio> This message is received in the vx_messageReceived event.
vAddCharactersToPlay(nodeName as String, chs as string) – This method will queue a string of characters, chs to transmit over the B9XRadio that has nodeName as its identifier. Valid characters are ‘a’ to ‘z’ and ‘0’ to ‘9’. Spaces can be added to introduce a pause in playing.
Returns: <TTSADDCHARACTERS_OK><nodeName of radio> This message is received in the vx_messageReceived event.
vPlayAll(nodeName as String) – This method will key the transmitter, play any files or values previously queued, and then un-key the transmitter. over the B9XRadio that has nodeName as its identifier.
Returns: <TTSPLAYALL_OK><nodeName of radio> This message is received in the vx_messageReceived event.
References And Disclaimer
B9X Electronics
Website: https://b9xelectronics.com
B9X Voice Server™ and B9X Voice Client™ are trademarks of B9X Electronics.
Windows™ is a trademark of Microsoft Corporation.
Android™ and Google™ are trademarks of Google.
Yaesu™ and products mentioned are trademarks of Yaesu/Vertex Standard.
Icom™ and products mentioned are trademarks of Icom.
All other references are trademarks and copyrights of their respective holders.
The specifications in this document are only given to provide information, without any guarantee in regards to either mistakes or omissions. B9X Electronics reserves the right to make changes to the products contained in this publication for any reason.
IN NO EVENT WILL B9X ELECTRONICS BE LIABLE TO YOU OR ANYONE FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO INJURY TO PERSON OR PRODUCT, LOST PROFITS, LEGAL COSTS, LOST SAVINGS, OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THIS AND ANY OF OUR PRODUCTS.