Difference between revisions of "BCL programming tips"

(New page: == How to use LINK == == RTP streaming == * MP3 bit reservoir == Audio handling == * reading/writing must happen in "real time" == Tips for writing efficient programs == * use ON var GO...)
 
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
== How to use LINK ==
== Network Address ==
* ''Can I get the device's current IP in my BCL program?''
Yes, to do so use '''SPRINTF$''' with the '''%A''' format string:
 
<pre>
ip$=SPRINTF$("%A",1)
</pre>
 
The '''ip$''' will contain e.g.:
 
192.168.2.100
 
To obtain  the IP address with leading zeroes use:
 
ip$=SPRINTF$("%1A",1)
 
The '''ip$''' will then contain e.g.:
 
192.168.002.100
 
See more in the chapter Formatted String Conversions - SPRINTF of the BCL Programmers Manual.
 
== RTP decoding ==
* using LINK


== RTP streaming ==
== RTP streaming ==
* MP3 bit reservoir
* MP3 bit reservoir


== Audio handling ==
== Audio handling ==
* reading/writing must happen in "real time"
* reading/writing must happen in "real time"


== Tips for writing efficient programs ==
== Tips for writing efficient programs ==
* use ON var GOTO
* use ON var GOTO
* do not use large if then or nested if then
* do not use large if then or nested if then


== UDP reception ==
== UDP reception ==
* lastlen trick
* lastlen trick
* must proceed all UDP packets in the handler
* must proceed all UDP packets in the handler


== Multicast ==
== Multicast ==
* open UDP handle with a multicast address
BCL supports up to 16 IP multicast groups at a time. The subscription, periodic membership reporting as well as group leaving is performed automatically by the firmware and does not have to be handled by the BCL application. IGMP version 1 and 2 is supported.
 
===Subscribing to a group===
To subscribe to a multicast group enter the desired multicast address to the UDP open statement.
 
Example:
<pre>
OPEN "UDP:224.10.1.3:5000" as 1
</pre>
 
===Leaving the group===
The group is automatically left if the respective handle is closed:
 
<pre>
CLOSE 1
</pre>
 
 


== UDP source/destination ports ==
== UDP source/destination ports ==
* source port is the same as the port in the open statement
* source port is the same as the port in the open statement
== How to get more variables ==
The current BCL interpreter supports only up to 96 integer and string variables. In complex programs this can be a significant limitation.
You can increase the actual number of integer variables in the program by using integer arrays.
Back to [[Main_Page#Software_Topics]]

Latest revision as of 13:11, 10 April 2013

Network Address

  • Can I get the device's current IP in my BCL program?

Yes, to do so use SPRINTF$ with the %A format string:

ip$=SPRINTF$("%A",1)

The ip$ will contain e.g.:

192.168.2.100

To obtain the IP address with leading zeroes use:

ip$=SPRINTF$("%1A",1)

The ip$ will then contain e.g.:

192.168.002.100

See more in the chapter Formatted String Conversions - SPRINTF of the BCL Programmers Manual.

RTP decoding

  • using LINK

RTP streaming

  • MP3 bit reservoir


Audio handling

  • reading/writing must happen in "real time"


Tips for writing efficient programs

  • use ON var GOTO
  • do not use large if then or nested if then


UDP reception

  • lastlen trick
  • must proceed all UDP packets in the handler


Multicast

BCL supports up to 16 IP multicast groups at a time. The subscription, periodic membership reporting as well as group leaving is performed automatically by the firmware and does not have to be handled by the BCL application. IGMP version 1 and 2 is supported.

Subscribing to a group

To subscribe to a multicast group enter the desired multicast address to the UDP open statement.

Example:

OPEN "UDP:224.10.1.3:5000" as 1

Leaving the group

The group is automatically left if the respective handle is closed:

CLOSE 1


UDP source/destination ports

  • source port is the same as the port in the open statement

How to get more variables

The current BCL interpreter supports only up to 96 integer and string variables. In complex programs this can be a significant limitation. You can increase the actual number of integer variables in the program by using integer arrays.


Back to Main_Page#Software_Topics