In the startup method of my agent I get the agent ID of the physical agent as:
phy = agentForService(Services.PHYSICAL)
Then I have tried different ways to set the powerLevel but usually something like:
phy.send(new ParameterReq().set(PhysicalChannelParam.powerLevel, -20))
phy.send(new ParameterReq().set(PhysicalChannelParam.powerLevel, [-20 -20 -20]))
phy.set(PhysicalChannelParam.powerLevel, [-20 -20 -20]
Neither of them works.
I guess this is because there are multiple physical channels (CONTROL, DATA).
How do I specify which channel type to change the power level of?
EDIT:
A solution was to apparently to change the parameter directly:
control_channel = phy[1]
control_channel.powerLevel = -20
However, this feels like violating the basic ideas behind Fjåge.
The
phy[1].powerLevel = -20
syntax is just a syntactic sugar for roughly this:The
req.setIndex(1)
was the magic ingredient you were missing.Also see: ParameterReq API docs.