iCub-main
board_protocol_callback.c
Go to the documentation of this file.
1 /*
2  * protocol_callback.c
3  *
4  * Created on: Jun 6, 2013
5  * Author: Cardellino Alberto
6  */
7 
8 
9 #include "FeatureInterface.h"
10 
11 #include "EOYtheSystem.h"
12 #include "EoCommon.h"
13 #include "EOnv.h"
14 #include "EOnv_hid.h"
15 #include "EOrop.h"
16 
17 #include "EoProtocol.h"
18 #include "EoProtocolMN.h"
19 #include "EoProtocolMC.h"
20 #include "EoProtocolAS.h"
21 #include "EoProtocolSK.h"
22 
23 extern EOnvSet* arrayofnvsets[];
24 
25 void boardtransceiver_fun_UPDT_mn_appl_cmmnds_go2state(const EOnv* nv, const eOropdescriptor_t* rd)
26 {
27  eOmn_appl_state_t *newstate_ptr = (eOmn_appl_state_t *)rd->data;
28 
29  switch(*newstate_ptr)
30  {
31  case applstate_running:
32  case applstate_config:
33  case applstate_error:
34  {
35  //applstate = *newstate_ptr;
36  } break;
37  }
38 }
39 
40 void boardtransceiver_fun_UPDT_mc_joint_cmmnds_interactionmode(const EOnv* nv, const eOropdescriptor_t* rd)
41 {
42  EOnv_hid aNV = {0};
43  eOnvBRD_t brd = eo_nv_GetBRD(nv);
44 
45  EOnvSet* mynvset = arrayofnvsets[brd];
46 
47  eOprotIndex_t index = eoprot_ID2index(rd->id32);
48  eOenum08_t* pmode = (eOenum08_t*) rd->data;
49 
50  eOnvID32_t id32status = eoprot_ID_get(eoprot_endpoint_motioncontrol, eoprot_entity_mc_joint, index, eoprot_tag_mc_joint_status);
51  eo_nvset_NV_Get(mynvset, eok_ipv4addr_localhost, id32status, &aNV);
52 
53  eOmc_joint_status_t jointstatus = {0};
54  uint16_t size = 0;
55 
56  eOresult_t res = eo_nv_Get(&aNV, eo_nv_strg_volatile, &jointstatus, &size);
57  jointstatus.interactionmodestatus = *pmode;
58  eo_nv_Set(&aNV, &jointstatus, eobool_true, eo_nv_upd_dontdo);
59 
60 }
61 
62 
63 
EOnvSet * arrayofnvsets[]
void boardtransceiver_fun_UPDT_mn_appl_cmmnds_go2state(const EOnv *nv, const eOropdescriptor_t *rd)
void boardtransceiver_fun_UPDT_mc_joint_cmmnds_interactionmode(const EOnv *nv, const eOropdescriptor_t *rd)