RF 통신을 잘 활용하면 특정 mote에 데이터를 보낼수 있다.

IntToRfmM.nc
  bool pending;
  struct TOS_Msg data;

  /* ... */ 

  command result_t IntOutput.output(uint16_t value) {
    IntMsg *message = (IntMsg *)data.data;

    if (!pending) {
      pending = TRUE;

      message->val = value;
      atomic {
      message->src = TOS_LOCAL_ADDRESS;
      }

      if (call Send.send(TOS_BCAST_ADDR, sizeof(IntMsg), &data))
        return SUCCESS;

      pending = FALSE;
    }  
    return FAIL;
  }
 
TOS_LOCAL_ADDRESS : 지역 주소
TOS_BCAST_ADDR : 전역 주소.
/opt/tinyos-1.x/apps/RfmToLeds : RF 수신하고 LED로 표시한다
/opt/tinyos-1.x/apps/CntToLedsAndRfm : RF 송신하고 LED로 표시한다.
 
call Send.send(TOS_LOCAL_ADDRESS, sizeof(IntMsg), &data)) 로 바꿀경우 특정 모트에만 전송을 하게 할수가 있다.
인스톨 방식 : make cricket install.주소
저작자 표시 비영리 동일 조건 변경 허락
Posted by Lws