Kuon/sw/bsModules/bsKuon/bsKuonClient.c
int bsKuonReqGetMotorSpeeds(BsClient_P     pClient,
                          BsVConnHnd_T   hndVConn,
                          int           *pnSpeedLeft,
                          int           *pnSpeedRight)
{
  static BsKuonMsgId_T    msgIdReq = BsKuonMsgIdReqGetMotorSpeeds;
  static BsKuonMsgId_T    msgIdRsp = BsKuonMsgIdRspGetMotorSpeeds;

  BsKuonRspGetMotorSpeeds_T msgRsp;                   // response message 
  byte_t                  buf[BSPROXY_MSG_MAX_LEN]; // req/rsp buffer
  bool_t                  bTrace;                   // do [not] trace messages
  int                     n;                        // num of bytes/return code

  //
  // Parameter checks.
  //
  BSCLIENT_TRY_EXPR(pClient, BSCLIENT_HAS_VCONN(pClient, hndVConn),
      BS_ECODE_BAD_VAL, "VConn=%d", hndVConn);

  // trace state
  bTrace = bsClientAttrGetTraceState(pClient, hndVConn);

  //
  // Execute request-response transaction.
  //
  n = bsClientTrans(pClient,  hndVConn,
                    msgIdReq, buf, 0,
                    msgIdRsp, buf, sizeof(buf));

  // check transaction return code
  BSCLIENT_TRY_ECODE(pClient, n, "MsgId=%u: Transaction failed.", msgIdReq);

  //
  // Unpack response.
  //
  n = BsKuonUnpackRspGetMotorSpeeds(buf, (size_t)n, &msgRsp, bTrace);

  // check unpack return code
  BSCLIENT_TRY_NM_ECODE(pClient, n, "MsgId=%u", msgIdRsp);

  //
  // Set return values from response.
  //
  *pnSpeedLeft  = msgRsp.m_speedleft;
  *pnSpeedRight = msgRsp.m_speedright;

  LOGDIAG3("%s: GetSpeeds: (%d,%d).", bsClientAttrGetName(pClient),
                                *pnSpeedLeft, *pnSpeedRight);

  return BS_OK;
}
/*!
 * \brief Proxied request to get the current motor speeds.
 *
 * \param pClient             \h_botsense client.
 * \param hndVConn            Handle to virtual connection to close.
 * \param [out] pnSpeedLeft   Left motor speed in the current units.
 * \param [out] pnSpeedRight  Right motor speed in the current units.
 *
 * \copydoc doc_return_bs_std
 */
\brief Proxied request to get the current motor speeds.
\param pClient             \h_botsense client.
\param hndVConn            Handle to virtual connection to close.
\param [out] pnSpeedLeft   Left motor speed in the current units.
\param [out] pnSpeedRight  Right motor speed in the current units.


\ brief Proxied request to get the current motor speeds . \ param pClient \ h_botsense client . \ param hndVConn Handle to virtual connection to close . \ param [ out ] pnSpeedLeft Left motor speed in the current units . \ param [ out ] pnSpeedRight Right motor speed in the current units .
int bsKuonReqGetMotorSpeeds(BsClient_P     pClient,
                          BsVConnHnd_T   hndVConn,
                          int           *pnSpeedLeft,
                          int           *pnSpeedRight)
{
  static BsKuonMsgId_T    msgIdReq = BsKuonMsgIdReqGetMotorSpeeds;
  static BsKuonMsgId_T    msgIdRsp = BsKuonMsgIdRspGetMotorSpeeds;
  BsKuonRspGetMotorSpeeds_T msgRsp;                   
  byte_t                  buf[BSPROXY_MSG_MAX_LEN]; 
  bool_t                  bTrace;                   
  int                     n;                        
   Parameter checks.
  BSCLIENT_TRY_EXPR(pClient, BSCLIENT_HAS_VCONN(pClient, hndVConn),
      BS_ECODE_BAD_VAL, "VConn=%d", hndVConn);
   trace state
  bTrace = bsClientAttrGetTraceState(pClient, hndVConn);
   Execute request-response transaction.
  n = bsClientTrans(pClient,  hndVConn,
                    msgIdReq, buf, 0,
                    msgIdRsp, buf, sizeof(buf));
   check transaction return code
  BSCLIENT_TRY_ECODE(pClient, n, "MsgId=%u: Transaction failed.", msgIdReq);
   Unpack response.
  n = BsKuonUnpackRspGetMotorSpeeds(buf, (size_t)n, &msgRsp, bTrace);
   check unpack return code
  BSCLIENT_TRY_NM_ECODE(pClient, n, "MsgId=%u", msgIdRsp);
   Set return values from response.
  *pnSpeedLeft  = msgRsp.m_speedleft;
  *pnSpeedRight = msgRsp.m_speedright;
  LOGDIAG3("%s: GetSpeeds: (%d,%d).", bsClientAttrGetName(pClient),
                                *pnSpeedLeft, *pnSpeedRight);
  return BS_OK;
}
int bsKuonReqGetMotorSpeeds ( BsClient_P pClient , BsVConnHnd_T hndVConn , int * pnSpeedLeft , int * pnSpeedRight ) { static BsKuonMsgId_T msgIdReq = BsKuonMsgIdReqGetMotorSpeeds ; static BsKuonMsgId_T msgIdRsp = BsKuonMsgIdRspGetMotorSpeeds ; BsKuonRspGetMotorSpeeds_T msgRsp ; byte_t buf [ BSPROXY_MSG_MAX_LEN ] ; bool_t bTrace ; int n ; BSCLIENT_TRY_EXPR ( pClient , BSCLIENT_HAS_VCONN ( pClient , hndVConn ) , BS_ECODE_BAD_VAL , " " , hndVConn ) ; bTrace = bsClientAttrGetTraceState ( pClient , hndVConn ) ; n = bsClientTrans ( pClient , hndVConn , msgIdReq , buf , 0 , msgIdRsp , buf , sizeof ( buf ) ) ; BSCLIENT_TRY_ECODE ( pClient , n , " " , msgIdReq ) ; n = BsKuonUnpackRspGetMotorSpeeds ( buf , ( size_t ) n , & msgRsp , bTrace ) ; BSCLIENT_TRY_NM_ECODE ( pClient , n , " " , msgIdRsp ) ; * pnSpeedLeft = msgRsp . m_speedleft ; * pnSpeedRight = msgRsp . m_speedright ; LOGDIAG3 ( " " , bsClientAttrGetName ( pClient ) , * pnSpeedLeft , * pnSpeedRight ) ; return BS_OK ; }
\brief Proxied request to get the current motor speeds.
\ brief Proxied request to get the current motor speeds .
// response message  // req/rsp buffer // do [not] trace messages // num of bytes/return code // // Parameter checks. // // trace state // // Execute request-response transaction. // // check transaction return code // // Unpack response. // // check unpack return code // // Set return values from response. //