Stima V4 Slave RAIN  4.2
CanTask Class Reference

CAN TASK cpp_freertos class. More...

#include <can_task.h>

Inheritance diagram for CanTask:

Public Member Functions

 CanTask (const char *taskName, uint16_t stackSize, uint8_t priority, CanParam_t canParam)
 Construct the Can Task::CanTask object Main TASK && INIT TASK — UAVCAN. More...
 

Protected Member Functions

virtual void Run ()
 RUN Task. More...
 

Private Types

enum  State_t { CAN_STATE_CREATE , CAN_STATE_INIT , CAN_STATE_SETUP , CAN_STATE_CHECK }
 Enum for state switch of running method. More...
 

Private Member Functions

void TaskWatchDog (uint32_t millis_standby)
 local watchDog and Sleep flag Task (optional) More...
 
void TaskState (uint8_t state_position, uint8_t state_subposition, task_flag state_operation)
 local suspend flag and positor running state Task (optional) More...
 

Static Private Member Functions

static void HW_CAN_Power (CAN_ModePower ModeCan)
 Enable Power CAN_Circuit TJA1443. More...
 
static void getUniqueID (uint8_t out[uavcan_node_GetInfo_Response_1_0_unique_id_ARRAY_CAPACITY_], uint64_t serNumb)
 Ritorna unique-ID 128-bit del nodo locale. E' utilizzato in uavcan.node.GetInfo.Response e durante plug-and-play node-ID allocation da uavcan.pnp.NodeIDAllocationData. SerialNumber, Produttore.. Dovrebbe essere verificato in uavcan.node.GetInfo.Response per la verifica non sia cambiato Nodo. Al momento vengono inseriti 2 BYTE fissi, altri eventuali, che Identificano il Tipo Modulo. More...
 
static CanardPortID getModeAccessID (uint8_t modeAccessID, const char *const port_name, const char *const type_name)
 Legge il subjectID per il modulo corrente per la risposta al servizio di gestione dati. More...
 
static bool putFlashFile (const char *const file_name, const bool is_firmware, const bool rewrite, void *buf, size_t count)
 Scrive dati in append su Flash per scrittura sequenziale file data remoto. More...
 
static bool getFlashFwInfoFile (uint8_t *module_type, uint8_t *version, uint8_t *revision, uint64_t *len)
 GetInfo for Firmware File on Flash. More...
 
static void prepareSensorsDataValue (uint8_t const sensore, const report_t *report, rmap_module_Rain_1_0 *rmap_data)
 Prepara il blocco messaggio dati per il modulo corrente istantaneo NB: Aggiorno solo i dati fisici in questa funzione i metadati sono esterni. More...
 
static void prepareSensorsDataValue (uint8_t const sensore, const report_t *report, rmap_service_module_Rain_Response_1_0 *rmap_data)
 
static void publish_rmap_data (canardClass &clsCanard, CanParam_t *param)
 Pubblica i dati RMAP con il metodo publisher se abilitato e configurato. More...
 
static void processMessagePlugAndPlayNodeIDAllocation (canardClass &clsCanard, const uavcan_pnp_NodeIDAllocationData_1_0 *const msg)
 Plug and Play Slave, Versione 1.0 compatibile con CAN_CLASSIC MTU 8 Messaggi anonimi CAN non sono consentiti se messaggi > LUNGHEZZA MTU disponibile. More...
 
static uavcan_node_ExecuteCommand_Response_1_1 processRequestExecuteCommand (canardClass &clsCanard, const uavcan_node_ExecuteCommand_Request_1_1 *req, uint8_t remote_node)
 Chiamate gestioni RPC remote da master (yakut o altro servizio di controllo) More...
 
static rmap_service_module_Rain_Response_1_0 processRequestGetModuleData (canardClass &clsCanard, rmap_service_module_Rain_Request_1_0 *req, CanParam_t *param)
 Chiamate gestioni dati remote da master (yakut o altro servizio di controllo) More...
 
static uavcan_register_Access_Response_1_0 processRequestRegisterAccess (const uavcan_register_Access_Request_1_0 *req)
 Accesso ai registri UAVCAN risposta a richieste. More...
 
static uavcan_node_GetInfo_Response_1_0 processRequestNodeGetInfo ()
 Risposta a uavcan.node.GetInfo which Info Node (nome, versione, uniqueID di verifica ecc...) More...
 
static void processRequestUpdateRTC (canardClass &clsCanard, const uavcan_pnp_NodeIDAllocationData_1_0 *const msg)
 
static void processReceivedTransfer (canardClass &clsCanard, const CanardRxTransfer *const transfer, void *param)
 Canard CallBACK Receive message to Node (Solo con sottoscrizioni) More...
 

Private Attributes

State_t state
 
CanParam_t param
 

Static Private Attributes

static bootloader_tboot_state
 
static EEpromlocalEeprom
 
static cpp_freertos::Queue * localSystemMessageQueue
 
static uint16_t last_req_rpt_time = (REPORTS_TIME_S)
 
static uint16_t last_req_obs_time = (OBSERVATIONS_TIME_S)
 
static CAN_ModePower canPower
 
static STM32RTC & rtc = STM32RTC::getInstance()
 
static EERegisterlocalRegister
 
static cpp_freertos::BinarySemaphore * localQspiLock
 
static cpp_freertos::BinarySemaphore * localRegisterAccessLock
 
static FlashlocalFlash
 
static uint64_t canFlashPtr = 0
 
static uint16_t canFlashBlock = 0
 

Detailed Description

CAN TASK cpp_freertos class.

Definition at line 132 of file can_task.h.

Member Enumeration Documentation

◆ State_t

enum CanTask::State_t
private

Enum for state switch of running method.

Enumerator
CAN_STATE_CREATE 
CAN_STATE_INIT 
CAN_STATE_SETUP 
CAN_STATE_CHECK 

Definition at line 135 of file can_task.h.

Constructor & Destructor Documentation

◆ CanTask()

CanTask::CanTask ( const char *  taskName,
uint16_t  stackSize,
uint8_t  priority,
CanParam_t  canParam 
)

Construct the Can Task::CanTask object Main TASK && INIT TASK — UAVCAN.

Parameters
taskNamename of the task
stackSizesize of the stack
prioritypriority of the task
canParamparameters for the task

Definition at line 1131 of file can_task.cpp.

Member Function Documentation

◆ getFlashFwInfoFile()

bool CanTask::getFlashFwInfoFile ( uint8_t *  module_type,
uint8_t *  version,
uint8_t *  revision,
uint64_t *  len 
)
staticprivate

GetInfo for Firmware File on Flash.

Parameters
module_typetype module of firmware
versionversion firmware
revisionrevision firmware
lenlength of file in bytes
Returns
true if exixst

Definition at line 312 of file can_task.cpp.

◆ getModeAccessID()

CanardPortID CanTask::getModeAccessID ( uint8_t  modeAccessID,
const char *const  port_name,
const char *const  type_name 
)
staticprivate

Legge il subjectID per il modulo corrente per la risposta al servizio di gestione dati.

Parameters
modeAccessIDtipo di accesso
port_namenome porta uavcan
type_nametipo nome registro
Returns
Canard Port ID associato

Definition at line 118 of file can_task.cpp.

◆ getUniqueID()

void CanTask::getUniqueID ( uint8_t  out[uavcan_node_GetInfo_Response_1_0_unique_id_ARRAY_CAPACITY_],
uint64_t  serNumb 
)
staticprivate

Ritorna unique-ID 128-bit del nodo locale. E' utilizzato in uavcan.node.GetInfo.Response e durante plug-and-play node-ID allocation da uavcan.pnp.NodeIDAllocationData. SerialNumber, Produttore.. Dovrebbe essere verificato in uavcan.node.GetInfo.Response per la verifica non sia cambiato Nodo. Al momento vengono inseriti 2 BYTE fissi, altri eventuali, che Identificano il Tipo Modulo.

Parameters
outdata out UniqueID
serNumblocal Hardware Serial Number (64Bit) Already Send in PNP 1.0 Request (Hash 48Bit)

Definition at line 87 of file can_task.cpp.

◆ HW_CAN_Power()

void CanTask::HW_CAN_Power ( CAN_ModePower  ModeCan)
staticprivate

Enable Power CAN_Circuit TJA1443.

Parameters
ModeCan(Mode TYPE CAN_BUS)

Definition at line 43 of file can_task.cpp.

◆ prepareSensorsDataValue() [1/2]

void CanTask::prepareSensorsDataValue ( uint8_t const  sensore,
const report_t report,
rmap_module_Rain_1_0 *  rmap_data 
)
staticprivate

Prepara il blocco messaggio dati per il modulo corrente istantaneo NB: Aggiorno solo i dati fisici in questa funzione i metadati sono esterni.

Parameters
sensoretipo di sensore richiesto rmap class_canard di modulo
reportreport data
rmap_datareport data module output value per modulo sensore specifico publish oppure in overload metodo tramite metodo Response applucapile al servizio request

Definition at line 357 of file can_task.cpp.

◆ prepareSensorsDataValue() [2/2]

void CanTask::prepareSensorsDataValue ( uint8_t const  sensore,
const report_t report,
rmap_service_module_Rain_Response_1_0 *  rmap_data 
)
staticprivate

Definition at line 379 of file can_task.cpp.

◆ processMessagePlugAndPlayNodeIDAllocation()

void CanTask::processMessagePlugAndPlayNodeIDAllocation ( canardClass clCanard,
const uavcan_pnp_NodeIDAllocationData_1_0 *const  msg 
)
staticprivate

Plug and Play Slave, Versione 1.0 compatibile con CAN_CLASSIC MTU 8 Messaggi anonimi CAN non sono consentiti se messaggi > LUNGHEZZA MTU disponibile.

Parameters
clCanardclasse
msgmessaggio di pubblicazione

Definition at line 471 of file can_task.cpp.

◆ processReceivedTransfer()

void CanTask::processReceivedTransfer ( canardClass clCanard,
const CanardRxTransfer *const  transfer,
void *  param 
)
staticprivate

Canard CallBACK Receive message to Node (Solo con sottoscrizioni)

Parameters
clCanardClasse
transferTransfer CanardID
paramIndirizzo di parametri esterni opzionali

Definition at line 855 of file can_task.cpp.

◆ processRequestExecuteCommand()

uavcan_node_ExecuteCommand_Response_1_1 CanTask::processRequestExecuteCommand ( canardClass clCanard,
const uavcan_node_ExecuteCommand_Request_1_1 *  req,
uint8_t  remote_node 
)
staticprivate

Chiamate gestioni RPC remote da master (yakut o altro servizio di controllo)

Parameters
clCanardClasse
reqrichiesta
remote_nodenodo remoto
Returns
execute_command standard UAVCAN

Definition at line 506 of file can_task.cpp.

◆ processRequestGetModuleData()

rmap_service_module_Rain_Response_1_0 CanTask::processRequestGetModuleData ( canardClass clCanard,
rmap_service_module_Rain_Request_1_0 *  req,
CanParam_t param 
)
staticprivate

Chiamate gestioni dati remote da master (yakut o altro servizio di controllo)

Parameters
clCanardClasse
reqrichiesta
paramparametri CAN
Returns
dati rmap_servizio di modulo

saturated uint3 get_istant = 0 Ritorna il dato come richiesto dal master

saturated uint3 test_acq = 7 (Solo x TEST)

NON Gestito, risposta error (undefined)

Definition at line 667 of file can_task.cpp.

◆ processRequestNodeGetInfo()

uavcan_node_GetInfo_Response_1_0 CanTask::processRequestNodeGetInfo ( )
staticprivate

Risposta a uavcan.node.GetInfo which Info Node (nome, versione, uniqueID di verifica ecc...)

Returns
Risposta node Get INFO UAVCAN

Definition at line 820 of file can_task.cpp.

◆ processRequestRegisterAccess()

uavcan_register_Access_Response_1_0 CanTask::processRequestRegisterAccess ( const uavcan_register_Access_Request_1_0 *  req)
staticprivate

Accesso ai registri UAVCAN risposta a richieste.

Parameters
reqRichiesta
Returns
register access UAVCAN

Definition at line 777 of file can_task.cpp.

◆ processRequestUpdateRTC()

static void CanTask::processRequestUpdateRTC ( canardClass clsCanard,
const uavcan_pnp_NodeIDAllocationData_1_0 *const  msg 
)
staticprivate

◆ publish_rmap_data()

void CanTask::publish_rmap_data ( canardClass clCanard,
CanParam_t param 
)
staticprivate

Pubblica i dati RMAP con il metodo publisher se abilitato e configurato.

Parameters
clCanardclasse
paramparametri del modulo UAVCAN

Definition at line 405 of file can_task.cpp.

◆ putFlashFile()

bool CanTask::putFlashFile ( const char *const  file_name,
const bool  is_firmware,
const bool  rewrite,
void *  buf,
size_t  count 
)
staticprivate

Scrive dati in append su Flash per scrittura sequenziale file data remoto.

Parameters
file_namenome del file UAVCAN
is_firmwaretrue se il file +-รจ di tipo firmware
rewritetrue se necessaria la riscrittura del file
bufblocco dati da scrivere in formato UAVCAN [256 Bytes]
countnumero del blocco da scrivere in formato UAVCAN [Blocco x Buffer]
Returns
true if block saved OK, false on any error

Definition at line 187 of file can_task.cpp.

◆ Run()

void CanTask::Run ( )
protectedvirtual

RUN Task.

Definition at line 1294 of file can_task.cpp.

◆ TaskState()

void CanTask::TaskState ( uint8_t  state_position,
uint8_t  state_subposition,
task_flag  state_operation 
)
private

local suspend flag and positor running state Task (optional)

Parameters
state_positionSw_Position (Local STATE)
state_subpositionSw_SubPosition (Optional Local SUB_STATE Position Monitor)
state_operationoperative mode flag status for this task

Definition at line 1279 of file can_task.cpp.

◆ TaskWatchDog()

void CanTask::TaskWatchDog ( uint32_t  millis_standby)
private

local watchDog and Sleep flag Task (optional)

Parameters
millis_standbytime in ms to perfor check of WDT. If longer than WDT Reset, WDT is temporanly suspend

Definition at line 1254 of file can_task.cpp.

Member Data Documentation

◆ boot_state

bootloader_t* CanTask::boot_state
inlinestaticprivate

Definition at line 176 of file can_task.h.

◆ canFlashBlock

uint16_t CanTask::canFlashBlock = 0
inlinestaticprivate

Definition at line 189 of file can_task.h.

◆ canFlashPtr

uint64_t CanTask::canFlashPtr = 0
inlinestaticprivate

Definition at line 188 of file can_task.h.

◆ canPower

CAN_ModePower CanTask::canPower
inlinestaticprivate

Definition at line 181 of file can_task.h.

◆ last_req_obs_time

uint16_t CanTask::last_req_obs_time = (OBSERVATIONS_TIME_S)
inlinestaticprivate

Definition at line 180 of file can_task.h.

◆ last_req_rpt_time

uint16_t CanTask::last_req_rpt_time = (REPORTS_TIME_S)
inlinestaticprivate

Definition at line 179 of file can_task.h.

◆ localEeprom

EEprom* CanTask::localEeprom
inlinestaticprivate

Definition at line 177 of file can_task.h.

◆ localFlash

Flash* CanTask::localFlash
inlinestaticprivate

Definition at line 187 of file can_task.h.

◆ localQspiLock

cpp_freertos::BinarySemaphore* CanTask::localQspiLock
inlinestaticprivate

Definition at line 185 of file can_task.h.

◆ localRegister

EERegister* CanTask::localRegister
inlinestaticprivate

Definition at line 184 of file can_task.h.

◆ localRegisterAccessLock

cpp_freertos::BinarySemaphore* CanTask::localRegisterAccessLock
inlinestaticprivate

Definition at line 186 of file can_task.h.

◆ localSystemMessageQueue

cpp_freertos::Queue* CanTask::localSystemMessageQueue
inlinestaticprivate

Definition at line 178 of file can_task.h.

◆ param

CanParam_t CanTask::param
private

Definition at line 173 of file can_task.h.

◆ rtc

STM32RTC& CanTask::rtc = STM32RTC::getInstance()
inlinestaticprivate

Definition at line 182 of file can_task.h.

◆ state

State_t CanTask::state
private

Definition at line 172 of file can_task.h.


The documentation for this class was generated from the following files: