Hello,
First of all, please excuse the elementary question and my first attempt to
program in nc. I'm still learning, and would really appreciate any help.
I'm trying to send a message from PC1 -->BS1_node --> node3 --> BS2_node
---> PC2
So far I was able to send the message from  PC1 -->BS1_node --> BS2_node
---> PC2
by running the following:
TestSerial.java on PC1
Listen.java on PC2
BaseStation on BS1_node and BS2_node.

Now I just need node3 to forward the message (as is) to BS2_node.

I tried using the collection protocol but it sends its own message from
node3 and not forward the message received from BS1_node.

Now I am trying to implement Intercept.forward, but didn't know how to
initialize msg1 to the message received from BS1_node. Plus, as I
understood from Intercept.forward function is that I do not need to use
Send since return TRUE tells the system to forward the message , am I
right? The following is the module I implemented:
#include "AM.h"
module Blink1C
{
  uses interface Boot;
  uses interface SplitControl;
  provides interface Intercept;
}
implementation
{
  uint8_t len1;
  message_t* msg1;
  void *payload1;

  event void Boot.booted()
  {
call SplitControl.start();
  }

  event void SplitControl.startDone(error_t err)
  {
signal Intercept.forward(msg1,payload1,len1);
  }

  default event bool Intercept.forward(message_t* msg, void* payload,
uint8_t len)
  {
return TRUE;
  }
  event void SplitControl.stopDone(error_t err){}
}

========================================
and this is the configuration file:
#include "AM.h"
configuration BlinkApp1C
{
  provides interface Intercept;
}
implementation
{
  components MainC, Blink1C;
  components ActiveMessageC;

  Intercept = Blink1C.Intercept;
  Blink1C.Boot -> MainC.Boot;
  Blink1C.SplitControl -> ActiveMessageC.SplitControl;
}

Now my questions are:
1. How can I initialize msg1 to take the message received from BS1_node; it
is originally test_serial_msg, but when it was carried by BS1_node its type
was changed, am I right?

2. Shall I use Send or receive with Intercept.forward, and is this a
correct way to implement it?


Can you please help
Thank you
Mai
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to