read module cfg and read hk from p60 dock, intermediate state
This commit is contained in:
@ -86,7 +86,14 @@ ReturnValue_t P60DockComIF::requestReceiveMessage(CookieIF *cookie,
|
||||
|
||||
ReturnValue_t P60DockComIF::readReceivedMessage(CookieIF *cookie,
|
||||
uint8_t** buffer, size_t* size) {
|
||||
if(cookie == NULL){
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
P60DockCookie* p60DockCookie = dynamic_cast<P60DockCookie*> (cookie);
|
||||
if(p60DockCookie == NULL){
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
MessageType_t messageType = p60DockCookie->getMessageType();
|
||||
|
||||
switch(messageType){
|
||||
@ -95,10 +102,10 @@ ReturnValue_t P60DockComIF::readReceivedMessage(CookieIF *cookie,
|
||||
uint8_t p60dockAddress = p60DockCookie->getCspAddress();
|
||||
gs_param_table_instance_t moduleConfig;
|
||||
moduleConfig.rows = (gs_param_table_row_t*)p60dock_config;
|
||||
moduleConfig.id = p60dockAddress;
|
||||
moduleConfig.id = moduleCfgTableNum;
|
||||
moduleConfig.row_count = p60dock_config_count;
|
||||
moduleConfig.memory_size = moduleCfgTableSize;
|
||||
moduleConfig.memory = *buffer;
|
||||
moduleConfig.memory_size = p60dock_config_size;
|
||||
moduleConfig.memory = replyBuffer;
|
||||
/* Read complete module configuration table from P60 Dock and store data
|
||||
* in buffer */
|
||||
int result = gs_rparam_get_full_table(&moduleConfig, p60dockAddress,
|
||||
@ -106,8 +113,30 @@ ReturnValue_t P60DockComIF::readReceivedMessage(CookieIF *cookie,
|
||||
*size = moduleCfgTableSize;
|
||||
if (result != GS_OK) {
|
||||
sif::info
|
||||
<< "Failed retrieving module configuration from P60 dock with error code "
|
||||
<< result << std::endl;
|
||||
<< "Failed retrieving module configuration from P60 dock "
|
||||
<< "with error code " << result << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case(P60DockCookie::READ_HK):{
|
||||
uint32_t timeout = 1000;
|
||||
uint8_t p60dockAddress = p60DockCookie->getCspAddress();
|
||||
gs_param_table_instance_t tmData;
|
||||
tmData.rows = (gs_param_table_row_t*)p60dock_hk;
|
||||
tmData.id = tmTableNum;
|
||||
tmData.row_count = p60dock_hk_count;
|
||||
tmData.memory_size = tmTableSize;
|
||||
tmData.memory = replyBuffer;
|
||||
/* Read complete module configuration table from P60 Dock and store data
|
||||
* in buffer */
|
||||
int result = gs_rparam_get_full_table(&tmData, p60dockAddress,
|
||||
tmData.id, GS_RPARAM_MAGIC_CHECKSUM, timeout);
|
||||
*size = tmTableSize;
|
||||
if (result != GS_OK) {
|
||||
sif::info
|
||||
<< "Failed retrieving telemetry from P60 dock with error "
|
||||
<< "code " << result << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
break;
|
||||
|
@ -25,6 +25,8 @@
|
||||
*/
|
||||
class P60DockComIF: public DeviceCommunicationIF, public SystemObject {
|
||||
public:
|
||||
static const uint8_t maxReplyLength = 188;
|
||||
|
||||
P60DockComIF(object_id_t objectId);
|
||||
virtual ~P60DockComIF();
|
||||
|
||||
@ -42,12 +44,14 @@ private:
|
||||
csp_iface_t csp_if;
|
||||
/* Table definitions. According to gomspace software documentation there
|
||||
* exist four tables each identified by a number*/
|
||||
uint8_t boardConfigTable = 0;
|
||||
uint8_t moduleConfigTable = 1;
|
||||
uint8_t calibrationParamTable = 2;
|
||||
uint8_t tmDataTable = 4;
|
||||
uint8_t boardConfigTableNum = 0;
|
||||
uint8_t moduleCfgTableNum = 1;
|
||||
uint8_t calibrationParamTableNum = 2;
|
||||
uint8_t tmTableNum = 4;
|
||||
unsigned int moduleConfigTableRows = 32;
|
||||
uint16_t moduleCfgTableSize = 412;
|
||||
uint8_t moduleCfgTableSize = 188;
|
||||
uint8_t tmTableSize = 188;
|
||||
uint8_t replyBuffer[P60DockComIF::maxReplyLength];
|
||||
|
||||
};
|
||||
|
||||
|
@ -33,6 +33,10 @@ void P60DockCookie::setReadModuleCfgMessage(){
|
||||
nextMessage = READ_MODULE_CONFIG;
|
||||
}
|
||||
|
||||
void P60DockCookie::setReadHkMessage(){
|
||||
nextMessage = READ_HK;
|
||||
}
|
||||
|
||||
MessageType_t P60DockCookie::getMessageType(){
|
||||
return nextMessage;
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
void setPingMessage();
|
||||
void setRebootMessage();
|
||||
void setReadModuleCfgMessage();
|
||||
void setReadHkMessage();
|
||||
MessageType_t getMessageType();
|
||||
|
||||
/* Message type defines the type of the next data transfer between the
|
||||
@ -35,6 +36,7 @@ public:
|
||||
static const MessageType_t PING = 0x1;
|
||||
static const MessageType_t REBOOT = 0x4;
|
||||
static const MessageType_t READ_MODULE_CONFIG = 0x71;
|
||||
static const MessageType_t READ_HK = 0x74;
|
||||
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user