Ejemplo n.º 1
0
void applet_adcpacket(m2session* session) {
/// This is an OpenTag session Applet.  It gets called by the kernel when the
/// communication task (session) that it is attached-to gets activated by the
/// kernel.  The kernel will wait until a currently-running communication task
/// is over before starting a new one.
///
/// In order to create a new communication task and bind this applet to it, use
/// m2task_immediate() or one of the other tasker functions.
///
/// This applet does two things:
/// 1. Do an ADC capture
/// 2. Build a DASH7 UDP packet that includes PaLFI data and the ADC values
///    that were just captured.  The app protocol inside UDP is a generic TLV.
///
/// @note The kernel automatically detaches the applet from the session after
/// it runs.  You can reattach in this function code by setting:
/// session->applet = &applet_adcpacket;
/// However, there is no reason to do so in this application, because the
/// communication method is not a persistent stream or query.  It is just a
/// single Push+ACK.  Retries are managed internally by the session.
///
    ot_int data_buffer[2];
    sub_adc_measurement(data_buffer);
    sub_build_uhfmsg(data_buffer);
}
Ejemplo n.º 2
0
/** PaFLi Application Functions
  * ========================================================================<BR>
  *
  */
ot_bool sub_loaduhf() {
/// Attach this applet to the kernel applet loader.  It will do an ADC capture
/// and build a DASH7 UDP packet (using a generic app protocol).  After it runs
/// it always clears the applet loader to null, so it only runs once.
    ot_int data_buffer[2];
    sub_adc_measurement(data_buffer);
    sub_build_uhfmsg(data_buffer);
    
    sys.loadapp = &sys_loadapp_null;
    return True;
}