]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
d2u State*.nc
authorrincon <rincon>
Mon, 14 Jan 2008 18:35:30 +0000 (18:35 +0000)
committerrincon <rincon>
Mon, 14 Jan 2008 18:35:30 +0000 (18:35 +0000)
tos/system/StateC.nc
tos/system/StateImplC.nc
tos/types/State.h

index 150641ed71ae76fe4f33eed9d19c1a058b079759..a4568919b9f03d44afd89cd8e00aecf9f9e8f645 100644 (file)
@@ -1,78 +1,78 @@
-/*\r
- * Copyright (c) 2005-2006 Rincon Research Corporation\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * - Redistributions of source code must retain the above copyright\r
- *   notice, this list of conditions and the following disclaimer.\r
- * - Redistributions in binary form must reproduce the above copyright\r
- *   notice, this list of conditions and the following disclaimer in the\r
- *   documentation and/or other materials provided with the\r
- *   distribution.\r
- * - Neither the name of the Arch Rock Corporation nor the names of\r
- *   its contributors may be used to endorse or promote products derived\r
- *   from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\r
- * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
- * OF THE POSSIBILITY OF SUCH DAMAGE\r
- */\r
-\r
-\r
-/**\r
- * This is a state controller for any and every component's\r
- * state machine(s).\r
- *\r
- * There are several compelling reasons to use the State module/interface\r
- * in all your components that have any kind of state associated with them:\r
- *\r
- *   1) It provides a unified interface to control any state, which makes\r
- *      it easy for everyone to understand your code\r
- *   2) You can easily keep track of multiple state machines in one component\r
- *   3) You could have one state machine control several components\r
- *\r
- * There are three ways to change a component's state:\r
- *  > Request a state change\r
- *     The state is only changed if the state is currently in S_IDLE.  If\r
- *     the state changes and access is grated, requestState returns SUCCESS.\r
- *\r
- *  > Force a state change\r
- *     The state changes no matter what\r
- * \r
- *  > toIdle()\r
- *     The state changes to S_IDLE, no matter what state the component is in.\r
- *\r
- * S_IDLE is the default state, and is always equal to 0.  Therefore,\r
- * setup the enums in your internal component so the IDLE/default state is\r
- * always 0.\r
- *\r
- * @author David Moss - dmm@rincon.com\r
- */\r
\r
-#include "State.h"\r
-\r
-generic configuration StateC() {\r
-  provides {\r
-    interface State;\r
-  }\r
-}\r
-\r
-implementation {\r
-  components StateImplC;\r
-\r
-  State = StateImplC.State[unique(UQ_STATE)];\r
-}\r
-\r
-\r
-\r
+/*
+ * Copyright (c) 2005-2006 Rincon Research Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the Arch Rock Corporation nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE
+ */
+
+
+/**
+ * This is a state controller for any and every component's
+ * state machine(s).
+ *
+ * There are several compelling reasons to use the State module/interface
+ * in all your components that have any kind of state associated with them:
+ *
+ *   1) It provides a unified interface to control any state, which makes
+ *      it easy for everyone to understand your code
+ *   2) You can easily keep track of multiple state machines in one component
+ *   3) You could have one state machine control several components
+ *
+ * There are three ways to change a component's state:
+ *  > Request a state change
+ *     The state is only changed if the state is currently in S_IDLE.  If
+ *     the state changes and access is grated, requestState returns SUCCESS.
+ *
+ *  > Force a state change
+ *     The state changes no matter what
+ * 
+ *  > toIdle()
+ *     The state changes to S_IDLE, no matter what state the component is in.
+ *
+ * S_IDLE is the default state, and is always equal to 0.  Therefore,
+ * setup the enums in your internal component so the IDLE/default state is
+ * always 0.
+ *
+ * @author David Moss - dmm@rincon.com
+ */
+#include "State.h"
+
+generic configuration StateC() {
+  provides {
+    interface State;
+  }
+}
+
+implementation {
+  components StateImplC;
+
+  State = StateImplC.State[unique(UQ_STATE)];
+}
+
+
+
index 65b37dec37671c06c44c11db7ce0fd2b9b1928a6..d74ae414a752fc4b1e92c81e107f466d1a121f0b 100644 (file)
@@ -1,78 +1,78 @@
-/*\r
- * Copyright (c) 2005-2006 Rincon Research Corporation\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * - Redistributions of source code must retain the above copyright\r
- *   notice, this list of conditions and the following disclaimer.\r
- * - Redistributions in binary form must reproduce the above copyright\r
- *   notice, this list of conditions and the following disclaimer in the\r
- *   documentation and/or other materials provided with the\r
- *   distribution.\r
- * - Neither the name of the Arch Rock Corporation nor the names of\r
- *   its contributors may be used to endorse or promote products derived\r
- *   from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\r
- * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
- * OF THE POSSIBILITY OF SUCH DAMAGE\r
- */\r
-\r
-/**\r
- * This is a state controller for any and every component's\r
- * state machine(s).\r
- *\r
- * There are several compelling reasons to use the State module/interface\r
- * in all your components that have any kind of state associated with them:\r
- *\r
- *   1) It provides a unified interface to control any state, which makes\r
- *      it easy for everyone to understand your code\r
- *   2) You can easily keep track of multiple state machines in one component\r
- *   3) You could have one state machine control several components\r
- *\r
- * There are three ways to change a component's state:\r
- *  > Request a state change\r
- *     The state is only changed if the state is currently in S_IDLE.  If\r
- *     the state changes and access is grated, requestState returns SUCCESS.\r
- *\r
- *  > Force a state change\r
- *     The state changes no matter what\r
- * \r
- *  > toIdle()\r
- *     The state changes to S_IDLE, no matter what state the component is in.\r
- *\r
- * S_IDLE is the default state, and is always equal to 0.  Therefore,\r
- * setup the enums in your internal component so the IDLE/default state is\r
- * always 0.\r
- *\r
- * @author David Moss - dmm@rincon.com\r
- */\r
-\r
-#include "State.h"\r
-\r
-configuration StateImplC {\r
-  provides {\r
-    interface State[uint8_t id];\r
-  }\r
-}\r
-\r
-implementation {\r
-  components MainC, \r
-      StateImplP;\r
-\r
-  MainC.SoftwareInit -> StateImplP;\r
-  State = StateImplP;\r
-  \r
-}\r
-\r
+/*
+ * Copyright (c) 2005-2006 Rincon Research Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the Arch Rock Corporation nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE
+ */
+
+/**
+ * This is a state controller for any and every component's
+ * state machine(s).
+ *
+ * There are several compelling reasons to use the State module/interface
+ * in all your components that have any kind of state associated with them:
+ *
+ *   1) It provides a unified interface to control any state, which makes
+ *      it easy for everyone to understand your code
+ *   2) You can easily keep track of multiple state machines in one component
+ *   3) You could have one state machine control several components
+ *
+ * There are three ways to change a component's state:
+ *  > Request a state change
+ *     The state is only changed if the state is currently in S_IDLE.  If
+ *     the state changes and access is grated, requestState returns SUCCESS.
+ *
+ *  > Force a state change
+ *     The state changes no matter what
+ * 
+ *  > toIdle()
+ *     The state changes to S_IDLE, no matter what state the component is in.
+ *
+ * S_IDLE is the default state, and is always equal to 0.  Therefore,
+ * setup the enums in your internal component so the IDLE/default state is
+ * always 0.
+ *
+ * @author David Moss - dmm@rincon.com
+ */
+
+#include "State.h"
+
+configuration StateImplC {
+  provides {
+    interface State[uint8_t id];
+  }
+}
+
+implementation {
+  components MainC, 
+      StateImplP;
+
+  MainC.SoftwareInit -> StateImplP;
+  State = StateImplP;
+  
+}
+
index 7b3c6b61083cbd6bef8f9aefbff1aad6c7aad915..542f892eb73401c304e93038ccbd16014ebd6b50 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * Copyright (c) 2005-2006 Rincon Research Corporation\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * - Redistributions of source code must retain the above copyright\r
- *   notice, this list of conditions and the following disclaimer.\r
- * - Redistributions in binary form must reproduce the above copyright\r
- *   notice, this list of conditions and the following disclaimer in the\r
- *   documentation and/or other materials provided with the\r
- *   distribution.\r
- * - Neither the name of the Arch Rock Corporation nor the names of\r
- *   its contributors may be used to endorse or promote products derived\r
- *   from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE\r
- * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
- * OF THE POSSIBILITY OF SUCH DAMAGE\r
- */\r
-\r
-/**\r
- * @author David Moss\r
- */\r
\r
-#ifndef STATE_H\r
-#define STATE_H\r
-\r
-#ifndef UQ_STATE\r
-#define UQ_STATE "State"\r
-#endif\r
-\r
-#endif\r
-\r
+/*
+ * Copyright (c) 2005-2006 Rincon Research Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the
+ *   distribution.
+ * - Neither the name of the Arch Rock Corporation nor the names of
+ *   its contributors may be used to endorse or promote products derived
+ *   from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
+ * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE
+ */
+
+/**
+ * @author David Moss
+ */
+#ifndef STATE_H
+#define STATE_H
+
+#ifndef UQ_STATE
+#define UQ_STATE "State"
+#endif
+
+#endif
+