Technically you could write your own version of tasks that do take
parameters, but you'd need to modify both the scheduler and nesc to
recognize them. Tasks themselves are nothing special, they are just
functions implemented by a component and then wired into via the
scheduler via through the TaskBasic interface. The reason you never
explicitly deal with this TaskBasic interface though is because nesc
hides this deatil from you. It takes care of automatically wiring in
the interface to your component everytime you implement something of
the form:
task void myTask()
{
}
There is nothing stopping you from creating your own task type that
does take parameters, but if you want it to have the same look and
feel as traditional tinyOS tasks, you will have to modify the
scheduler as well as let nesc know about your new task type. Take a
look at the man page for ncc and its '-fnesc-scheduler' flag. By
default this flag is set to
-fnesc-scheduler=TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask.
All of that said, you normally don't need tasks to take parameters,
since you can get the same effect using module local variables that
you set just before posting a task.
Kevin
On Fri, Mar 19, 2010 at 10:39 AM, Vikram vik76 <[email protected]> wrote:
> Hello,
>
> I would like to understand why we don't have provision in tinyos for
> declaring tasks with input parameters.
> eg:
> task void taskname(uint8_t input1, uint8_t input2) { ... }
> where input1 and input2 are the two input parameters.
>
> Thanks
> Vikram
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
--
~Kevin
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help