rename some funcs related to settings, preparing to add commands for reading and writing the ini file.
This commit is contained in:
+26
-5
@@ -41,22 +41,43 @@ static TF_Result lst_unit(TinyFrame *tf, TF_Msg *msg)
|
||||
return TF_STAY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List all active unit callsigns, names and types
|
||||
*/
|
||||
static TF_Result lst_list_units(TinyFrame *tf, TF_Msg *msg)
|
||||
{
|
||||
ureg_report_active_units(msg->frame_id);
|
||||
return TF_STAY;
|
||||
}
|
||||
|
||||
static TF_Result lst_ini_export(TinyFrame *tf, TF_Msg *msg)
|
||||
{
|
||||
//
|
||||
return TF_STAY;
|
||||
}
|
||||
|
||||
static TF_Result lst_ini_import(TinyFrame *tf, TF_Msg *msg)
|
||||
{
|
||||
//
|
||||
return TF_STAY;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void comm_init(void)
|
||||
{
|
||||
TF_InitStatic(comm, TF_SLAVE);
|
||||
TF_AddTypeListener(comm, MSG_PING, lst_ping);
|
||||
TF_AddTypeListener(comm, MSG_UNIT_REQUEST, lst_unit);
|
||||
TF_AddTypeListener(comm, MSG_LIST_UNITS, lst_list_units);
|
||||
|
||||
bool suc = true;
|
||||
|
||||
suc &= TF_AddTypeListener(comm, MSG_PING, lst_ping);
|
||||
suc &= TF_AddTypeListener(comm, MSG_UNIT_REQUEST, lst_unit);
|
||||
suc &= TF_AddTypeListener(comm, MSG_LIST_UNITS, lst_list_units);
|
||||
suc &= TF_AddTypeListener(comm, MSG_INI_READ, lst_ini_export);
|
||||
suc &= TF_AddTypeListener(comm, MSG_INI_WRITE, lst_ini_import);
|
||||
|
||||
// fall-through
|
||||
TF_AddGenericListener(comm, lst_default);
|
||||
suc &= TF_AddGenericListener(comm, lst_default);
|
||||
|
||||
assert_param(suc);
|
||||
}
|
||||
|
||||
+6
-4
@@ -15,7 +15,7 @@
|
||||
/**
|
||||
* Supported message types (TF_TYPE)
|
||||
*/
|
||||
enum TF_Types_ {
|
||||
enum Message_Types_ {
|
||||
// General, low level
|
||||
MSG_SUCCESS = 0x00, //!< Generic success response; used by default in all responses; payload is transaction-specific
|
||||
MSG_PING = 0x01, //!< Ping request (or response), used to test connection
|
||||
@@ -29,11 +29,13 @@ enum TF_Types_ {
|
||||
MSG_BULK_ABORT = 0x08, //!< Discard the ongoing transfer
|
||||
|
||||
// Unit messages
|
||||
MSG_UNIT_REQUEST = 0x10, //!< Command addressed to a particular unit
|
||||
MSG_UNIT_REPORT = 0x11, //!< Spontaneous report from a unit
|
||||
MSG_UNIT_REQUEST = 0x10, //!< Command addressed to a particular unit
|
||||
MSG_UNIT_REPORT = 0x11, //!< Spontaneous report from a unit
|
||||
|
||||
// System messages
|
||||
MSG_LIST_UNITS = 0x20, //!< Get all unit call-signs and names
|
||||
MSG_LIST_UNITS = 0x20, //!< Get all active unit call-signs, types and names
|
||||
MSG_INI_READ = 0x21, //!< Read the ini file via bulk
|
||||
MSG_INI_WRITE = 0x22, //!< Write the ini file via bulk
|
||||
};
|
||||
|
||||
extern TinyFrame *comm;
|
||||
|
||||
Reference in New Issue
Block a user