I have two nodes. Address 40 is transmitting a frame to address 10. When I use TxFrameNtf I get that transmission is successful. But node 10 is dropping the frame it seems from trace.nam it seems. I can not figure out why. Here are the Agents that I am using for each node: Node 40:
import org.arl.fjage.Message
import org.arl.unet.*
import org.arl.fjage.*
import org.arl.unet.PDU
import java.util.*
import org.arl.unet.phy.*
import static org.arl.unet.utils.MathUtils.*
class VBF_Agent extends UnetAgent {
private AgentID phy
final static int cluster_protocol = Protocol.USER
private AgentID node
public int addr
private final static PDU format = PDU.withFormat
{
uint8('source')
uint16('data')
}
void startup() {
phy = agentForService Services.PHYSICAL //to communicate between two nodes
subscribe topic(phy)
def node = agentForService(Services.NODE_INFO)
addr = node.Address
phy[1].powerLevel = 0.dB;
def datapacket = format.encode(source: addr, data: 51)
if(addr==40)
{
println "Sending data from source"
phy << new TxFrameReq(to: Address.BROADCAST, protocol: cluster_protocol, data: datapacket)
}
}
void processMessage(Message msg) {
}
Node 10:
import org.arl.fjage.Message
import org.arl.unet.*
import org.arl.fjage.*
import org.arl.unet.PDU
import java.util.*
import org.arl.unet.phy.*
import static org.arl.unet.utils.MathUtils.*
class VBF_hop extends UnetAgent {
private AgentID phy
final static int cluster_protocol = Protocol.USER
private AgentID node
public int addr
void startup() {
phy = agentForService Services.PHYSICAL //to communicate between two nodes
subscribe topic(phy)
def node = agentForService(Services.NODE_INFO)
addr = node.Address
phy[1].powerLevel = 0.dB
}
void processMessage(Message msg) {
if (msg instanceof RxFrameNtf && msg.protocol == cluster_protocol ) //notfication recieved
{
println "${msg.data} at node ${addr}"
}
}
}
I don't see the message printed on the screen that data has been received and trace.nam shows that packet was not detected. I have set the transmission power to infinity as you can see.
Instead of TxFrameReq, I used DatagramReq then the data is received by node 10. Is the issue because of improper use of syntax? I am very new to UnetStack and groovy, so I might have missed such problems. Thank you in advance.