Atmel Software Framework

ieee11073_skeleton.c File Reference

Sample of IEE11073 Communication Model.

Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.

#include "asf.h"
#include "ieee11073_skeleton.h"

Macros

#define IEEE11073_ASSOC_ABORT   0
 
#define IEEE11073_ASSOC_RUNNING   1
 
#define IEEE11073_ASSOC_VALIDED   2
 
#define IEEE11073_LGT_METADATA_IN   80
 
#define IEEE11073_LGT_METADATA_OUT   80
 
#define IEEE11073_LGT_OPAQUEDATA_IN   10
 
#define IEEE11073_LGT_OPAQUEDATA_OUT   10
 

Functions

static bool ieee11073_decode_metadata (void)
 Start the data reception on communication line. More...
 
static bool ieee11073_enable_reception (void)
 Start the reception of data on communication line. More...
 
void ieee11073_received (bool status, uint16_t nb_received)
 Callback called when a data is received. More...
 
static bool ieee11073_send_association (void)
 
static bool ieee11073_send_mesure (uint8_t qos)
 
void ieee11073_sent (uint16_t nb_send)
 Callback called when a data is sent. More...
 
void ieee11073_skeleton_disable (void)
 Disable the communication model processing. More...
 
bool ieee11073_skeleton_enable (void)
 Enable the communication model processing. More...
 
bool ieee11073_skeleton_process (void)
 Function to process communication model Must be scheduled by other process. More...
 
void ieee11073_skeleton_send_measure_1 (void)
 Send a measure on communication line. More...
 
void ieee11073_skeleton_send_measure_2 (void)
 Send a measure on communication line. More...
 

Variables

uint8_t ieee11073_g_metadata_in [IEEE11073_LGT_METADATA_IN]
 
uint8_t ieee11073_g_metadata_out [IEEE11073_LGT_METADATA_OUT]
 
uint8_t ieee11073_g_opaquedata_in [IEEE11073_LGT_OPAQUEDATA_IN]
 
uint8_t ieee11073_g_opaquedata_out [IEEE11073_LGT_OPAQUEDATA_OUT]
 
udi_phdc_metadata_t ieee11073_g_phdc_metadata_in
 
udi_phdc_metadata_t ieee11073_g_phdc_metadata_out
 
uint8_t phd_assoc_req []
 
uint8_t phd_attr []
 
uint8_t phd_measure []
 
static uint8_t udi_phdc_assoc_state
 

#define IEEE11073_ASSOC_ABORT   0
#define IEEE11073_ASSOC_RUNNING   1
#define IEEE11073_ASSOC_VALIDED   2
#define IEEE11073_LGT_METADATA_IN   80
#define IEEE11073_LGT_METADATA_OUT   80
#define IEEE11073_LGT_OPAQUEDATA_IN   10
#define IEEE11073_LGT_OPAQUEDATA_OUT   10

static bool ieee11073_decode_metadata ( void  )
static
static bool ieee11073_enable_reception ( void  )
static
void ieee11073_received ( bool  status,
uint16_t  nb_received 
)

Callback called when a data is received.

Parameters
nb_receivedNumber of data received

References ieee11073_decode_metadata(), ieee11073_enable_reception(), and udi_phdc_metadata_t::metadata_size.

Referenced by ieee11073_enable_reception().

void ieee11073_sent ( uint16_t  nb_send)

Callback called when a data is sent.

Parameters
nb_sendNumber of data sent

References IEEE11073_ASSOC_ABORT, IEEE11073_ASSOC_RUNNING, and udi_phdc_assoc_state.

Referenced by ieee11073_decode_metadata(), ieee11073_send_association(), and ieee11073_send_mesure().

void ieee11073_skeleton_disable ( void  )

Disable the communication model processing.

Referenced by main_phdc_disable().

bool ieee11073_skeleton_enable ( void  )

Enable the communication model processing.

Return values
true

References ieee11073_enable_reception(), and ieee11073_send_association().

Referenced by main_phdc_enable().

bool ieee11073_skeleton_process ( void  )

Function to process communication model Must be scheduled by other process.

References IEEE11073_ASSOC_VALIDED, and udi_phdc_assoc_state.

Referenced by main().

void ieee11073_skeleton_send_measure_1 ( void  )

Send a measure on communication line.

References ieee11073_send_mesure(), and USB_PHDC_QOS_LOW_GOOD.

void ieee11073_skeleton_send_measure_2 ( void  )

Send a measure on communication line.

References ieee11073_send_mesure(), and USB_PHDC_QOS_MEDIUM_BETTER.

uint8_t ieee11073_g_metadata_in[IEEE11073_LGT_METADATA_IN]
uint8_t ieee11073_g_metadata_out[IEEE11073_LGT_METADATA_OUT]
uint8_t ieee11073_g_opaquedata_in[IEEE11073_LGT_OPAQUEDATA_IN]
uint8_t ieee11073_g_opaquedata_out[IEEE11073_LGT_OPAQUEDATA_OUT]
udi_phdc_metadata_t ieee11073_g_phdc_metadata_in
udi_phdc_metadata_t ieee11073_g_phdc_metadata_out
uint8_t phd_assoc_req[]
Initial value:
= {
0xE2, 0x00,
0x00, 0x32,
0x80, 0x00, 0x00, 0x00,
0x00, 0x01,
0x00, 0x2A,
0x50, 0x79,
0x00, 0x26,
0x80, 0x00, 0x00, 0x00,
0x80, 0x00,
0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x00, 0x00,
0x00, 0x08,
0x4C, 0x4E, 0x49, 0x41, 0x47, 0x45, 0x4E, 0x54,
0x40, 0x00,
0x00, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00
}

Referenced by ieee11073_send_association().

uint8_t phd_attr[]
Initial value:
= {
0xE7, 0x00, 0x00, 0x6E, 0x00, 0x6C, 0x00, 0x02, 0x02, 0x03, 0x00, 0x66,
0x00, 0x00, 0x00, 0x06,
0x00, 0x60, 0x0A, 0x5A, 0x00, 0x08, 0x00, 0x01, 0x00, 0x04, 0x10, 0x0F,
0x00, 0x01, 0x09, 0x28,
0x00, 0x1A, 0x00, 0x0A, 0x46, 0x72, 0x65, 0x65, 0x73, 0x63, 0x61, 0x6C,
0x65, 0x20, 0x00, 0x0C, 0x4D, 0x65,
0x64, 0x69, 0x63, 0x61, 0x6C, 0x20, 0x43, 0x46, 0x56, 0x31, 0x09, 0x84,
0x00, 0x0A,
0x00, 0x08, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x0a, 0x44,
0x00, 0x02, 0x40, 0x00,
0x09, 0x2D, 0x00, 0x12, 0x00, 0x01, 0x00, 0x0E, 0x00, 0x01, 0x00, 0x00,
0x00, 0x08, 0x44, 0x45,
0x31, 0x32, 0x34, 0x35, 0x36, 0x37, 0x09, 0x87, 0x00, 0x08, 0x20, 0x09,
0x06, 0x12,
0x12, 0x05, 0x00, 0x00
}

Referenced by ieee11073_decode_metadata().

uint8_t phd_measure[]
Initial value:
= {
0xE7, 0x00, 0x00, 0x5A, 0x00, 0x58, 0x12, 0x36, 0x01, 0x01, 0x00, 0x52,
0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0D, 0x1D, 0x00, 0x48, 0xF0, 0x00, 0x00, 0x00,
0x00, 0x04,
0x00, 0x40, 0x00, 0x01, 0x00, 0x0C, 0xFF, 0x00, 0x02, 0xFA, 0x20, 0x07,
0x12, 0x06,
0x12, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0C, 0xFF, 0x00, 0x00, 0xF3,
0x20, 0x09, 0x06, 0x12,
0x12, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0C, 0xFF, 0x00, 0x02, 0xF8,
0x20, 0x09, 0x06, 0x12,
0x20, 0x05, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0C, 0xFF, 0x00, 0x00, 0xF2,
0x20, 0x09, 0x06, 0x12,
0x20, 0x05, 0x00, 0x00
}

Referenced by ieee11073_send_mesure().