botsense/bsModules/bsNull/bsNullServer.c
int bsModRequest(BsVConnHnd_T hndVConn,
                 BsTid_T      uTid,
                 BsMsgId_T    uMsgIdReq,
                 byte_t       bufReq[],
                 size_t       uReqLen)
{
  BsModCtlBlk_T  *pCtlBlk;

  // check if handle is in valid range
  if( !BSMOD_IS_VCONN_HANDLE(hndVConn) )
  {
    BSMOD_SEND_ERROR_RSP(BsModCallbacks, hndVConn, uTid, BS_ECODE_BAD_VCONN_HND,
          "Module vconn handle out-of-range.");
    return -BS_ECODE_BAD_VCONN_HND; \
  }

  // retrieve resource control block
  pCtlBlk = (BsModCtlBlk_T *)BSMOD_RSRC(BsModRsrcTbl, hndVConn);

  // check resource
  if( pCtlBlk == NULL )
  {
    BSMOD_SEND_ERROR_RSP(BsModCallbacks, hndVConn, uTid, BS_ECODE_NO_VCONN,
        "No resources for virtual connection found.");
    return -BS_ECODE_NO_VCONN;
  }

  switch( uMsgIdReq )
  {
    case BsNullMsgIdReqWrite:
      return bsModNullReqWrite(hndVConn, uTid, uMsgIdReq, bufReq, uReqLen);
    default:
      BSMOD_SEND_ERROR_RSP(BsModCallbacks, hndVConn, uTid, BS_ECODE_UNKNOWN_REQ,
          "MsgId=%u.", uMsgIdReq);
      return -BS_ECODE_UNKNOWN_REQ;
  }
}
/*!
 * \brief Service an /dev/null request.
 *
 * \note A module-specific request service must send a response.
 *
 * \param hndVConn  Virtual connection handle.
 * \param uTid      Request-Response transaction id.
 * \param uMsgIdReq Request message id.
 * \param bufReq    Packed request message buffer.
 * \param uReqLen   Size of request in buffer (number of bytes).
 *
 * \copydoc doc_return_std
 */
\brief Service an /dev/null request.
\note A module-specific request service must send a response.

\param hndVConn  Virtual connection handle.
\param uTid      Request-Response transaction id.
\param uMsgIdReq Request message id.
\param bufReq    Packed request message buffer.
\param uReqLen   Size of request in buffer (number of bytes).


\ brief Service an / dev / null request . \ note A module - specific request service must send a response . \ param hndVConn Virtual connection handle . \ param uTid Request - Response transaction id . \ param uMsgIdReq Request message id . \ param bufReq Packed request message buffer . \ param uReqLen Size of request in buffer ( number of bytes ) .
int bsModRequest(BsVConnHnd_T hndVConn,
                 BsTid_T      uTid,
                 BsMsgId_T    uMsgIdReq,
                 byte_t       bufReq[],
                 size_t       uReqLen)
{
  BsModCtlBlk_T  *pCtlBlk;
  if( !BSMOD_IS_VCONN_HANDLE(hndVConn) )
  {
    BSMOD_SEND_ERROR_RSP(BsModCallbacks, hndVConn, uTid, BS_ECODE_BAD_VCONN_HND,
          "Module vconn handle out-of-range.");
    return -BS_ECODE_BAD_VCONN_HND; \
  }
  pCtlBlk = (BsModCtlBlk_T *)BSMOD_RSRC(BsModRsrcTbl, hndVConn);
  if( pCtlBlk == NULL )
  {
    BSMOD_SEND_ERROR_RSP(BsModCallbacks, hndVConn, uTid, BS_ECODE_NO_VCONN,
        "No resources for virtual connection found.");
    return -BS_ECODE_NO_VCONN;
  }
  switch( uMsgIdReq )
  {
    case BsNullMsgIdReqWrite:
      return bsModNullReqWrite(hndVConn, uTid, uMsgIdReq, bufReq, uReqLen);
    default:
      BSMOD_SEND_ERROR_RSP(BsModCallbacks, hndVConn, uTid, BS_ECODE_UNKNOWN_REQ,
          "MsgId=%u.", uMsgIdReq);
      return -BS_ECODE_UNKNOWN_REQ;
  }
}
int bsModRequest ( BsVConnHnd_T hndVConn , BsTid_T uTid , BsMsgId_T uMsgIdReq , byte_t bufReq [ ] , size_t uReqLen ) { BsModCtlBlk_T * pCtlBlk ; if ( ! BSMOD_IS_VCONN_HANDLE ( hndVConn ) ) { BSMOD_SEND_ERROR_RSP ( BsModCallbacks , hndVConn , uTid , BS_ECODE_BAD_VCONN_HND , " " ) ; return - BS_ECODE_BAD_VCONN_HND ; } pCtlBlk = ( BsModCtlBlk_T * ) BSMOD_RSRC ( BsModRsrcTbl , hndVConn ) ; if ( pCtlBlk == NULL ) { BSMOD_SEND_ERROR_RSP ( BsModCallbacks , hndVConn , uTid , BS_ECODE_NO_VCONN , " " ) ; return - BS_ECODE_NO_VCONN ; } switch ( uMsgIdReq ) { case BsNullMsgIdReqWrite : return bsModNullReqWrite ( hndVConn , uTid , uMsgIdReq , bufReq , uReqLen ) ; default : BSMOD_SEND_ERROR_RSP ( BsModCallbacks , hndVConn , uTid , BS_ECODE_UNKNOWN_REQ , " " , uMsgIdReq ) ; return - BS_ECODE_UNKNOWN_REQ ; } }
\brief Service an /dev/null request.
\ brief Service an / dev / null request .
// check if handle is in valid range // retrieve resource control block // check resource