Commit 78610e3d30b86c2c91a85ed0c285eb58581f9832

Authored by Imanol-Mikel Barba Sabariego
0 parents

Initial Commit

Showing 106 changed files with 6179 additions and 0 deletions

Too many changes to show.

To preserve performance only 78 of 106 files are displayed.

Blinker/.classpath 0 → 100644
  1 +++ a/Blinker/.classpath
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" path="src"/>
  4 + <classpathentry kind="src" path="gen"/>
  5 + <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
  6 + <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
  7 + <classpathentry kind="lib" path="libs/EmmocoFramework.jar"/>
  8 + <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
  9 + <classpathentry kind="output" path="bin/classes"/>
  10 +</classpath>
Blinker/.project 0 → 100644
  1 +++ a/Blinker/.project
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>Blinker</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + <buildCommand>
  14 + <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
  15 + <arguments>
  16 + </arguments>
  17 + </buildCommand>
  18 + <buildCommand>
  19 + <name>org.eclipse.jdt.core.javabuilder</name>
  20 + <arguments>
  21 + </arguments>
  22 + </buildCommand>
  23 + <buildCommand>
  24 + <name>com.android.ide.eclipse.adt.ApkBuilder</name>
  25 + <arguments>
  26 + </arguments>
  27 + </buildCommand>
  28 + </buildSpec>
  29 + <natures>
  30 + <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
  31 + <nature>org.eclipse.jdt.core.javanature</nature>
  32 + </natures>
  33 +</projectDescription>
Blinker/.settings/org.eclipse.jdt.core.prefs 0 → 100644
  1 +++ a/Blinker/.settings/org.eclipse.jdt.core.prefs
  1 +eclipse.preferences.version=1
  2 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
  3 +org.eclipse.jdt.core.compiler.compliance=1.6
  4 +org.eclipse.jdt.core.compiler.source=1.6
Blinker/AndroidManifest.xml 0 → 100644
  1 +++ a/Blinker/AndroidManifest.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  3 + package="com.emmoco.example.blinker"
  4 + android:versionCode="1"
  5 + android:versionName="0.8">
  6 + <uses-sdk android:minSdkVersion="8"
  7 + android:targetSdkVersion="8"
  8 + android:maxSdkVersion="8" />
  9 +
  10 + <supports-screens android:largeScreens="false" android:xlargeScreens="false" />
  11 +
  12 +
  13 + <!-- Application -->
  14 + <application
  15 + android:label="@string/app_name"
  16 + android:debuggable="false"
  17 + android:icon="@drawable/icon"
  18 + android:theme="@style/AppTheme">
  19 +
  20 + <activity android:name="com.emmoco.example.blinker.MainActivity"
  21 + android:screenOrientation="portrait"
  22 + android:alwaysRetainTaskState="true"
  23 + android:launchMode="singleTop"
  24 + android:clearTaskOnLaunch="false"
  25 + android:label="@string/app_name"
  26 + android:configChanges="keyboardHidden|orientation">
  27 + <intent-filter>
  28 + <action android:name="android.intent.action.MAIN" />
  29 + <category android:name="android.intent.category.LAUNCHER" />
  30 + </intent-filter>
  31 + </activity>
  32 + <activity android:name="com.emmoco.example.blinker.SetDeviceActivity" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation"> </activity>
  33 + </application>
  34 + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  35 + <uses-permission android:name="android.permission.BLUETOOTH" />
  36 + <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
  37 + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  38 + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  39 + <uses-permission android:name="android.permission.INTERNET" />
  40 +</manifest>
Blinker/ant.properties 0 → 100644
  1 +++ a/Blinker/ant.properties
  1 +# This file is used to override default values used by the Ant build system.
  2 +#
  3 +# This file must be checked in Version Control Systems, as it is
  4 +# integral to the build system of your project.
  5 +
  6 +# This file is only used by the Ant script.
  7 +
  8 +# You can use this to override default values such as
  9 +# 'source.dir' for the location of your java source folder and
  10 +# 'out.dir' for the location of your output folder.
  11 +
  12 +# You can also use it define how the release builds are signed by declaring
  13 +# the following properties:
  14 +# 'key.store' for the location of your keystore and
  15 +# 'key.alias' for the name of the key to use.
  16 +# The password will be asked during the build when you use the 'release' target.
  17 +
Blinker/build.xml 0 → 100644
  1 +++ a/Blinker/build.xml
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project name="Blinker" default="help">
  3 +
  4 + <!-- The local.properties file is created and updated by the 'android' tool.
  5 + It contains the path to the SDK. It should *NOT* be checked into
  6 + Version Control Systems. -->
  7 + <loadproperties srcFile="local.properties" />
  8 +
  9 + <!-- The ant.properties file can be created by you. It is only edited by the
  10 + 'android' tool to add properties to it.
  11 + This is the place to change some Ant specific build properties.
  12 + Here are some properties you may want to change/update:
  13 +
  14 + source.dir
  15 + The name of the source directory. Default is 'src'.
  16 + out.dir
  17 + The name of the output directory. Default is 'bin'.
  18 +
  19 + For other overridable properties, look at the beginning of the rules
  20 + files in the SDK, at tools/ant/build.xml
  21 +
  22 + Properties related to the SDK location or the project target should
  23 + be updated using the 'android' tool with the 'update' action.
  24 +
  25 + This file is an integral part of the build system for your
  26 + application and should be checked into Version Control Systems.
  27 +
  28 + -->
  29 + <property file="ant.properties" />
  30 +
  31 + <!-- The project.properties file is created and updated by the 'android'
  32 + tool, as well as ADT.
  33 +
  34 + This contains project specific properties such as project target, and library
  35 + dependencies. Lower level build properties are stored in ant.properties
  36 + (or in .classpath for Eclipse projects).
  37 +
  38 + This file is an integral part of the build system for your
  39 + application and should be checked into Version Control Systems. -->
  40 + <loadproperties srcFile="project.properties" />
  41 +
  42 + <!-- quick check on sdk.dir -->
  43 + <fail
  44 + message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
  45 + unless="sdk.dir"
  46 + />
  47 +
  48 +
  49 +<!-- extension targets. Uncomment the ones where you want to do custom work
  50 + in between standard targets -->
  51 +<!--
  52 + <target name="-pre-build">
  53 + </target>
  54 + <target name="-pre-compile">
  55 + </target>
  56 +
  57 + /* This is typically used for code obfuscation.
  58 + Compiled code location: ${out.classes.absolute.dir}
  59 + If this is not done in place, override ${out.dex.input.absolute.dir} */
  60 + <target name="-post-compile">
  61 + </target>
  62 +-->
  63 +
  64 + <!-- Import the actual build file.
  65 +
  66 + To customize existing targets, there are two options:
  67 + - Customize only one target:
  68 + - copy/paste the target into this file, *before* the
  69 + <import> task.
  70 + - customize it to your needs.
  71 + - Customize the whole content of build.xml
  72 + - copy/paste the content of the rules files (minus the top node)
  73 + into this file, replacing the <import> task.
  74 + - customize to your needs.
  75 +
  76 + ***********************
  77 + ****** IMPORTANT ******
  78 + ***********************
  79 + In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
  80 + in order to avoid having your file be overridden by tools such as "android update project"
  81 + -->
  82 + <!-- version-tag: custom -->
  83 + <import file="../../../tools/Android/version.xml" optional="true"/>
  84 + <import file="${sdk.dir}/tools/ant/build.xml" />
  85 +
  86 +</project>
Blinker/default.properties 0 → 100644
  1 +++ a/Blinker/default.properties
  1 +# This file is automatically generated by Android Tools.
  2 +# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
  3 +#
  4 +# This file must be checked in Version Control Systems.
  5 +#
  6 +# To customize properties used by the Ant build system use,
  7 +# "build.properties", and override values to adapt the script to your
  8 +# project structure.
  9 +
  10 +# Project target.
  11 +target=android-8
Blinker/proguard.cfg 0 → 100644
  1 +++ a/Blinker/proguard.cfg
  1 +-optimizationpasses 5
  2 +-dontusemixedcaseclassnames
  3 +-dontskipnonpubliclibraryclasses
  4 +-dontpreverify
  5 +-verbose
  6 +-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
  7 +
  8 +-keep public class * extends android.app.Activity
  9 +-keep public class * extends android.app.Application
  10 +-keep public class * extends android.app.Service
  11 +-keep public class * extends android.content.BroadcastReceiver
  12 +-keep public class * extends android.content.ContentProvider
  13 +-keep public class * extends android.app.backup.BackupAgentHelper
  14 +-keep public class * extends android.preference.Preference
  15 +-keep public class com.android.vending.licensing.ILicensingService
  16 +
  17 +-keepclasseswithmembernames class * {
  18 + native <methods>;
  19 +}
  20 +
  21 +-keepclasseswithmembers class * {
  22 + public <init>(android.content.Context, android.util.AttributeSet);
  23 +}
  24 +
  25 +-keepclasseswithmembers class * {
  26 + public <init>(android.content.Context, android.util.AttributeSet, int);
  27 +}
  28 +
  29 +-keepclassmembers class * extends android.app.Activity {
  30 + public void *(android.view.View);
  31 +}
  32 +
  33 +-keepclassmembers enum * {
  34 + public static **[] values();
  35 + public static ** valueOf(java.lang.String);
  36 +}
  37 +
  38 +-keep class * implements android.os.Parcelable {
  39 + public static final android.os.Parcelable$Creator *;
  40 +}
Blinker/project.properties 0 → 100644
  1 +++ a/Blinker/project.properties
  1 +# This file is automatically generated by Android Tools.
  2 +# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
  3 +#
  4 +# This file must be checked in Version Control Systems.
  5 +#
  6 +# To customize properties used by the Ant build system use,
  7 +# "ant.properties", and override values to adapt the script to your
  8 +# project structure.
  9 +
  10 +# Project target.
  11 +target=android-9
Blinker/res/drawable-hdpi/blinker_connection_connected.png 0 → 100644

1.14 KB

Blinker/res/drawable-hdpi/blinker_connection_disconnected.png 0 → 100644

1.15 KB

Blinker/res/drawable-hdpi/blinker_light_off.png 0 → 100644

14.8 KB

Blinker/res/drawable-hdpi/blinker_light_on.png 0 → 100644

13.6 KB

Blinker/res/drawable-hdpi/icon.png 0 → 100644

2.06 KB

Blinker/res/drawable-ldpi/icon.png 0 → 100644

1.68 KB

Blinker/res/drawable-mdpi/icon.png 0 → 100644

2.06 KB

Blinker/res/drawable/connected_indicator.xml 0 → 100644
  1 +++ a/Blinker/res/drawable/connected_indicator.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
  3 +
  4 + <item android:state_enabled="false" android:drawable="@drawable/blinker_connection_disconnected"/>
  5 +
  6 + <item android:drawable="@drawable/blinker_connection_connected"/>
  7 +
  8 +</selector>
0 \ No newline at end of file 9 \ No newline at end of file
Blinker/res/drawable/gradient.xml 0 → 100644
  1 +++ a/Blinker/res/drawable/gradient.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +
  3 +<shape xmlns:android="http://schemas.android.com/apk/res/android"
  4 + android:shape="rectangle">
  5 + <gradient
  6 + android:startColor="#66000000"
  7 + android:endColor="#DD000000"
  8 + android:angle="270"/>
  9 +</shape>
0 \ No newline at end of file 10 \ No newline at end of file
Blinker/res/drawable/led.xml 0 → 100644
  1 +++ a/Blinker/res/drawable/led.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +
  3 +<selector xmlns:android="http://schemas.android.com/apk/res/android">
  4 + <item
  5 + android:state_selected="true"
  6 + android:drawable="@drawable/blinker_light_on" />
  7 + <item
  8 + android:state_selected="false"
  9 + android:drawable="@drawable/blinker_light_off" />
  10 +</selector>
  11 +
  12 +
Blinker/res/layout/list_item.xml 0 → 100644
  1 +++ a/Blinker/res/layout/list_item.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +
  3 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4 + android:layout_width="fill_parent"
  5 + android:layout_height="wrap_content">
  6 + <TextView
  7 + android:id="@+id/item_label"
  8 + android:layout_alignParentLeft="true"
  9 + android:layout_gravity="left"
  10 + android:layout_width="wrap_content"
  11 + android:layout_height="fill_parent"
  12 + android:layout_centerVertical="true"
  13 + android:textSize="20px"
  14 + android:text="test"
  15 + android:paddingBottom="10dp"
  16 + android:paddingTop="10dp"
  17 + android:layout_marginLeft="10dp"
  18 + android:textColor="@color/labels"
  19 + />
  20 + <ImageView
  21 + android:id="@+id/checkmark"
  22 + android:src="@android:drawable/checkbox_on_background"
  23 + android:layout_alignParentRight="true"
  24 + android:layout_centerVertical="true"
  25 + android:layout_width="wrap_content"
  26 + android:layout_height="wrap_content"
  27 + android:layout_marginRight="10dp"
  28 + />
  29 +
  30 +</RelativeLayout>
0 \ No newline at end of file 31 \ No newline at end of file
Blinker/res/layout/main_activity.xml 0 → 100644
  1 +++ a/Blinker/res/layout/main_activity.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + android:layout_width="fill_parent"
  4 + android:layout_height="fill_parent"
  5 + android:background="@color/background">
  6 +
  7 +
  8 + <!--Connected and disconnected graphic in upper right corner-->
  9 + <ImageView
  10 + android:contentDescription="connected indicator"
  11 + android:id="@+id/connected_indicator"
  12 + android:layout_alignParentRight="true"
  13 + android:layout_alignParentTop="true"
  14 + android:layout_height="wrap_content"
  15 + android:layout_width="wrap_content"
  16 + android:layout_marginRight="5dp"
  17 + android:layout_marginTop="5dp"
  18 + android:src="@drawable/connected_indicator"
  19 + />
  20 +
  21 + />
  22 +
  23 + <!--The LED image-->
  24 + <ImageView
  25 + android:contentDescription="led image"
  26 + android:id="@+id/led_image"
  27 + android:layout_marginTop="10dp"
  28 + android:layout_marginBottom="45dp"
  29 + android:layout_below="@id/connected_indicator"
  30 + android:layout_height="wrap_content"
  31 + android:layout_width="wrap_content"
  32 + android:layout_centerHorizontal="true"
  33 + android:src="@drawable/led" />
  34 +
  35 +
  36 +
  37 +
  38 + <!--The on/off control line-->
  39 + <RelativeLayout
  40 + android:id="@+id/blink_control"
  41 + android:layout_below="@id/led_image"
  42 + android:layout_width="fill_parent"
  43 + android:layout_height="wrap_content"
  44 + android:layout_marginBottom="@dimen/control_bottom">
  45 +
  46 + <TextView android:layout_height="wrap_content"
  47 + android:layout_width="wrap_content"
  48 + android:text="@string/label_blink"
  49 + android:textColor="@color/labels"
  50 + android:textStyle="bold"
  51 + android:layout_marginLeft="@dimen/label_left_margin"
  52 + android:layout_alignParentLeft="true"
  53 + android:layout_centerVertical="true"
  54 + />
  55 +
  56 + <ToggleButton
  57 + android:id="@+id/on_off_button"
  58 + android:layout_height="wrap_content"
  59 + android:layout_width="wrap_content"
  60 + android:layout_centerHorizontal="true"
  61 + android:layout_centerVertical="true"
  62 + android:textOff="@string/toggle_text_off"
  63 + android:textOn="@string/toggle_text_on"
  64 + android:gravity="center_horizontal"
  65 + android:onClick="onToggleOnOff"
  66 + />
  67 +
  68 + <TextView
  69 + android:id="@+id/indicator_count"
  70 + android:layout_height="wrap_content"
  71 + android:layout_width="wrap_content"
  72 + android:layout_marginRight="@dimen/label_right_margin"
  73 + android:layout_alignParentRight="true"
  74 + android:layout_centerVertical="true"
  75 + android:text="0"
  76 + android:textStyle="bold"
  77 + android:textColor="@color/numbers"
  78 + />
  79 +
  80 + </RelativeLayout>
  81 +
  82 +
  83 +
  84 + <!--The Delay Slider Control and Display Line-->
  85 + <RelativeLayout
  86 + android:id="@+id/delay_control"
  87 + android:layout_below="@id/blink_control"
  88 + android:layout_width="fill_parent"
  89 + android:layout_height="wrap_content"
  90 + android:layout_marginBottom="@dimen/control_bottom">
  91 +
  92 +
  93 + <TextView android:layout_height="wrap_content"
  94 + android:layout_width="wrap_content"
  95 + android:text="@string/label_delay"
  96 + android:textColor="@color/labels"
  97 + android:textStyle="bold"
  98 + android:layout_marginLeft="@dimen/label_left_margin"
  99 + android:layout_alignParentLeft="true"
  100 + android:layout_centerVertical="true"
  101 + />
  102 + <SeekBar
  103 + android:id="@+id/slider"
  104 + android:layout_width="150dp"
  105 + android:layout_height="wrap_content"
  106 + android:layout_centerVertical="true"
  107 + android:layout_centerHorizontal="true"
  108 + />
  109 +
  110 + <TextView
  111 + android:id="@+id/delay"
  112 + android:layout_height="wrap_content"
  113 + android:layout_width="wrap_content"
  114 + android:layout_marginRight="@dimen/label_right_margin"
  115 + android:layout_alignParentRight="true"
  116 + android:layout_centerVertical="true"
  117 + android:text="0"
  118 + android:textStyle="bold"
  119 + android:textColor="@color/numbers"
  120 + />
  121 +
  122 + </RelativeLayout>
  123 +
  124 +
  125 + <!--The Repeat Control and Display Line-->
  126 + <RelativeLayout
  127 + android:id="@+id/repeat_control"
  128 + android:layout_below="@id/delay_control"
  129 + android:layout_width="fill_parent"
  130 + android:layout_height="wrap_content"
  131 + android:layout_marginBottom="@dimen/control_bottom">
  132 +
  133 +
  134 + <TextView android:layout_height="wrap_content"
  135 + android:layout_width="wrap_content"
  136 + android:text="@string/label_repeat"
  137 + android:textColor="@color/labels"
  138 + android:textStyle="bold"
  139 + android:layout_marginLeft="@dimen/label_left_margin"
  140 + android:layout_alignParentLeft="true"
  141 + android:layout_centerVertical="true"
  142 + />
  143 +
  144 + <LinearLayout
  145 + android:layout_width="wrap_content"
  146 + android:layout_height="wrap_content"
  147 + android:orientation="horizontal"
  148 + android:layout_centerVertical="true"
  149 + android:layout_centerHorizontal="true"
  150 + >
  151 + <Button
  152 + android:id="@+id/minus_button"
  153 + android:layout_height="wrap_content"
  154 + android:layout_width="wrap_content"
  155 + android:text="-"
  156 + android:textSize="30dp"
  157 + android:typeface="monospace"
  158 + android:paddingLeft="22dp"
  159 + android:paddingRight="22dp"
  160 +
  161 + android:gravity="center"
  162 + android:layout_marginRight="0dp"
  163 + android:onClick="onMinusButtonClick"
  164 + />
  165 +
  166 + <Button
  167 + android:id="@+id/plus_button"
  168 + android:layout_height="wrap_content"
  169 + android:layout_width="wrap_content"
  170 + android:text="+"
  171 + android:textSize="30dp"
  172 + android:typeface="monospace"
  173 + android:paddingLeft="22dp"
  174 + android:paddingRight="22dp"
  175 +
  176 + android:gravity="center"
  177 + android:layout_marginLeft="0dp"
  178 + android:onClick="onPlusButtonClick"
  179 + />
  180 +
  181 + </LinearLayout>
  182 +
  183 +
  184 + <TextView
  185 + android:id="@+id/repeat_count"
  186 + android:layout_height="wrap_content"
  187 + android:layout_width="wrap_content"
  188 + android:layout_marginRight="@dimen/label_right_margin"
  189 + android:layout_alignParentRight="true"
  190 + android:layout_centerVertical="true"
  191 + android:text="0"
  192 + android:textStyle="bold"
  193 + android:textColor="@color/numbers"
  194 + />
  195 +
  196 + </RelativeLayout>
  197 +
  198 +
  199 + <!--Container for Footer buttons, SetDevice and Connect/Disconnect -->
  200 + <RelativeLayout
  201 + android:layout_width="fill_parent"
  202 + android:layout_height="wrap_content"
  203 + android:layout_alignParentBottom="true"
  204 + android:paddingBottom="8dp"
  205 + android:paddingTop="8dp"
  206 + android:background="@drawable/gradient"
  207 + >
  208 +
  209 + <Button
  210 + android:id="@+id/connect_button"
  211 + android:text="@string/label_connect"
  212 + android:gravity="center"
  213 + android:layout_centerVertical="true"
  214 + android:layout_alignParentRight="true"
  215 + android:layout_height="wrap_content"
  216 + android:layout_width="wrap_content"
  217 + android:onClick="onConnectToggleClick"
  218 +
  219 + />
  220 + <Button
  221 + android:id="@+id/setdevice_button"
  222 + android:text="@string/label_set_device"
  223 + android:gravity="center"
  224 + android:layout_centerVertical="true"
  225 + android:layout_alignParentLeft="true"
  226 + android:layout_height="wrap_content"
  227 + android:layout_width="wrap_content"
  228 + android:onClick="onSetDeviceClick"
  229 + />
  230 +
  231 +
  232 +
  233 + </RelativeLayout>
  234 +
  235 +</RelativeLayout>
  236 +
Blinker/res/layout/set_device_activity.xml 0 → 100644
  1 +++ a/Blinker/res/layout/set_device_activity.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +
  3 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4 + android:layout_width="fill_parent"
  5 + android:layout_height="fill_parent"
  6 + android:orientation="vertical"
  7 + android:background="@color/background"
  8 + >
  9 +
  10 + <!--Simple header for our list-->
  11 + <RelativeLayout
  12 + android:layout_width="fill_parent"
  13 + android:layout_height="wrap_content"
  14 + android:background="@color/background_header"
  15 + >
  16 + <TextView
  17 + android:layout_width="fill_parent"
  18 + android:layout_height="wrap_content"
  19 + android:paddingBottom="10dp"
  20 + android:layout_centerInParent="true"
  21 + android:gravity="center"
  22 + android:text="@string/heading_set_device"
  23 + android:textStyle="bold"
  24 + />
  25 + <Button
  26 + android:layout_alignParentRight="true"
  27 + android:layout_width="wrap_content"
  28 + android:layout_height="wrap_content"
  29 + android:text="@string/label_scan"
  30 + android:onClick="onScanDeviceClick"/>
  31 +
  32 + </RelativeLayout>
  33 +
  34 + <!--The actual device list-->
  35 + <ListView
  36 + android:id="@+id/device_list_view"
  37 + android:layout_width="fill_parent"
  38 + android:layout_height="fill_parent"
  39 + />
  40 +
  41 +
  42 +</LinearLayout>
0 \ No newline at end of file 43 \ No newline at end of file
Blinker/res/raw/blinker.json 0 → 100644
  1 +++ a/Blinker/res/raw/blinker.json
  1 +{"resources":{"$schemaHash":{"id":-6,"align":1,"attributes":{"readonly":true},"type":"A16:u1","access":"r","size":16},"$eapProtocolLevel":{"id":-3,"align":2,"attributes":{"readonly":true},"type":"u2","access":"r","size":2},"cmd":{"id":1,"align":1,"attributes":{"writeonly":true},"type":"E:demos@emmoco.com.Blinker/Cmd","access":"w","size":1},"$mcmProtocolLevel":{"id":-2,"align":2,"attributes":{"readonly":true},"type":"u2","access":"r","size":2},"count":{"id":2,"align":2,"attributes":{"readwrite":true},"type":"i2","access":"rw","size":2},"$schemaUuid":{"id":-1,"align":1,"attributes":{"readonly":true},"type":"A16:u1","access":"r","size":16},"delay":{"id":3,"align":2,"attributes":{"readwrite":true},"type":"N:0.500000,2.000000,0.100000,3/u2","access":"rw","size":2},"$eapBuildDate":{"id":-4,"align":1,"attributes":{"readonly":true},"type":"A8:u1","access":"r","size":8},"$resourceCount":{"id":-7,"align":1,"attributes":{"readonly":true},"type":"S:system@emmoco.com.System/ResourceCount","access":"r","size":2},"ledState":{"id":4,"align":1,"attributes":{"indicator":true,"readonly":true},"type":"E:demos@emmoco.com.Blinker/LedState","access":"ir","size":1},"$fileIndexReset":{"id":-5,"align":2,"attributes":{"writeonly":true},"type":"i2","access":"w","size":2}},"resourceNamesSys":["$eapBuildDate","$eapProtocolLevel","$fileIndexReset","$mcmProtocolLevel","$resourceCount","$schemaHash","$schemaUuid"],"manifest":{"protocolLevel":7,"hash":[193,64,14,198,222,65,254,73,231,195,236,98,124,34,224,251],"name":"Blinker","uuid":[243,78,78,150,58,146,163,180,255,66,64,107,112,96,163,80],"build":[228,142,35,113,54,1,0,0],"date":"2012-04-01T22:40:17","maxAlign":2,"maxSize":16,"version":"1.0.0"},"resourceNames":["cmd","count","delay","ledState","$schemaUuid","$mcmProtocolLevel","$eapProtocolLevel","$eapBuildDate","$fileIndexReset","$schemaHash","$resourceCount"],"attributes":{"description":"Blinker, the hello world program for mobile control","owner":"demos@emmoco.com","uuid":"50a36070-6b40-42ff-b4a3-923a964e4ef3","version":"1.0.0"},"types":{"system@emmoco.com.System/ResourceCount":{"align":1,"type":"S:system@emmoco.com.System/ResourceCount","size":2,"fields":[{"align":1,"name":"app","type":"u1","size":1},{"align":1,"name":"sys","type":"u1","size":1}]},"std:i2":{"align":2,"size":2},"demos@emmoco.com.Blinker/LedState":{"values":["LED_OFF","LED_ON"],"align":1,"type":"E:demos@emmoco.com.Blinker/LedState","size":1},"std:u1":{"align":1,"size":1},"std:u2":{"align":2,"size":2},"demos@emmoco.com.Blinker/Cmd":{"values":["START_CMD","STOP_CMD"],"align":1,"type":"E:demos@emmoco.com.Blinker/Cmd","size":1}},"resourceNamesApp":["cmd","count","delay","ledState"],"imports":{"demos@emmoco.com.Blinker":true}}
0 \ No newline at end of file 2 \ No newline at end of file
Blinker/res/values/colors.xml 0 → 100644
  1 +++ a/Blinker/res/values/colors.xml
  1 +<resources>
  2 +
  3 + <color name="background_header">#000000</color>
  4 + <color name="background">#FFF</color>
  5 +
  6 + <color name="labels">#000000</color>
  7 + <color name="numbers">#2e82a2</color>
  8 +
  9 +
  10 +</resources>
  11 +
Blinker/res/values/dimensions.xml 0 → 100644
  1 +++ a/Blinker/res/values/dimensions.xml
  1 +<resources>
  2 + <dimen name="label_left_margin">15dp</dimen>
  3 + <dimen name="label_right_margin">15dp</dimen>
  4 + <dimen name="control_bottom">15dp</dimen>
  5 +
  6 +
  7 +</resources>
Blinker/res/values/strings.xml 0 → 100644
  1 +++ a/Blinker/res/values/strings.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 + <string name="app_name">Blinker Demo</string>
  4 +
  5 +
  6 + <!--Label and heading strings-->
  7 + <string name="label_set_device">Device</string>
  8 + <string name="label_delay">Delay</string>
  9 + <string name="label_repeat">Repeat</string>
  10 + <string name="label_blink">Blink</string>
  11 + <string name="heading_set_device">Choose Target Device"</string>
  12 + <string name="label_connect">Connect</string>
  13 + <string name="label_disconnect">Disconnect</string>
  14 + <string name="label_cancel">Cancel</string>
  15 + <string name="label_scan">Scan</string>
  16 +
  17 + <string name="toggle_text_on">ON</string>
  18 + <string name="toggle_text_off">OFF</string>
  19 +
  20 +
  21 +
  22 + <!--Toast messages-->
  23 + <string name="notice_connected">Emmoco Target Device Connected</string>
  24 + <string name="notice_disconnected">Emmoco Target Device Disconnected</string>
  25 + <string name="notice_timeout">Emmoco Target Device Connection Timeout</string>
  26 + <string name="notice_cancelled">Emmoco Target Device Connection Cancelled</string>
  27 + <string name="notice_failure">Emmoco Target Device Connection Failure</string>
  28 + <string name="notice_uuid_mismatch">Connection Failure. The Target Device Is Not Using The Blinker Schema</string>
  29 + <string name="notice_connecting">Connecting</string>
  30 + <string name="notice_cancelling">Cancelling connection...</string>
  31 +
  32 +
  33 + <!--Dialog text when the schema does not match-->
  34 + <string name="mismatch_title">Incompatible Schema</string>
  35 + <string name="mismatch_uuid">The schema that is on the device you\'re connecting to isn\'t the same
  36 + as the one you\'re viewing currently. Attempting to read or write resources will probably fail.</string>
  37 +
  38 +
  39 +
  40 +</resources>
Blinker/res/values/styles.xml 0 → 100644
  1 +++ a/Blinker/res/values/styles.xml
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +
  3 +<resources>
  4 + <style name="AppTheme" parent="@android:style/Theme">
  5 + <item name="android:windowNoTitle">true</item>
  6 + <item name="android:windowBackground">@color/background</item>
  7 + </style>
  8 +
  9 +</resources>
  10 +
Blinker/src/com/emmoco/example/blinker/MainActivity.java 0 → 100644
  1 +++ a/Blinker/src/com/emmoco/example/blinker/MainActivity.java
  1 +package com.emmoco.example.blinker;
  2 +
  3 +import android.app.Activity;
  4 +import android.app.ProgressDialog;
  5 +import android.content.Context;
  6 +import android.content.DialogInterface;
  7 +import android.content.Intent;
  8 +import android.content.SharedPreferences;
  9 +import android.os.Bundle;
  10 +import android.preference.PreferenceManager;
  11 +import android.text.InputType;
  12 +import android.view.View;
  13 +import android.widget.*;
  14 +import com.emmoco.android.*;
  15 +
  16 +
  17 +/**
  18 + * This example application uses the Emmoco Framework to connect to a target running the Blinker schema
  19 + * It allows the users to control the target by setting the blink counter, the blink delay and start the LED blinker
  20 + * application running on the target.
  21 + *
  22 + * This application will receive indicators from the target when the LED changes state (on or off) and the app will
  23 + * update an on-screen LED to match the state of the target's LED
  24 + *
  25 + *
  26 + */
  27 +public class MainActivity extends Activity {
  28 +
  29 + // The connection states track the app's connection to the target device
  30 + public enum ConnectionState {
  31 + CONNECTED, DISCONNECTED
  32 + };
  33 +
  34 + private final static String TAG = "Blinker";
  35 +
  36 + private String mCurrentDevice;
  37 + private ResourceSchema mServiceSchema;
  38 + private TargetConnection mTargetConnection;
  39 +
  40 + private ResourceValue mCmdResourceValue;
  41 + private ResourceValue mLedStateResourceValue;
  42 + private ResourceValue mCountResourceValue;
  43 + private ResourceValue mDelayResourceValue;
  44 +
  45 + private ImageView mLedImage;
  46 + private ImageView mIndicator;
  47 + private TextView mCountTextView;
  48 + private TextView mDelayTextView;
  49 + private TextView mIndTextView;
  50 + private Button mConnectButton;
  51 + private ToggleButton mOnOffButton;
  52 + private Button mPlusButton;
  53 + private Button mMinusButton;
  54 + private Button mSetDevice;
  55 +
  56 + private ConnectionState mConnectionState = ConnectionState.DISCONNECTED;
  57 + private long mScaledStep;
  58 + private String mDelayFormat;
  59 + private SeekBar mSlider;
  60 + private StickyProgressDialog mProgress;
  61 + private int mLocalCount;
  62 +
  63 +
  64 + /**
  65 + * Standard Android onCreate method. This will setup all the layout and save references to the UI elements
  66 + * that will be modified during the course of the program
  67 + *
  68 + * @param savedInstanceState
  69 + */
  70 + @Override
  71 + public void onCreate(Bundle savedInstanceState) {
  72 +
  73 + super.onCreate(savedInstanceState);
  74 +
  75 + // Setup and retrieve view references
  76 + setContentView(R.layout.main_activity);
  77 + mLedImage = (ImageView) findViewById(R.id.led_image);
  78 + mIndicator = (ImageView) findViewById(R.id.connected_indicator);
  79 + mCountTextView = (TextView) findViewById(R.id.repeat_count);
  80 + mIndTextView = (TextView) findViewById(R.id.indicator_count);
  81 + mConnectButton = (Button) findViewById(R.id.connect_button);
  82 + mOnOffButton = (ToggleButton) findViewById(R.id.on_off_button);
  83 + mPlusButton = (Button) findViewById(R.id.plus_button);
  84 + mMinusButton = (Button) findViewById(R.id.minus_button);
  85 + mSetDevice = (Button) findViewById(R.id.setdevice_button);
  86 +
  87 + // Create a ProgressDialog spinner to use during connection
  88 + mProgress = new StickyProgressDialog(this);
  89 + mProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
  90 + mProgress.setButton(getResources().getString(R.string.label_cancel), new DialogInterface.OnClickListener() {
  91 + public void onClick(DialogInterface dialog, int which) {
  92 + // Cancel the connect attempt by closing it
  93 + mTargetConnection.closeSync();
  94 + mProgress.setMessage(getResources().getString(R.string.notice_cancelling));
  95 + mProgress.show();
  96 + return;
  97 + }
  98 + });
  99 +
  100 + // Setup Emmoco specific items
  101 + initializeEmmoco();
  102 +
  103 + // set the slider for entering the delay value
  104 + setup_slider();
  105 +
  106 + // Update the UI elements to show that the we are not connected to the target
  107 + updateUiState(false);
  108 +
  109 +
  110 + }
  111 +
  112 +
  113 +
  114 + /**
  115 + * Standard Android onDestroy. Here we will make sure that we are disconnected from the target on Activity
  116 + * destruction.
  117 + */
  118 + @Override
  119 + protected void onDestroy() {
  120 + super.onDestroy();
  121 + if (mTargetConnection != null)
  122 + mTargetConnection.closeSync();
  123 + }
  124 +
  125 +
  126 + /**
  127 + * Do all the work loading the schema and setting up the references to the Emmoco Target's Resources
  128 + */
  129 + private void initializeEmmoco() {
  130 +
  131 + // load the schema that was downloaded from em-hub. We include the schema as part of the app resources
  132 + mServiceSchema = Framework.current().createSchemaFromRaw(this, R.raw.blinker);
  133 +
  134 + // get the device to connect to from the users preferences
  135 + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  136 + mCurrentDevice = prefs.getString(SetDeviceActivity.PREF_DEVICE_NAME, TargetConnection.MOCK_BLINKER_PRE);
  137 +
  138 + // initialize the Emmoco the resources
  139 + mCmdResourceValue = mServiceSchema.newValue("cmd");
  140 + mLedStateResourceValue = mServiceSchema.newValue("ledState");
  141 + mCountResourceValue = mServiceSchema.newValue("count");
  142 + mDelayResourceValue = mServiceSchema.newValue("delay");
  143 +
  144 +
  145 + }
  146 +
  147 + /**
  148 + * Update the UI elements based on whether we are connected or disconnected from the target
  149 + *
  150 + * If we are connected, we enable all the UI controls.
  151 + * If we are disconnected, we disable all the UI controls that require talking to the target to operate
  152 + *
  153 + * @param connected
  154 + */
  155 + private void updateUiState(boolean connected){
  156 +
  157 + // indicator light
  158 + mIndicator.setEnabled(connected);
  159 +
  160 + // delay slider
  161 + mSlider.setEnabled(connected);
  162 +
  163 + // on/off toggle
  164 + mOnOffButton.setEnabled(connected);
  165 +
  166 + if (mConnectionState == ConnectionState.DISCONNECTED){
  167 + // Change text on connect button
  168 + mConnectButton.setText(R.string.label_connect);
  169 + }else{
  170 + mConnectButton.setText(R.string.label_disconnect);
  171 + }
  172 +
  173 + // Repeat section buttons
  174 + mMinusButton.setEnabled(connected);
  175 + mPlusButton.setEnabled(connected);
  176 + mCountTextView.setEnabled(connected);
  177 +
  178 + // The device button is only active when not connected
  179 + mSetDevice.setEnabled(!connected);
  180 +
  181 + // When connect or disconnect happens, the toggle button is not checked
  182 + mOnOffButton.setChecked(false);
  183 +
  184 + // Clear the local counter
  185 + mIndTextView.setText("");
  186 +
  187 +
  188 + }
  189 +
  190 +
  191 + /**
  192 + * Emmoco Reactor used to handle the connection requests to the target
  193 + *
  194 + * Reactors are listeners that are called when the target device state changes, read/writes complete, or the target
  195 + * sends an indicator.
  196 + *
  197 + * Reactors are called from the context of the UI thread.
  198 + *
  199 + * This reactor will be called back during the connection and disconnection phases of the example.
  200 + *
  201 + * This will set the UI elements to certain values based on connection and disconnection states
  202 + *
  203 + */
  204 + enum Connection { CONNECT_DONE, DISCONNECT_DONE };
  205 + private Reactor<Connection> mConnectionReactor = new Reactor<Connection>() {
  206 + public void exec(Connection action, int status, Bundle data) {
  207 + Toast msg;
  208 + int notice;
  209 +
  210 + switch (action) {
  211 + case CONNECT_DONE:
  212 +
  213 + if (status == TargetConnection.STATUS_OK) {
  214 + //
  215 + // Connection completed successfully
  216 + //
  217 + mConnectionState = ConnectionState.CONNECTED;
  218 + notice = R.string.notice_connected;
  219 +
  220 + // bind to catch if the far end disconnects
  221 + mTargetConnection.bindHangupEvent(mConnectionReactor.event(Connection.DISCONNECT_DONE));
  222 +
  223 + // read and display the current value of count
  224 + mTargetConnection.read(mCountResourceValue, mCountReactor.event(CountAction.READ_COMPLETE));
  225 +
  226 + // read and display the current value of delay
  227 + mTargetConnection.read(mDelayResourceValue, mDelayReactor.event(DelayAction.READ_COMPLETE));
  228 +
  229 + // Now update all the UI elements
  230 + updateUiState(true);
  231 + } else if (status == TargetConnection.STATUS_UUID_MISMATCH) {
  232 + mConnectionState = ConnectionState.DISCONNECTED;
  233 + notice = R.string.notice_uuid_mismatch;
  234 + } else if (status == TargetConnection.STATUS_CONNECTION_TIMEOUT) {
  235 + mConnectionState = ConnectionState.DISCONNECTED;
  236 + notice = R.string.notice_timeout;
  237 + } else if (status == TargetConnection.STATUS_CONNECTION_CANCELLED) {
  238 + mConnectionState = ConnectionState.DISCONNECTED;
  239 + notice = R.string.notice_cancelled;
  240 + } else {
  241 + // Connection attempt failed. Display a message
  242 + notice = R.string.notice_failure;
  243 + mConnectionState = ConnectionState.DISCONNECTED;
  244 + }
  245 +
  246 + // Show a quick toast with the status of the connection
  247 + msg = Toast.makeText(getApplicationContext(), notice, Toast.LENGTH_LONG);
  248 + msg.show();
  249 +
  250 + // Dismiss the dialog only when connect result comes back
  251 + mProgress.dismissManually();
  252 +
  253 + break;
  254 +
  255 + case DISCONNECT_DONE:
  256 + // no need to check the status, disconnect always completes by leaving us
  257 + // in the disconnected state
  258 + mConnectionState = ConnectionState.DISCONNECTED;
  259 + msg = Toast.makeText(getApplicationContext(), R.string.notice_disconnected, Toast.LENGTH_SHORT);
  260 + msg.show();
  261 +
  262 + updateUiState(false);
  263 +
  264 + break;
  265 + }
  266 + }
  267 + };
  268 +
  269 +
  270 + /**
  271 + * Reactor used to handle the writes and indicators for the blinker schema. This reactor will be called back
  272 + * after each write (where we do not need to do anything at all) and the firing of the indicator. When the
  273 + * indicator is fired, it signals when the LED changes, so we can use that indicator to trigger our UI LED and
  274 + * countdown value to change
  275 + */
  276 + enum Action { WRITE_CMD_COMPLETE, INDICATOR };
  277 + private Reactor<Action> mLedReactor = new Reactor<Action>() {
  278 + public void exec(Action action, int status, Bundle data) {
  279 + switch (action) {
  280 + case WRITE_CMD_COMPLETE:
  281 + // nothing to do
  282 + break;
  283 + case INDICATOR:
  284 + // update the virtual led display based on the value that gets updated when the indicator is fired.
  285 + // We registered this value after connection occurred with bindIndicatorValue()
  286 + if (mLedStateResourceValue.toString().equals("LED_OFF")) {
  287 + mLedImage.setSelected(false);
  288 + if (mLocalCount == 0){
  289 + // Reached the end, we disable some UI elements
  290 + mIndTextView.setText("");
  291 + mOnOffButton.setChecked(false);
  292 + }
  293 + } else {
  294 + mLedImage.setSelected(true);
  295 + mLocalCount--;
  296 + mIndTextView.setText(String.valueOf(mLocalCount));
  297 + }
  298 + break;
  299 + }
  300 + }
  301 + };
  302 +
  303 +
  304 + /**
  305 + * Reactor used for count value. When the count value is read back from the target, the UI value is updated with
  306 + * the new value that is read back
  307 + */
  308 + enum CountAction { READ_COMPLETE, WRITE_COMPLETE };
  309 + private Reactor<CountAction> mCountReactor = new Reactor<CountAction>() {
  310 + public void exec(CountAction action, int status, Bundle data) {
  311 + Long count;
  312 + switch (action) {
  313 + case READ_COMPLETE:
  314 + count = new Long(mCountResourceValue.toLong());
  315 + mCountTextView.setText(count.toString());
  316 + break;
  317 + case WRITE_COMPLETE:
  318 + mTargetConnection.read(mCountResourceValue,mCountReactor.event(CountAction.READ_COMPLETE));
  319 + break;
  320 + }
  321 + }
  322 + };
  323 +
  324 +
  325 + /**
  326 + * Reactor used for delay resource. When the delay resource is read or written, the seek bar value is moved (on
  327 + * read) and the display value is updated
  328 + */
  329 + enum DelayAction { READ_COMPLETE, WRITE_COMPLETE };
  330 + private Reactor<DelayAction> mDelayReactor = new Reactor<DelayAction>() {
  331 + public void exec(DelayAction action, int status, Bundle data) {
  332 + double delay;
  333 + long delayOrd;
  334 + switch (action) {
  335 + case READ_COMPLETE:
  336 + delay = mDelayResourceValue.toDouble();
  337 + delayOrd = mDelayResourceValue.toLong();
  338 + mDelayTextView.setText(String.format(mDelayFormat, delay));
  339 +
  340 + // set the progress bar position based on the ordinal value. We use the ordinal value
  341 + // to determine where to position the seek on the 0 to 100 scale of the seekbar.
  342 + int progress;
  343 + if (delayOrd == mDelayResourceValue.numMaxOrdinal()) {
  344 + progress = 100;
  345 + } else {
  346 + progress = (int) (delayOrd * mScaledStep);
  347 + }
  348 + mSlider.setProgress(progress);
  349 + break;
  350 + case WRITE_COMPLETE:
  351 + // Nothing to do
  352 + break;
  353 + }
  354 + }
  355 + };
  356 +
  357 +
  358 +
  359 +
  360 +
  361 +
  362 + /**
  363 + * The set-device button has been pressed, start the sub-activity which will change the device preference
  364 + */
  365 + final private int DEVICE_SELECT = 1;
  366 + public void onSetDeviceClick(View v) {
  367 + Intent i = new Intent(this, SetDeviceActivity.class);
  368 + startActivityForResult(i, DEVICE_SELECT);
  369 + }
  370 +
  371 + /**
  372 + * Process the result from the set-device sub activity
  373 + *
  374 + * @param requestCode
  375 + * @param resultCode
  376 + * @param data
  377 + */
  378 + @Override
  379 + protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  380 + switch (requestCode){
  381 + case DEVICE_SELECT:
  382 + // If the device value string has changed, update our local copy
  383 + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  384 + String device = prefs.getString(SetDeviceActivity.PREF_DEVICE_NAME, TargetConnection.MOCK_BLINKER_PRE);
  385 +
  386 + // If device has changed we need to disconnect if connected, then the user can reconnect
  387 + // manually to the new device
  388 + if (!mCurrentDevice.contentEquals(device)){
  389 + mCurrentDevice = device;
  390 +
  391 + if ((mTargetConnection != null) &&(mTargetConnection.isConnected())){
  392 + onConnectToggleClick(null);
  393 + }
  394 + }
  395 + break;
  396 + }
  397 + }
  398 +
  399 + /**
  400 + * Handler function for when the on/off button is press. In this handler, depending on the current state,
  401 + * the command is sent to start or stop the blinker on the target
  402 + *
  403 + * @param v unused
  404 + */
  405 + public void onToggleOnOff(View v) {
  406 +
  407 + String command;
  408 +
  409 + ToggleButton b = (ToggleButton)v;
  410 +
  411 + // Determine which command to send
  412 + if (b.isChecked()){
  413 + // We have been turned on
  414 + command = "START_CMD";
  415 +
  416 + // Set up the local count value so we can count down
  417 + mLocalCount = mCountResourceValue.toInt();
  418 + ((TextView)findViewById(R.id.indicator_count)).setText(String.valueOf(mLocalCount));
  419 +
  420 + }else{
  421 + // We have been turned off
  422 + command = "STOP_CMD";
  423 + }
  424 +
  425 + // Send command
  426 + mCmdResourceValue.assignEnum(command);
  427 + mTargetConnection.write(mCmdResourceValue, mLedReactor.event(Action.WRITE_CMD_COMPLETE));
  428 +
  429 + }
  430 +
  431 +
  432 + /**
  433 + * Handler for the connect toggle button
  434 + *
  435 + * Normally in an app the user doesn't worry about connecting or disconnecting, we
  436 + * simply connect when the main activity becomes visible and disconnect
  437 + * when another activity comes to the front, but this handler is used to
  438 + * give the user the ability to toggle the connect state by touching the
  439 + * connect/disconnect button
  440 + *
  441 + * @param v unused
  442 + */
  443 + public void onConnectToggleClick(View v) {
  444 +
  445 + // toggle connect or disconnect
  446 + switch (mConnectionState) {
  447 + case DISCONNECTED:
  448 +
  449 + // Show Connection spinner
  450 + mProgress.setMessage(getResources().getString(R.string.notice_connecting));
  451 + mProgress.setCancelable(false);
  452 + mProgress.show();
  453 +
  454 + // configure the generic mock device if it is being used with some default values
  455 + if (mCurrentDevice.equals(TargetConnection.MOCK_PRE)) {
  456 + MockTargetDevice.reset();
  457 + MockTargetDevice.current().setTickRate(500);
  458 + MockTargetDevice.current().setAccessDelay(2);
  459 + }
  460 +
  461 + // connect to the device using the schema
  462 + mTargetConnection = new TargetConnection(mCurrentDevice, getApplicationContext());
  463 + mTargetConnection.bindSchema(mServiceSchema);
  464 + mTargetConnection.bindIndicatorValue("ledState", mLedReactor.event(Action.INDICATOR),mLedStateResourceValue);
  465 +
  466 + mTargetConnection.open(mConnectionReactor.event(Connection.CONNECT_DONE));
  467 +
  468 + break;
  469 + case CONNECTED:
  470 + mTargetConnection.close(mConnectionReactor.event(Connection.DISCONNECT_DONE));
  471 + break;
  472 + }
  473 + }
  474 +
  475 + /**
  476 + * handler for the minus Button
  477 + * the minus button decrements the count resource and writes it to blinker
  478 + *
  479 + * @param v
  480 + */
  481 + public void onMinusButtonClick(View v) {
  482 + long count = Long.parseLong(mCountTextView.getText().toString());
  483 + if (count > 0) {
  484 + count--;
  485 + }
  486 + mCountResourceValue.assignInt(count);
  487 + mTargetConnection.write(mCountResourceValue, mCountReactor.event(CountAction.WRITE_COMPLETE));
  488 + }
  489 +
  490 + /**
  491 + * Handler for the plus Button
  492 + * The plus button increments the count resource and writes it to blinker
  493 + *
  494 + * @param v
  495 + */
  496 + public void onPlusButtonClick(View v) {
  497 + long count = Long.parseLong(mCountTextView.getText().toString());
  498 + if (count < mCountResourceValue.intMax()){
  499 + count++;
  500 + }
  501 + mCountResourceValue.assignInt(count);
  502 + mTargetConnection.write(mCountResourceValue, mCountReactor.event(CountAction.WRITE_COMPLETE));
  503 + }
  504 +
  505 +
  506 +
  507 +
  508 +
  509 + /**
  510 + * Sets up the seekbar to be used as the input for changing the target's delay values. This must be called
  511 + * after the schema and resource values are set up, We need to do some math here to split the 0 to 100 range of the
  512 + * seekbar into the number of distinct values we can set the delay resource, and map those parts of the seekbar
  513 + * into values that are set.
  514 + *
  515 + */
  516 + private void setup_slider() {
  517 + // calculate scaled step
  518 + mScaledStep = 100 / mDelayResourceValue.numMaxOrdinal();
  519 + mDelayFormat = "%.1f";
  520 +
  521 + mDelayTextView = (TextView) findViewById(R.id.delay);
  522 + mDelayTextView.setRawInputType(InputType.TYPE_CLASS_NUMBER);
  523 + mSlider = (SeekBar) findViewById(R.id.slider);
  524 +
  525 + // initializeEmmoco slider listener
  526 + mSlider.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
  527 +
  528 + public void onStopTrackingTouch(SeekBar seekBar) {
  529 + // they took their finger off the bar, so write to the device
  530 + Double delay = Double.parseDouble(mDelayTextView.getText().toString());
  531 + mDelayResourceValue.assignNum(delay);
  532 + mTargetConnection.write(mDelayResourceValue, mDelayReactor.event(DelayAction.WRITE_COMPLETE));
  533 + }
  534 +
  535 + public void onStartTrackingTouch(SeekBar seekBar) {
  536 + }
  537 +
  538 + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
  539 + long ord = progress / mScaledStep;
  540 + mDelayResourceValue.assignNum(ord);
  541 + mDelayTextView.setText(String.format(mDelayFormat, mDelayResourceValue.toDouble()));
  542 + }
  543 + });
  544 + }
  545 +
  546 +
  547 + /**
  548 + * Android UI tweak.
  549 + * Normally a progress dialog disappears when you hit a button (like cancel), but we want our dialog to stick around
  550 + * until our background task has completed the cancellation phase. The easiest way is to override the dismiss() so
  551 + * the dialog does not automatically close
  552 + */
  553 + private class StickyProgressDialog extends ProgressDialog {
  554 + private StickyProgressDialog(Context context) {
  555 + super(context);
  556 + }
  557 +
  558 + @Override
  559 + public void dismiss() {
  560 + // do nothing
  561 + }
  562 + public void dismissManually() {
  563 + super.dismiss();
  564 + }
  565 + }
  566 +}
  567 +
Blinker/src/com/emmoco/example/blinker/SetDeviceActivity.java 0 → 100644
  1 +++ a/Blinker/src/com/emmoco/example/blinker/SetDeviceActivity.java
  1 +package com.emmoco.example.blinker;
  2 +
  3 +import android.app.Activity;
  4 +import android.content.Intent;
  5 +import android.content.SharedPreferences;
  6 +import android.os.Bundle;
  7 +import android.preference.PreferenceManager;
  8 +import android.view.LayoutInflater;
  9 +import android.view.View;
  10 +import android.view.ViewGroup;
  11 +import android.widget.AdapterView;
  12 +import android.widget.BaseAdapter;
  13 +import android.widget.ListView;
  14 +import android.widget.TextView;
  15 +import com.emmoco.android.TargetConnection;
  16 +
  17 +import java.util.ArrayList;
  18 +
  19 +/**
  20 + * This activity manages a screen where the user can choose from a list of target devices. These devices include
  21 + * the Bluetooth paired devices and the Emmoco mock devices used for testing.
  22 + *
  23 + * This activity maintains a simple listview. There is an option to jump to the Settings->Bluetooth-Scan activity
  24 + * When this activity returns, it refreshes the paired bluetooth device list in case it has changed
  25 + *
  26 + * This uses a custom Listview Adapter to show a checkmark next to the currently saved device
  27 + *
  28 + * The devices is stored using standard Android SharedPreferences
  29 + *
  30 + */
  31 +public class SetDeviceActivity extends Activity{
  32 + final static private String TAG="SetDeviceActivity";
  33 +
  34 + private String mCurrentDevice;
  35 + private ListView mDeviceList;
  36 + private DeviceArrayAdapter mAdapter;
  37 +
  38 + final public static String PREF_DEVICE_NAME = "DEVICE";
  39 + final public static String MOCK_DEVICE_LABEL = "Mock Blinker Device";
  40 +
  41 +
  42 + /**
  43 + * Internal class that adapts our array of device strings to a listview. Current choice is highlighted with
  44 + * a checkmark
  45 + */
  46 + private class DeviceArrayAdapter extends BaseAdapter {
  47 +
  48 + ArrayList<String> mList;
  49 + Activity mContext;
  50 +
  51 + DeviceArrayAdapter(Activity context, ArrayList<String> arrayList) {
  52 + mList = arrayList;
  53 + mContext = context;
  54 + }
  55 +
  56 + public int getCount() {
  57 + return mList.size();
  58 + }
  59 +
  60 + public Object getItem(int i) {
  61 + return mList.get(i);
  62 + }
  63 +
  64 + public long getItemId(int i) {
  65 + return i;
  66 + }
  67 +
  68 + /**
  69 + * Returns a new view constructed from a simple layout. The layout has a textview for the name of the device
  70 + * and a checkmark graphic that is visible or not.
  71 + *
  72 + * @param i
  73 + * @param view
  74 + * @param viewGroup
  75 + * @return
  76 + */
  77 + public View getView(int i, View view, ViewGroup viewGroup) {
  78 + LayoutInflater inflator = mContext.getLayoutInflater();
  79 + view = inflator.inflate(R.layout.list_item, null);
  80 +
  81 + String name = (String)getItem(i);
  82 + String label = name;
  83 +
  84 + // Translate the URI for the device into a pretty label for display in the listview
  85 +
  86 + // If Mock device, use mock label
  87 + if (name.contentEquals(TargetConnection.MOCK_BLINKER_PRE)){
  88 + label = MOCK_DEVICE_LABEL;
  89 + }
  90 + if (name.startsWith(TargetConnection.BT_PRE)) {
  91 + // If Bluetooth, remove prefix
  92 + label = name.substring(TargetConnection.BT_PRE.length());
  93 + }
  94 +
  95 +
  96 + // Set the label in the view
  97 + ((TextView)view.findViewById(R.id.item_label)).setText(label);
  98 +
  99 + // If the current one, show the checkbox
  100 + if (mList.get(i).contentEquals(mCurrentDevice)){
  101 + view.findViewById(R.id.checkmark).setVisibility(View.VISIBLE);
  102 + }else{
  103 + view.findViewById(R.id.checkmark).setVisibility(View.INVISIBLE);
  104 + }
  105 + return view;
  106 + }
  107 +
  108 + // Replace the list with a new one and trigger a redraw on the screen
  109 + public void updateList(ArrayList<String> list){
  110 + mList = list;
  111 + notifyDataSetInvalidated();
  112 + }
  113 + }
  114 +
  115 + /**
  116 + * Standard Android method called at start of activity.
  117 + *
  118 + * Save the
  119 + * @param savedInstanceState
  120 + */
  121 + @Override
  122 + protected void onCreate(Bundle savedInstanceState) {
  123 +
  124 + super.onCreate(savedInstanceState);
  125 + setContentView(R.layout.set_device_activity);
  126 +
  127 +
  128 + mDeviceList = (ListView)findViewById(R.id.device_list_view);
  129 +
  130 + mAdapter = new DeviceArrayAdapter(this,TargetConnection.deviceList(true,false));
  131 + mDeviceList.setAdapter(mAdapter);
  132 +
  133 + // get the device to connect to from the users preferences
  134 + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  135 + mCurrentDevice = prefs.getString(PREF_DEVICE_NAME, TargetConnection.MOCK_BLINKER_PRE);
  136 +
  137 +
  138 + // Register a handler when one of the list items is clicked. This handler will set the
  139 + // preference to use the new device, and finish this activity so we go back to the main activity
  140 + mDeviceList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  141 + public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
  142 +
  143 + String newDeviceName = (String)mAdapter.getItem(i);
  144 +
  145 + // Save changed name to preferences
  146 + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(SetDeviceActivity.this);
  147 + SharedPreferences.Editor edit = prefs.edit();
  148 + edit.putString(PREF_DEVICE_NAME, newDeviceName);
  149 + edit.commit();
  150 +
  151 + // Set the result so the calling activity know we have changed the device
  152 + setResult(RESULT_OK);
  153 + finish();
  154 + }
  155 + } );
  156 +
  157 + }
  158 +
  159 + @Override
  160 + protected void onResume() {
  161 + // If we are resuming after going to Settings-->Bluetooth, the device list may have changed so update
  162 + mAdapter.updateList(TargetConnection.deviceList(true,false));
  163 +
  164 + super.onResume();
  165 + }
  166 +
  167 +
  168 +
  169 + /**
  170 + * Use an intent to call the Android bluetooth settings for scanning bluetooth devices
  171 + * @param v
  172 + */
  173 + public void onScanDeviceClick(View v) {
  174 + Intent i = new Intent();
  175 + i.setAction(android.provider.Settings.ACTION_BLUETOOTH_SETTINGS);
  176 + startActivity(i);
  177 + }
  178 +
  179 +}
BlinkerLaunchPad/.externalToolBuilders/Blinker LaunchPad Builder.launch 0 → 100644
  1 +++ a/BlinkerLaunchPad/.externalToolBuilders/Blinker LaunchPad Builder.launch
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
  3 +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
  4 +<mapAttribute key="org.eclipse.debug.core.environmentVariables">
  5 +<mapEntry key="PATH" value="${eclipse_home}/msptools/bin${system_property:path.separator}${env_var:PATH}"/>
  6 +</mapAttribute>
  7 +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
  8 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;resources&gt;&lt;item path=&quot;/BlinkerLaunchPad/main.c&quot; type=&quot;1&quot;/&gt;&lt;item path=&quot;/BlinkerLaunchPad/main.out&quot; type=&quot;1&quot;/&gt;&lt;item path=&quot;/BlinkerLaunchPad/makefile&quot; type=&quot;1&quot;/&gt;&lt;item path=&quot;/BlinkerSchema/out/Blinker.h&quot; type=&quot;1&quot;/&gt;&lt;item path=&quot;/BlinkerSchema/schema.ems&quot; type=&quot;1&quot;/&gt;&lt;item path=&quot;/CommonLaunchPad&quot; type=&quot;4&quot;/&gt;&lt;/resources&gt;}"/>
  9 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${eclipse_home}/msptools/bin/gmake${exe_ext}"/>
  10 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
  11 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="all COMMON=${project_loc:/CommonLaunchPad} SCHEMA=${project_loc:/BlinkerSchema}"/>
  12 +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
  13 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}"/>
  14 +</launchConfiguration>
BlinkerLaunchPad/.externalToolBuilders/Blinker LaunchPad Cleaner.launch 0 → 100644
  1 +++ a/BlinkerLaunchPad/.externalToolBuilders/Blinker LaunchPad Cleaner.launch
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
  3 +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
  4 +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
  5 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${eclipse_home}/msptools/bin/gmake${exe_ext}"/>
  6 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="clean"/>
  7 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="local-clean COMMON=${project_loc:/CommonLaunchPad}"/>
  8 +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
  9 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}"/>
  10 +</launchConfiguration>
BlinkerLaunchPad/.project 0 → 100644
  1 +++ a/BlinkerLaunchPad/.project
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>BlinkerLaunchPad</name>
  4 + <comment></comment>
  5 + <projects>
  6 + <project>BlinkerSchema</project>
  7 + </projects>
  8 + <buildSpec>
  9 + <buildCommand>
  10 + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
  11 + <triggers>full,incremental,</triggers>
  12 + <arguments>
  13 + <dictionary>
  14 + <key>LaunchConfigHandle</key>
  15 + <value>&lt;project&gt;/.externalToolBuilders/Blinker LaunchPad Builder.launch</value>
  16 + </dictionary>
  17 + </arguments>
  18 + </buildCommand>
  19 + <buildCommand>
  20 + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
  21 + <triggers>clean,</triggers>
  22 + <arguments>
  23 + <dictionary>
  24 + <key>LaunchConfigHandle</key>
  25 + <value>&lt;project&gt;/.externalToolBuilders/Blinker LaunchPad Cleaner.launch</value>
  26 + </dictionary>
  27 + </arguments>
  28 + </buildCommand>
  29 + </buildSpec>
  30 + <natures>
  31 + <nature>com.emmoco.mcmtooling.example.mcmToolingExampleNature</nature>
  32 + </natures>
  33 +</projectDescription>
BlinkerLaunchPad/Blinker.obj 0 → 100644
No preview for this file type
BlinkerLaunchPad/Log/log.txt 0 → 100644
  1 +++ a/BlinkerLaunchPad/Log/log.txt
BlinkerLaunchPad/main.c 0 → 100644
  1 +++ a/BlinkerLaunchPad/main.c
  1 +/*
  2 + * ============ Platform Configuration ============
  3 + */
  4 +
  5 +#include <msp430.h>
  6 +
  7 +#define LED_ON() (P1OUT |= BIT6)
  8 +#define LED_OFF() (P1OUT &= ~BIT6)
  9 +#define LED_READ() (P1OUT & BIT6)
  10 +#define LED_TOGGLE() (P1OUT ^= BIT6)
  11 +
  12 +#define CONNECTED_LED_ON() (P1OUT |= BIT0)
  13 +#define CONNECTED_LED_OFF() (P1OUT &= ~BIT0)
  14 +
  15 +#define EAP_RX_BUF UCA0RXBUF
  16 +#define EAP_TX_BUF UCA0TXBUF
  17 +
  18 +#define EAP_RX_VECTOR USCIAB0RX_VECTOR
  19 +#define EAP_TX_VECTOR PORT2_VECTOR
  20 +
  21 +#define EAP_RX_ACK_CONFIG() (P2DIR |= BIT0)
  22 +#define EAP_RX_ACK_SET() (P2OUT |= BIT0)
  23 +#define EAP_RX_ACK_CLR() (P2OUT &= ~BIT0)
  24 +
  25 +#define EAP_TX_INT_CONFIG() (P2DIR &= ~BIT1, P2IES |= BIT1, P2IFG &= BIT1, P2IE |= BIT1)
  26 +#define EAP_TX_INT_TST() (P2IFG & BIT1)
  27 +#define EAP_TX_INT_CLR() (P2IFG &= ~BIT1)
  28 +
  29 +void init(void) {
  30 +
  31 + WDTCTL = WDTPW + WDTHOLD;
  32 + BCSCTL2 = SELM_0 + DIVM_0 + DIVS_0;
  33 + if (CALBC1_1MHZ != 0xFF) {
  34 + DCOCTL = 0x00;
  35 + BCSCTL1 = CALBC1_1MHZ; /* Set DCO to 1MHz */
  36 + DCOCTL = CALDCO_1MHZ;
  37 + }
  38 + BCSCTL1 |= XT2OFF + DIVA_0;
  39 + BCSCTL3 = XT2S_0 + LFXT1S_2 + XCAP_1;
  40 +
  41 + P1DIR |= BIT0; /* LED */
  42 + LED_OFF();
  43 + P1DIR |= BIT6; /* CONNECTED_LED */
  44 + CONNECTED_LED_OFF();
  45 +
  46 + UCA0CTL1 |= UCSWRST;
  47 +
  48 + P1SEL |= BIT1 + BIT2;
  49 + P1SEL2 |= BIT1 + BIT2;
  50 +
  51 + EAP_RX_ACK_CONFIG();
  52 + EAP_RX_ACK_SET();
  53 +
  54 + EAP_TX_INT_CONFIG();
  55 +
  56 + UCA0CTL1 = UCSSEL_2 + UCSWRST;
  57 + UCA0MCTL = UCBRF_0 + UCBRS_6;
  58 + UCA0BR0 = 8;
  59 + UCA0CTL1 &= ~UCSWRST;
  60 +
  61 + IFG2 &= ~(UCA0RXIFG);
  62 + IE2 |= UCA0RXIE;
  63 +
  64 + TA1CCTL0 = CM_0 + CCIS_0 + OUTMOD_0 + CCIE;
  65 + TA1CCR0 = 1200;
  66 + TA1CTL = TASSEL_1 + ID_0 + MC_1;
  67 +
  68 + __enable_interrupt();
  69 +}
  70 +
  71 +/*
  72 + * ============ Serial Driver ============
  73 + */
  74 +
  75 +#include <Em_Message.h>
  76 +
  77 +__attribute__((interrupt(EAP_RX_VECTOR)))
  78 +static void rxHandler(void) {
  79 + uint8_t b = EAP_RX_BUF;
  80 + if (Em_Message_addByte(b)) {
  81 + Em_Message_dispatch();
  82 + }
  83 + EAP_RX_ACK_CLR();
  84 + EAP_RX_ACK_SET();
  85 +}
  86 +
  87 +__attribute__((interrupt(EAP_TX_VECTOR)))
  88 +static void txHandler(void) {
  89 + if (EAP_TX_INT_TST()) {
  90 + uint8_t b;
  91 + if (Em_Message_getByte(&b)) {
  92 + EAP_TX_BUF = b;
  93 + }
  94 + EAP_TX_INT_CLR();
  95 + }
  96 +}
  97 +
  98 +void Em_Message_startSend() {
  99 + uint8_t b;
  100 + if (Em_Message_getByte(&b)) {
  101 + UCA0TXBUF = b;
  102 + }
  103 +}
  104 +
  105 +uint8_t Em_Message_lock() {
  106 + uint8_t key;
  107 + asm ("MOV r2, %0": "=r" (key));
  108 + key &= 0x8;
  109 + asm ("DINT");
  110 + return key;
  111 +}
  112 +
  113 +void Em_Message_unlock(uint8_t key) {
  114 + if (key) {
  115 + asm ("EINT");
  116 + }
  117 + else {
  118 + asm ("DINT");
  119 + }
  120 +}
  121 +
  122 +/*
  123 + * ============ Application Program ============
  124 + */
  125 +
  126 +#include <Blinker.h>
  127 +
  128 +#define COUNT_DEFAULT 5
  129 +
  130 +volatile Blinker_cmd_t cmdRes = Blinker_STOP_CMD;
  131 +volatile Blinker_count_t countRes = COUNT_DEFAULT;
  132 +volatile Blinker_delay_t delayRes = Blinker_delay_min;
  133 +
  134 +volatile Blinker_count_t curCount;
  135 +volatile Blinker_delay_t curTime;
  136 +
  137 +__attribute__((interrupt(TIMER1_A0_VECTOR)))
  138 +void tickHandler(void) {
  139 + if (cmdRes == Blinker_STOP_CMD) {
  140 + return;
  141 + }
  142 + if (curTime < delayRes) {
  143 + curTime += Blinker_delay_step;
  144 + return;
  145 + }
  146 + else {
  147 + curTime = 0;
  148 + }
  149 + if (curCount-- > 0) {
  150 + LED_TOGGLE();
  151 + }
  152 + else {
  153 + cmdRes = Blinker_STOP_CMD;
  154 + LED_OFF();
  155 + }
  156 + Blinker_ledState_indicate();
  157 +}
  158 +
  159 +int main(int argc, char *argv[]) {
  160 + volatile int dummy = 0;
  161 + init();
  162 + Blinker_run();
  163 + while (dummy == 0) {
  164 + /* idle */
  165 + }
  166 + return 0;
  167 +}
  168 +
  169 +void Blinker_connectHandler(void) {
  170 + CONNECTED_LED_ON();
  171 +}
  172 +
  173 +void Blinker_disconnectHandler(void) {
  174 + CONNECTED_LED_OFF();
  175 +}
  176 +
  177 +void Blinker_cmd_store(Blinker_cmd_t* input) {
  178 + cmdRes = *input;
  179 + switch (cmdRes) {
  180 + case Blinker_START_CMD:
  181 + curCount = countRes * 2;
  182 + curTime = 0;
  183 + break;
  184 + case Blinker_STOP_CMD:
  185 + LED_OFF();
  186 + break;
  187 + }
  188 +}
  189 +
  190 +void Blinker_count_fetch(Blinker_count_t* output) {
  191 + *output = countRes;
  192 +}
  193 +
  194 +void Blinker_count_store(Blinker_count_t* input) {
  195 + countRes = *input;
  196 +}
  197 +
  198 +void Blinker_delay_fetch(Blinker_delay_t* output) {
  199 + *output = delayRes;
  200 +}
  201 +
  202 +void Blinker_delay_store(Blinker_delay_t* input) {
  203 + delayRes = *input;
  204 +}
  205 +
  206 +void Blinker_ledState_fetch(Blinker_ledState_t* output) {
  207 + *output = LED_READ() ? Blinker_LED_ON : Blinker_LED_OFF;
  208 +}
BlinkerLaunchPad/main.map 0 → 100644
  1 +++ a/BlinkerLaunchPad/main.map
  1 +Archive member included because of file (symbol)
  2 +
  3 +/Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o)
  4 + /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/crt0ivtbl16.o (_reset_vector__)
  5 +/Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  6 + /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o) (__watchdog_support)
  7 +/Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__init_stack.o)
  8 + /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o) (__init_stack)
  9 +/Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__low_level_init.o)
  10 + /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o) (__low_level_init)
  11 +/Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_copy_data.o)
  12 + /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o) (__do_copy_data)
  13 +/Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_clear_bss.o)
  14 + /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o) (__do_clear_bss)
  15 +/Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__stop_progExec__.o)
  16 + /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o) (__stop_progExec__)
  17 +/Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_endless_loop__.o)
  18 + /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o) (_endless_loop__)
  19 +/Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_unexpected_.o)
  20 + /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/crt0ivtbl16.o (_unexpected_)
  21 +
  22 +Allocating common symbols
  23 +Common symbol size file
  24 +
  25 +Em_App_recvIdx 0x1 Blinker.obj
  26 +Em_App_xmitSize 0x1 Blinker.obj
  27 +Em_App_outBuf 0x2 Blinker.obj
  28 +curTime 0x2 main.obj
  29 +Em_App_ind 0xa Blinker.obj
  30 +Em_App_xmitMask 0x4 Blinker.obj
  31 +Em_App_msg 0x1a Blinker.obj
  32 +Em_App_recvSize 0x1 Blinker.obj
  33 +Em_App_fileIndex 0x4 Blinker.obj
  34 +Em_App_pdHdlr 0x2 Blinker.obj
  35 +Em_App_xmitIdx 0x1 Blinker.obj
  36 +curCount 0x2 main.obj
  37 +
  38 +Memory Configuration
  39 +
  40 +Name Origin Length Attributes
  41 +sfr 0x0000000000000000 0x0000000000000010
  42 +peripheral_8bit 0x0000000000000010 0x00000000000000f0
  43 +peripheral_16bit 0x0000000000000100 0x0000000000000100
  44 +ram 0x0000000000000200 0x0000000000000200 xw
  45 +infomem 0x0000000000001000 0x0000000000000100
  46 +infod 0x0000000000001000 0x0000000000000040
  47 +infoc 0x0000000000001040 0x0000000000000040
  48 +infob 0x0000000000001080 0x0000000000000040
  49 +infoa 0x00000000000010c0 0x0000000000000040
  50 +rom 0x000000000000c000 0x0000000000003fe0 xr
  51 +vectors 0x000000000000ffe0 0x0000000000000020
  52 +bsl 0x0000000000000000 0x0000000000000000
  53 +far_rom 0x0000000000000000 0x0000000000000000
  54 +*default* 0x0000000000000000 0xffffffffffffffff
  55 +
  56 +Linker script and memory map
  57 +
  58 +LOAD /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/crt0ivtbl16.o
  59 +LOAD main.obj
  60 +LOAD Blinker.obj
  61 +LOAD /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libgcc.a
  62 +LOAD /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/../../../../msp430/lib/libc.a
  63 +LOAD /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libgcc.a
  64 +LOAD /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a
  65 + 0x0000000000000040 PROVIDE (__info_segment_size, 0x40)
  66 + 0x0000000000001000 PROVIDE (__infod, 0x1000)
  67 + 0x0000000000001040 PROVIDE (__infoc, 0x1040)
  68 + 0x0000000000001080 PROVIDE (__infob, 0x1080)
  69 + 0x00000000000010c0 PROVIDE (__infoa, 0x10c0)
  70 + 0x0000000000000000 __IE1 = 0x0
  71 + 0x0000000000000002 __IFG1 = 0x2
  72 + 0x0000000000000001 __IE2 = 0x1
  73 + 0x0000000000000003 __IFG2 = 0x3
  74 + 0x0000000000000048 __ADC10DTC0 = 0x48
  75 + 0x0000000000000049 __ADC10DTC1 = 0x49
  76 + 0x000000000000004a __ADC10AE0 = 0x4a
  77 + 0x00000000000001b0 __ADC10CTL0 = 0x1b0
  78 + 0x00000000000001b2 __ADC10CTL1 = 0x1b2
  79 + 0x00000000000001b4 __ADC10MEM = 0x1b4
  80 + 0x00000000000001bc __ADC10SA = 0x1bc
  81 + 0x0000000000000056 __DCOCTL = 0x56
  82 + 0x0000000000000057 __BCSCTL1 = 0x57
  83 + 0x0000000000000058 __BCSCTL2 = 0x58
  84 + 0x0000000000000053 __BCSCTL3 = 0x53
  85 + 0x0000000000000059 __CACTL1 = 0x59
  86 + 0x000000000000005a __CACTL2 = 0x5a
  87 + 0x000000000000005b __CAPD = 0x5b
  88 + 0x0000000000000128 __FCTL1 = 0x128
  89 + 0x000000000000012a __FCTL2 = 0x12a
  90 + 0x000000000000012c __FCTL3 = 0x12c
  91 + 0x0000000000000020 __P1IN = 0x20
  92 + 0x0000000000000021 __P1OUT = 0x21
  93 + 0x0000000000000022 __P1DIR = 0x22
  94 + 0x0000000000000023 __P1IFG = 0x23
  95 + 0x0000000000000024 __P1IES = 0x24
  96 + 0x0000000000000025 __P1IE = 0x25
  97 + 0x0000000000000026 __P1SEL = 0x26
  98 + 0x0000000000000041 __P1SEL2 = 0x41
  99 + 0x0000000000000027 __P1REN = 0x27
  100 + 0x0000000000000028 __P2IN = 0x28
  101 + 0x0000000000000029 __P2OUT = 0x29
  102 + 0x000000000000002a __P2DIR = 0x2a
  103 + 0x000000000000002b __P2IFG = 0x2b
  104 + 0x000000000000002c __P2IES = 0x2c
  105 + 0x000000000000002d __P2IE = 0x2d
  106 + 0x000000000000002e __P2SEL = 0x2e
  107 + 0x0000000000000042 __P2SEL2 = 0x42
  108 + 0x000000000000002f __P2REN = 0x2f
  109 + 0x0000000000000018 __P3IN = 0x18
  110 + 0x0000000000000019 __P3OUT = 0x19
  111 + 0x000000000000001a __P3DIR = 0x1a
  112 + 0x000000000000001b __P3SEL = 0x1b
  113 + 0x0000000000000043 __P3SEL2 = 0x43
  114 + 0x0000000000000010 __P3REN = 0x10
  115 + 0x000000000000012e __TA0IV = 0x12e
  116 + 0x0000000000000160 __TA0CTL = 0x160
  117 + 0x0000000000000162 __TA0CCTL0 = 0x162
  118 + 0x0000000000000164 __TA0CCTL1 = 0x164
  119 + 0x0000000000000166 __TA0CCTL2 = 0x166
  120 + 0x0000000000000170 __TA0R = 0x170
  121 + 0x0000000000000172 __TA0CCR0 = 0x172
  122 + 0x0000000000000174 __TA0CCR1 = 0x174
  123 + 0x0000000000000176 __TA0CCR2 = 0x176
  124 + 0x000000000000011e __TA1IV = 0x11e
  125 + 0x0000000000000180 __TA1CTL = 0x180
  126 + 0x0000000000000182 __TA1CCTL0 = 0x182
  127 + 0x0000000000000184 __TA1CCTL1 = 0x184
  128 + 0x0000000000000186 __TA1CCTL2 = 0x186
  129 + 0x0000000000000190 __TA1R = 0x190
  130 + 0x0000000000000192 __TA1CCR0 = 0x192
  131 + 0x0000000000000194 __TA1CCR1 = 0x194
  132 + 0x0000000000000196 __TA1CCR2 = 0x196
  133 + 0x0000000000000060 __UCA0CTL0 = 0x60
  134 + 0x0000000000000061 __UCA0CTL1 = 0x61
  135 + 0x0000000000000062 __UCA0BR0 = 0x62
  136 + 0x0000000000000063 __UCA0BR1 = 0x63
  137 + 0x0000000000000064 __UCA0MCTL = 0x64
  138 + 0x0000000000000065 __UCA0STAT = 0x65
  139 + 0x0000000000000066 __UCA0RXBUF = 0x66
  140 + 0x0000000000000067 __UCA0TXBUF = 0x67
  141 + 0x000000000000005d __UCA0ABCTL = 0x5d
  142 + 0x000000000000005e __UCA0IRTCTL = 0x5e
  143 + 0x000000000000005f __UCA0IRRCTL = 0x5f
  144 + 0x0000000000000068 __UCB0CTL0 = 0x68
  145 + 0x0000000000000069 __UCB0CTL1 = 0x69
  146 + 0x000000000000006a __UCB0BR0 = 0x6a
  147 + 0x000000000000006b __UCB0BR1 = 0x6b
  148 + 0x000000000000006c __UCB0I2CIE = 0x6c
  149 + 0x000000000000006d __UCB0STAT = 0x6d
  150 + 0x000000000000006e __UCB0RXBUF = 0x6e
  151 + 0x000000000000006f __UCB0TXBUF = 0x6f
  152 + 0x0000000000000118 __UCB0I2COA = 0x118
  153 + 0x000000000000011a __UCB0I2CSA = 0x11a
  154 + 0x0000000000000120 __WDTCTL = 0x120
  155 + 0x00000000000010f8 __CALDCO_16MHZ = 0x10f8
  156 + 0x00000000000010f9 __CALBC1_16MHZ = 0x10f9
  157 + 0x00000000000010fa __CALDCO_12MHZ = 0x10fa
  158 + 0x00000000000010fb __CALBC1_12MHZ = 0x10fb
  159 + 0x00000000000010fc __CALDCO_8MHZ = 0x10fc
  160 + 0x00000000000010fd __CALBC1_8MHZ = 0x10fd
  161 + 0x00000000000010fe __CALDCO_1MHZ = 0x10fe
  162 + 0x00000000000010ff __CALBC1_1MHZ = 0x10ff
  163 +
  164 +.hash
  165 + *(.hash)
  166 +
  167 +.dynsym
  168 + *(.dynsym)
  169 +
  170 +.dynstr
  171 + *(.dynstr)
  172 +
  173 +.gnu.version
  174 + *(.gnu.version)
  175 +
  176 +.gnu.version_d
  177 + *(.gnu.version_d)
  178 +
  179 +.gnu.version_r
  180 + *(.gnu.version_r)
  181 +
  182 +.rel.init
  183 + *(.rel.init)
  184 +
  185 +.rela.init
  186 + *(.rela.init)
  187 +
  188 +.rel.fini
  189 + *(.rel.fini)
  190 +
  191 +.rela.fini
  192 + *(.rela.fini)
  193 +
  194 +.rel.text
  195 + *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
  196 +
  197 +.rela.text
  198 + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
  199 +
  200 +.rel.rodata
  201 + *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
  202 +
  203 +.rela.rodata
  204 + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
  205 +
  206 +.rel.data
  207 + *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
  208 +
  209 +.rela.data
  210 + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
  211 +
  212 +.rel.bss
  213 + *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
  214 +
  215 +.rela.bss
  216 + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
  217 +
  218 +.rel.ctors
  219 + *(.rel.ctors)
  220 +
  221 +.rela.ctors
  222 + *(.rela.ctors)
  223 +
  224 +.rel.dtors
  225 + *(.rel.dtors)
  226 +
  227 +.rela.dtors
  228 + *(.rela.dtors)
  229 +
  230 +.rel.got
  231 + *(.rel.got)
  232 +
  233 +.rela.got
  234 + *(.rela.got)
  235 +
  236 +.rel.plt
  237 + *(.rel.plt)
  238 +
  239 +.rela.plt
  240 + *(.rela.plt)
  241 +
  242 +.text 0x000000000000c000 0x656
  243 + 0x000000000000c000 . = ALIGN (0x2)
  244 + *(.init .init.*)
  245 + *(.init0)
  246 + .init0 0x000000000000c000 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o)
  247 + 0x000000000000c000 _reset_vector__
  248 + *(.init1)
  249 + .init1 0x000000000000c000 0xc /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  250 + 0x000000000000c000 __watchdog_support
  251 + *(.init2)
  252 + .init2 0x000000000000c00c 0x4 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__init_stack.o)
  253 + 0x000000000000c00c __init_stack
  254 + *(.init3)
  255 + .init3 0x000000000000c010 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__low_level_init.o)
  256 + 0x000000000000c010 __low_level_init
  257 + *(.init4)
  258 + .init4 0x000000000000c010 0x18 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_copy_data.o)
  259 + 0x000000000000c010 __do_copy_data
  260 + .init4 0x000000000000c028 0x16 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_clear_bss.o)
  261 + 0x000000000000c028 __do_clear_bss
  262 + *(.init5)
  263 + *(.init6)
  264 + *(.init7)
  265 + *(.init8)
  266 + *(.init9)
  267 + .init9 0x000000000000c03e 0x18 main.obj
  268 + 0x000000000000c03e main
  269 + *(.fini9)
  270 + .fini9 0x000000000000c056 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__stop_progExec__.o)
  271 + 0x000000000000c056 __stop_progExec__
  272 + *(.fini8)
  273 + *(.fini7)
  274 + *(.fini6)
  275 + *(.fini5)
  276 + *(.fini4)
  277 + *(.fini3)
  278 + *(.fini2)
  279 + *(.fini1)
  280 + *(.fini0)
  281 + .fini0 0x000000000000c056 0x6 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_endless_loop__.o)
  282 + 0x000000000000c056 _endless_loop__
  283 + *(.fini .fini.*)
  284 + 0x000000000000c05c . = ALIGN (0x2)
  285 + 0x000000000000c05c __ctors_start = .
  286 + *(.ctors)
  287 + 0x000000000000c05c __ctors_end = .
  288 + 0x000000000000c05c __dtors_start = .
  289 + *(.dtors)
  290 + 0x000000000000c05c __dtors_end = .
  291 + 0x000000000000c05c . = ALIGN (0x2)
  292 + *(.text .text.* .gnu.linkonce.t.*)
  293 + .text 0x000000000000c05c 0x4 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/crt0ivtbl16.o
  294 + 0x000000000000c05c __isr_1
  295 + 0x000000000000c05c __isr_4
  296 + 0x000000000000c05c __isr_11
  297 + 0x000000000000c05c __isr_5
  298 + 0x000000000000c05c __isr_2
  299 + 0x000000000000c05c __isr_10
  300 + 0x000000000000c05c __isr_0
  301 + 0x000000000000c05c __isr_8
  302 + 0x000000000000c05c __isr_12
  303 + 0x000000000000c05c __isr_9
  304 + 0x000000000000c05c __isr_6
  305 + 0x000000000000c05c __isr_14
  306 + .text.crt0 0x000000000000c060 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/crt0ivtbl16.o
  307 + .text 0x000000000000c060 0x1f4 main.obj
  308 + 0x000000000000c060 init
  309 + 0x000000000000c104 __isr_7
  310 + 0x000000000000c130 __isr_3
  311 + 0x000000000000c162 Em_Message_startSend
  312 + 0x000000000000c176 Em_Message_lock
  313 + 0x000000000000c17e Em_Message_unlock
  314 + 0x000000000000c18a tickHandler
  315 + 0x000000000000c18a __isr_13
  316 + 0x000000000000c1ea Blinker_connectHandler
  317 + 0x000000000000c1f0 Blinker_disconnectHandler
  318 + 0x000000000000c1f8 Blinker_cmd_store
  319 + 0x000000000000c222 Blinker_count_fetch
  320 + 0x000000000000c22a Blinker_count_store
  321 + 0x000000000000c230 Blinker_delay_fetch
  322 + 0x000000000000c238 Blinker_delay_store
  323 + 0x000000000000c23e Blinker_ledState_fetch
  324 + .text 0x000000000000c254 0x400 Blinker.obj
  325 + 0x000000000000c254 Em_Message_addByte
  326 + 0x000000000000c29c Blinker_reset
  327 + 0x000000000000c2ca Blinker_run
  328 + 0x000000000000c2d0 Em_App_startIndSend
  329 + 0x000000000000c2ea Blinker_pairingOn
  330 + 0x000000000000c30c Blinker_pairingOff
  331 + 0x000000000000c316 Blinker_disconnect
  332 + 0x000000000000c338 Blinker_accept
  333 + 0x000000000000c356 Em_App_startResSend
  334 + 0x000000000000c370 Em_App_xmitReady
  335 + 0x000000000000c3c4 Em_App_sendResponse
  336 + 0x000000000000c3e8 Em_App_sysStoreDispatch
  337 + 0x000000000000c402 Em_App_sysFetchDispatch
  338 + 0x000000000000c482 Em_App_fetchDispatch
  339 + 0x000000000000c4c0 Em_App_storeDispatch
  340 + 0x000000000000c4f8 Em_Message_dispatch
  341 + 0x000000000000c556 Em_App_sendIndicator
  342 + 0x000000000000c586 Em_Message_getByte
  343 + 0x000000000000c63c Blinker_ledState_indicate
  344 + .text 0x000000000000c654 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o)
  345 + .text 0x000000000000c654 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  346 + .text 0x000000000000c654 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__init_stack.o)
  347 + .text 0x000000000000c654 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__low_level_init.o)
  348 + .text 0x000000000000c654 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_copy_data.o)
  349 + .text 0x000000000000c654 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_clear_bss.o)
  350 + .text 0x000000000000c654 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__stop_progExec__.o)
  351 + .text 0x000000000000c654 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_endless_loop__.o)
  352 + .text 0x000000000000c654 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_unexpected_.o)
  353 + .text.crt0 0x000000000000c654 0x2 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_unexpected_.o)
  354 + 0x000000000000c654 _unexpected_
  355 + 0x000000000000c656 . = ALIGN (0x2)
  356 +
  357 +.rodata 0x000000000000c656 0x32
  358 + 0x000000000000c656 . = ALIGN (0x2)
  359 + *(.rodata .rodata.* .gnu.linkonce.r.*)
  360 + .rodata 0x000000000000c656 0x32 Blinker.obj
  361 + 0x000000000000c66a Em_App_endian
  362 + 0x000000000000c66c Em_App_build
  363 + 0x000000000000c674 Em_App_hash
  364 + 0x000000000000c688 . = ALIGN (0x2)
  365 + 0x000000000000c688 _etext = .
  366 +
  367 +.data 0x0000000000000200 0xa load address 0x000000000000c688
  368 + 0x0000000000000200 . = ALIGN (0x2)
  369 + 0x0000000000000200 PROVIDE (__data_start, .)
  370 + *(.data .data.* .gnu.linkonce.d.*)
  371 + .data 0x0000000000000200 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/crt0ivtbl16.o
  372 + .data 0x0000000000000200 0x6 main.obj
  373 + 0x0000000000000200 delayRes
  374 + 0x0000000000000202 countRes
  375 + 0x0000000000000204 cmdRes
  376 + .data 0x0000000000000206 0x4 Blinker.obj
  377 + 0x0000000000000206 Em_App_inBuf
  378 + 0x0000000000000208 Em_App_readIdle
  379 + .data 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o)
  380 + .data 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  381 + .data 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__init_stack.o)
  382 + .data 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__low_level_init.o)
  383 + .data 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_copy_data.o)
  384 + .data 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_clear_bss.o)
  385 + .data 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__stop_progExec__.o)
  386 + .data 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_endless_loop__.o)
  387 + .data 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_unexpected_.o)
  388 + 0x000000000000020a . = ALIGN (0x2)
  389 + 0x000000000000020a _edata = .
  390 + 0x000000000000c688 PROVIDE (__data_load_start, LOADADDR (.data))
  391 + 0x000000000000000a PROVIDE (__data_size, SIZEOF (.data))
  392 +
  393 +.bss 0x000000000000020a 0x3e load address 0x000000000000c692
  394 + 0x000000000000020a PROVIDE (__bss_start, .)
  395 + *(.bss .bss.*)
  396 + .bss 0x000000000000020a 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/crt0ivtbl16.o
  397 + .bss 0x000000000000020a 0x0 main.obj
  398 + .bss 0x000000000000020a 0x4 Blinker.obj
  399 + 0x000000000000020a Em_App_moreData
  400 + 0x000000000000020c Em_App_state
  401 + .bss 0x000000000000020e 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_reset_vector__.o)
  402 + .bss 0x000000000000020e 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  403 + .bss 0x000000000000020e 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__init_stack.o)
  404 + .bss 0x000000000000020e 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__low_level_init.o)
  405 + .bss 0x000000000000020e 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_copy_data.o)
  406 + .bss 0x000000000000020e 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_clear_bss.o)
  407 + .bss 0x000000000000020e 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__stop_progExec__.o)
  408 + .bss 0x000000000000020e 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_endless_loop__.o)
  409 + .bss 0x000000000000020e 0x0 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_unexpected_.o)
  410 + *(COMMON)
  411 + COMMON 0x000000000000020e 0x4 main.obj
  412 + 0x000000000000020e curTime
  413 + 0x0000000000000210 curCount
  414 + COMMON 0x0000000000000212 0x35 Blinker.obj
  415 + 0x0000000000000212 Em_App_recvIdx
  416 + 0x0000000000000213 Em_App_xmitSize
  417 + 0x0000000000000214 Em_App_outBuf
  418 + 0x0000000000000216 Em_App_ind
  419 + 0x0000000000000220 Em_App_xmitMask
  420 + 0x0000000000000224 Em_App_msg
  421 + 0x000000000000023e Em_App_recvSize
  422 + 0x0000000000000240 Em_App_fileIndex
  423 + 0x0000000000000244 Em_App_pdHdlr
  424 + 0x0000000000000246 Em_App_xmitIdx
  425 + 0x0000000000000248 . = ALIGN (0x2)
  426 + *fill* 0x0000000000000247 0x1 00
  427 + 0x0000000000000248 PROVIDE (__bss_end, .)
  428 + 0x000000000000003e PROVIDE (__bss_size, SIZEOF (.bss))
  429 +
  430 +.noinit 0x0000000000000248 0x2 load address 0x000000000000c692
  431 + 0x0000000000000248 PROVIDE (__noinit_start, .)
  432 + *(.noinit .noinit.*)
  433 + .noinit.crt0 0x0000000000000248 0x2 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  434 + 0x0000000000000248 __wdt_clear_value
  435 + 0x000000000000024a . = ALIGN (0x2)
  436 + 0x000000000000024a PROVIDE (__noinit_end, .)
  437 + 0x000000000000024a . = ALIGN (0x2)
  438 + 0x000000000000024a _end = .
  439 +
  440 +.infomem 0x0000000000001000 0x0
  441 + *(.infomem)
  442 + 0x0000000000001000 . = ALIGN (0x2)
  443 + *(.infomem.*)
  444 +
  445 +.infomemnobits 0x0000000000001000 0x0
  446 + *(.infomemnobits)
  447 + 0x0000000000001000 . = ALIGN (0x2)
  448 + *(.infomemnobits.*)
  449 +
  450 +.infoa
  451 + *(.infoa .infoa.*)
  452 +
  453 +.infob
  454 + *(.infob .infob.*)
  455 +
  456 +.infoc
  457 + *(.infoc .infoc.*)
  458 +
  459 +.infod
  460 + *(.infod .infod.*)
  461 +
  462 +.vectors 0x000000000000ffe0 0x20
  463 + 0x000000000000ffe0 PROVIDE (__vectors_start, .)
  464 + *(.vectors*)
  465 + .vectors 0x000000000000ffe0 0x20 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/crt0ivtbl16.o
  466 + 0x000000000000ffe0 __ivtbl_16
  467 + 0x0000000000010000 _vectors_end = .
  468 +
  469 +.fartext 0x0000000000000000 0x0
  470 + 0x0000000000000000 . = ALIGN (0x2)
  471 + *(.fartext)
  472 + 0x0000000000000000 . = ALIGN (0x2)
  473 + *(.fartext.*)
  474 + 0x0000000000000000 _efartext = .
  475 +
  476 +.profiler
  477 + *(.profiler)
  478 +
  479 +.stab
  480 + *(.stab)
  481 +
  482 +.stabstr
  483 + *(.stabstr)
  484 +
  485 +.stab.excl
  486 + *(.stab.excl)
  487 +
  488 +.stab.exclstr
  489 + *(.stab.exclstr)
  490 +
  491 +.stab.index
  492 + *(.stab.index)
  493 +
  494 +.stab.indexstr
  495 + *(.stab.indexstr)
  496 +
  497 +.comment
  498 + *(.comment)
  499 +
  500 +.debug
  501 + *(.debug)
  502 +
  503 +.line
  504 + *(.line)
  505 +
  506 +.debug_srcinfo
  507 + *(.debug_srcinfo)
  508 +
  509 +.debug_sfnames
  510 + *(.debug_sfnames)
  511 +
  512 +.debug_aranges 0x0000000000000000 0xa4
  513 + *(.debug_aranges)
  514 + .debug_aranges
  515 + 0x0000000000000000 0x18 main.obj
  516 + .debug_aranges
  517 + 0x0000000000000018 0x14 Blinker.obj
  518 + .debug_aranges
  519 + 0x000000000000002c 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  520 + .debug_aranges
  521 + 0x0000000000000040 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__init_stack.o)
  522 + .debug_aranges
  523 + 0x0000000000000054 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_copy_data.o)
  524 + .debug_aranges
  525 + 0x0000000000000068 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_clear_bss.o)
  526 + .debug_aranges
  527 + 0x000000000000007c 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_endless_loop__.o)
  528 + .debug_aranges
  529 + 0x0000000000000090 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_unexpected_.o)
  530 +
  531 +.debug_pubnames
  532 + *(.debug_pubnames)
  533 +
  534 +.debug_info 0x0000000000000000 0x11f6
  535 + *(.debug_info)
  536 + .debug_info 0x0000000000000000 0x74e main.obj
  537 + .debug_info 0x000000000000074e 0x74e Blinker.obj
  538 + .debug_info 0x0000000000000e9c 0x8f /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  539 + .debug_info 0x0000000000000f2b 0x8f /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__init_stack.o)
  540 + .debug_info 0x0000000000000fba 0x8f /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_copy_data.o)
  541 + .debug_info 0x0000000000001049 0x8f /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_clear_bss.o)
  542 + .debug_info 0x00000000000010d8 0x8f /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_endless_loop__.o)
  543 + .debug_info 0x0000000000001167 0x8f /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_unexpected_.o)
  544 + *(.gnu.linkonce.wi.*)
  545 +
  546 +.debug_abbrev 0x0000000000000000 0x456
  547 + *(.debug_abbrev)
  548 + .debug_abbrev 0x0000000000000000 0x1b0 main.obj
  549 + .debug_abbrev 0x00000000000001b0 0x22e Blinker.obj
  550 + .debug_abbrev 0x00000000000003de 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  551 + .debug_abbrev 0x00000000000003f2 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__init_stack.o)
  552 + .debug_abbrev 0x0000000000000406 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_copy_data.o)
  553 + .debug_abbrev 0x000000000000041a 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_clear_bss.o)
  554 + .debug_abbrev 0x000000000000042e 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_endless_loop__.o)
  555 + .debug_abbrev 0x0000000000000442 0x14 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_unexpected_.o)
  556 +
  557 +.debug_line 0x0000000000000000 0x61e
  558 + *(.debug_line)
  559 + .debug_line 0x0000000000000000 0x16a main.obj
  560 + .debug_line 0x000000000000016a 0x205 Blinker.obj
  561 + .debug_line 0x000000000000036f 0x72 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__watchdog_support.o)
  562 + .debug_line 0x00000000000003e1 0x70 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(__init_stack.o)
  563 + .debug_line 0x0000000000000451 0x76 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_copy_data.o)
  564 + .debug_line 0x00000000000004c7 0x76 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_clear_bss.o)
  565 + .debug_line 0x000000000000053d 0x71 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_endless_loop__.o)
  566 + .debug_line 0x00000000000005ae 0x70 /Applications/Development/eclipse/msptools/bin/../lib/gcc/msp430/4.6.1/libcrt0.a(_unexpected_.o)
  567 +
  568 +.debug_frame 0x0000000000000000 0x22e
  569 + *(.debug_frame)
  570 + .debug_frame 0x0000000000000000 0x11a main.obj
  571 + .debug_frame 0x000000000000011a 0x114 Blinker.obj
  572 +
  573 +.debug_str 0x0000000000000000 0x6c6
  574 + *(.debug_str)
  575 + .debug_str 0x0000000000000000 0x32a main.obj
  576 + 0x42a (size before relaxing)
  577 + .debug_str 0x000000000000032a 0x39c Blinker.obj
  578 + 0x49b (size before relaxing)
  579 +
  580 +.debug_loc 0x0000000000000000 0x381
  581 + *(.debug_loc)
  582 + .debug_loc 0x0000000000000000 0xf6 main.obj
  583 + .debug_loc 0x00000000000000f6 0x28b Blinker.obj
  584 +
  585 +.debug_macinfo
  586 + *(.debug_macinfo)
  587 +
  588 +.debug_pubtypes
  589 + *(.debug_pubtypes)
  590 +
  591 +.debug_ranges 0x0000000000000000 0xc
  592 + *(.debug_ranges)
  593 + .debug_ranges 0x0000000000000000 0xc main.obj
  594 + 0x0000000000000400 PROVIDE (__stack, (ORIGIN (ram) + 0x200))
  595 + 0x000000000000c688 PROVIDE (__data_start_rom, _etext)
  596 + 0x000000000000c692 PROVIDE (__data_end_rom, (_etext + SIZEOF (.data)))
  597 +OUTPUT(main.out elf32-msp430)
BlinkerLaunchPad/main.obj 0 → 100644
No preview for this file type
BlinkerLaunchPad/main.out 0 → 100755
No preview for this file type
BlinkerLaunchPad/makefile 0 → 100644
  1 +++ a/BlinkerLaunchPad/makefile
  1 +EMSNAME = Blinker
  2 +
  3 +COMMON = ../../../Common/Embedded/LaunchPad
  4 +SCHEMA = ../../Schema
  5 +
  6 +OBJECTS = main.obj $(EMSNAME).obj
  7 +
  8 +include $(COMMON)/rules.mk
BlinkerSchema/.gitignore 0 → 100644
  1 +++ a/BlinkerSchema/.gitignore
  1 +/imports
BlinkerSchema/.project 0 → 100644
  1 +++ a/BlinkerSchema/.project
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>BlinkerSchema</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>com.emmoco.mcmtooling.core.mcmToolingBuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + </buildSpec>
  14 + <natures>
  15 + <nature>com.emmoco.mcmtooling.core.mcmToolingNature</nature>
  16 + </natures>
  17 +</projectDescription>
BlinkerSchema/bundle.properties 0 → 100644
  1 +++ a/BlinkerSchema/bundle.properties
  1 +# generated file - do not edit
  2 +
  3 +bundle.requires = com.emmoco.schema.translator
  4 +com.emmoco.framework.Properties.applicationDirectory = out
  5 +com.emmoco.framework.Properties.schemaDestinationDirectory = out
  6 +com.emmoco.framework.Properties.serverAPIToken =
  7 +com.emmoco.framework.Properties.align16 = 2
  8 +com.emmoco.framework.Properties.align32 = 4
  9 +com.emmoco.framework.Properties.schemaFile = /Users/imanol/devel/emmoco/BlinkerSchema/schema.ems
  10 +com.emmoco.framework.Properties.toolVersion = 12.0.0.201211010336
BlinkerSchema/imports/system@emmoco.com/System.ems 0 → 100644
  1 +++ a/BlinkerSchema/imports/system@emmoco.com/System.ems
  1 +owner = "system@emmoco.com"
  2 +
  3 +schema System {
  4 +
  5 + // protocolLevel #1
  6 +
  7 + uint8 $schemaUuid[16] { // protocolLevel #10 -- invisible to applications
  8 + readonly
  9 + }
  10 +
  11 + uint16 $mcmProtocolLevel {
  12 + readonly
  13 + }
  14 +
  15 + uint16 $eapProtocolLevel {
  16 + readonly
  17 + }
  18 +
  19 + uint8 $eapBuildDate[8] { // protocolLevel #5 -- rename from $eapBuildNumber
  20 + readonly
  21 + }
  22 +
  23 + // protocolLevel #2
  24 +
  25 + int16 $fileIndexReset {
  26 + writeonly
  27 + }
  28 +
  29 + // protocolLevel #5
  30 +
  31 + // protocolLevel #12 -- increase size to 20
  32 +
  33 + uint8 $schemaHash[20] {
  34 + readonly
  35 + }
  36 +
  37 + // protocolLevel #7
  38 +
  39 + struct ResourceCount {
  40 + uint8 app
  41 + uint8 sys
  42 + }
  43 +
  44 + ResourceCount $resourceCount {
  45 + readonly
  46 + }
  47 +
  48 + // protocolLevel #9
  49 +
  50 + int8 $mobileRssi {
  51 + readonly
  52 + }
  53 +
  54 + // protocolLevel #11
  55 +
  56 + uint8 $mcmDisconnect {
  57 + writeonly
  58 + }
  59 +
  60 +}
BlinkerSchema/out/Blinker-TODO.c 0 → 100644
  1 +++ a/BlinkerSchema/out/Blinker-TODO.c
  1 +/**** DO NOT EDIT -- this file has been automatically generated from @emmoco.com.Blinker on 2014-05-09T14:33:35T ****/
  2 +/**** protocolLevel = 12, toolsVersion = 12.0.0.201211010336 ****/
  3 +
  4 +#include "Blinker.h"
  5 +
  6 +#ifdef Em_Blinker_TODO /* enables optional inclusion of empty functions */
  7 +
  8 +/* Copy the function skeletons below into your own Blinker.c source file */
  9 +
  10 +void Blinker_connectHandler(void) {
  11 + /* TODO: application is now connected */
  12 +}
  13 +
  14 +void Blinker_disconnectHandler(void) {
  15 + /* TODO: application is now disconnected */
  16 +}
  17 +
  18 +void Blinker_cmd_store(Blinker_cmd_t* const input) {
  19 + /* TODO: read resource 'cmd' from 'input' */
  20 +}
  21 +
  22 +void Blinker_count_fetch(Blinker_count_t* const output) {
  23 + /* TODO: write resource 'count' into 'output' */
  24 +}
  25 +
  26 +void Blinker_count_store(Blinker_count_t* const input) {
  27 + /* TODO: read resource 'count' from 'input' */
  28 +}
  29 +
  30 +void Blinker_delay_fetch(Blinker_delay_t* const output) {
  31 + /* TODO: write resource 'delay' into 'output' */
  32 +}
  33 +
  34 +void Blinker_delay_store(Blinker_delay_t* const input) {
  35 + /* TODO: read resource 'delay' from 'input' */
  36 +}
  37 +
  38 +void Blinker_ledState_fetch(Blinker_ledState_t* const output) {
  39 + /* TODO: write resource 'ledState' into 'output' */
  40 +}
  41 +
  42 +#endif /* dummy file */
BlinkerSchema/out/Blinker.c 0 → 100644
  1 +++ a/BlinkerSchema/out/Blinker.c
  1 +/**** DO NOT EDIT -- this file has been automatically generated from @emmoco.com.Blinker on 2014-05-09T14:33:35T ****/
  2 +/**** protocolLevel = 12, toolsVersion = 12.0.0.201211010336 ****/
  3 +
  4 +#include "Em_Message.h"
  5 +#include "Blinker.h"
  6 +
  7 +#ifdef __cplusplus
  8 +extern "C" {
  9 +#endif
  10 +
  11 +#define Em_Message_protocolLevel 12
  12 +
  13 +typedef struct Em_App_Message {
  14 + uint8_t dummy;
  15 + uint8_t sot;
  16 + Em_Message_Header hdr;
  17 + uint8_t data[20];
  18 +} Em_App_Message;
  19 +
  20 +const uint8_t Em_App_hash[] = {194, 8, 191, 173, 237, 198, 193, 165, 88, 202, 74, 246, 70, 59, 102, 128, 12, 0, ((sizeof(struct{uint8_t f1; uint16_t f2;}) - sizeof(uint16_t)) << 4) | (sizeof(struct{uint8_t f1; uint32_t f2;}) - sizeof(uint32_t))};
  21 +
  22 +const uint8_t Em_App_build[] = {20, 116, 249, 224, 69, 1, 0, 0};
  23 +
  24 +#define Em_App_APP_RESOURCE_COUNT 4
  25 +#define Em_App_SYS_RESOURCE_COUNT 8
  26 +
  27 +#define Em_App_ACCEPT Blinker_accept
  28 +#define Em_App_DISCONNECT Blinker_disconnect
  29 +#define Em_App_PAIRINGON Blinker_pairingOn
  30 +#define Em_App_PAIRINGOFF Blinker_pairingOff
  31 +#define Em_App_RESET Blinker_reset
  32 +#define Em_App_RUN Blinker_run
  33 +
  34 +#define Em_App_CONNECTHANDLER Blinker_connectHandler
  35 +#define Em_App_DISCONNECTHANDLER Blinker_disconnectHandler
  36 +
  37 +#define Em_App_MAX_INDICATOR 2
  38 +
  39 +enum {Em_App_IDLE, Em_App_DISCONNECTED, Em_App_CONNECTED};
  40 +
  41 +typedef struct Em_App_Indicator {
  42 + uint8_t dummy;
  43 + uint8_t sot;
  44 + Em_Message_Header hdr;
  45 + uint8_t data[Em_Message_INDSIZE];
  46 +} Em_App_Indicator;
  47 +
  48 +void (*Em_App_pdHdlr)(void);
  49 +
  50 +const uint16_t Em_App_endian = 0x0100;
  51 +
  52 +Em_Message_Size Em_App_recvIdx;
  53 +Em_Message_Size Em_App_recvSize;
  54 +Em_Message_Size Em_App_xmitIdx;
  55 +Em_Message_Size Em_App_xmitSize;
  56 +
  57 +uint8_t Em_App_state = Em_App_IDLE;
  58 +Em_App_Message Em_App_msg;
  59 +Em_App_Indicator Em_App_ind;
  60 +bool Em_App_moreData = false;
  61 +bool Em_App_readIdle = true;
  62 +int32_t Em_App_fileIndex;
  63 +uint32_t Em_App_xmitMask;
  64 +
  65 +uint8_t* Em_App_inBuf = (uint8_t*)&Em_App_msg.hdr;
  66 +uint8_t* Em_App_outBuf;
  67 +
  68 +void Em_App_fetchDispatch(void);
  69 +void Em_App_storeDispatch(void);
  70 +void Em_App_sendIndicator(Em_Message_ResId indId);
  71 +void Em_App_sendResponse(Em_Message_Kind kind, Em_Message_Size size);
  72 +void Em_App_startIndSend(void);
  73 +void Em_App_startResSend(void);
  74 +void Em_App_sysFetchDispatch(void);
  75 +void Em_App_sysStoreDispatch(void);
  76 +bool Em_App_xmitReady(Em_Message_ResId indId);
  77 +
  78 +bool Em_Message_addByte(uint8_t b) {
  79 + if (Em_App_readIdle && b) {
  80 + Em_App_recvSize = Em_App_inBuf[0] = b;
  81 + Em_App_recvIdx = 1;
  82 + Em_App_readIdle = false;
  83 + return false;
  84 + }
  85 + Em_App_inBuf[Em_App_recvIdx++] = b;
  86 + if (Em_App_recvIdx < Em_App_recvSize) {
  87 + return false;
  88 + }
  89 + Em_App_readIdle = true;
  90 + return true;
  91 +}
  92 +
  93 +bool Em_Message_getByte(uint8_t* bp) {
  94 + uint8_t key = Em_Message_lock();
  95 + Em_App_moreData = (Em_App_xmitSize != 0);
  96 + if (!Em_App_moreData && (Em_App_xmitMask != 0)) {
  97 + uint8_t i;
  98 + uint32_t m;
  99 + for (i = 0, m = 0x1; i < Em_App_MAX_INDICATOR; i++, m <<= 1) {
  100 + if (Em_App_xmitMask & m) {
  101 + Em_App_xmitMask &= ~m;
  102 + if (i == 0) {
  103 + Em_App_startResSend();
  104 + }
  105 + else {
  106 + Em_App_sendIndicator(i);
  107 + }
  108 + break;
  109 + }
  110 + }
  111 + Em_Message_unlock(key);
  112 + return false;
  113 + }
  114 + else if (Em_App_moreData) {
  115 + *bp = Em_App_outBuf[Em_App_xmitIdx++];
  116 + Em_App_xmitSize -= 1;
  117 + }
  118 + Em_Message_unlock(key);
  119 + return Em_App_moreData;
  120 +}
  121 +
  122 +void Em_App_ACCEPT(bool enable) {
  123 + if (Em_App_state == Em_App_CONNECTED) {
  124 + return;
  125 + }
  126 + Em_App_ind.sot = 0;
  127 + Em_App_ind.hdr.kind = Em_Message_ACCEPT;
  128 + Em_App_ind.hdr.size = sizeof (Em_Message_Header);
  129 + Em_App_ind.hdr.resId = enable;
  130 + Em_App_startIndSend();
  131 +}
  132 +
  133 +void Em_App_DISCONNECT(void) {
  134 + if (Em_App_state != Em_App_CONNECTED) {
  135 + return;
  136 + }
  137 + Em_App_state = Em_App_DISCONNECTED;
  138 + Em_App_ind.sot = 0;
  139 + Em_App_ind.hdr.kind = Em_Message_DISCONNECT;
  140 + Em_App_ind.hdr.size = sizeof (Em_Message_Header);
  141 + Em_App_ind.hdr.resId = 0;
  142 + Em_App_startIndSend();
  143 +}
  144 +
  145 +void Em_Message_dispatch(void) {
  146 + if (Em_App_state == Em_App_IDLE) {
  147 + return;
  148 + }
  149 + switch (Em_App_msg.hdr.kind) {
  150 + case Em_Message_CONNECT:
  151 + Em_App_state = Em_App_CONNECTED;
  152 + Em_App_CONNECTHANDLER();
  153 + break;
  154 + case Em_Message_DISCONNECT:
  155 + Em_App_state = Em_App_DISCONNECTED;
  156 + Em_App_DISCONNECTHANDLER();
  157 + break;
  158 + case Em_Message_PAIRING_DONE:
  159 + if (Em_App_pdHdlr) {
  160 + (*Em_App_pdHdlr)();
  161 + }
  162 + break;
  163 + case Em_Message_FETCH:
  164 + if (Em_App_msg.hdr.resId > 0) {
  165 + Em_App_fetchDispatch();
  166 + }
  167 + else {
  168 + Em_App_sysFetchDispatch();
  169 + }
  170 + break;
  171 + case Em_Message_STORE:
  172 + if (Em_App_msg.hdr.resId > 0) {
  173 + Em_App_storeDispatch();
  174 + }
  175 + else {
  176 + Em_App_sysStoreDispatch();
  177 + }
  178 + break;
  179 + }
  180 +}
  181 +
  182 +void Em_App_PAIRINGOFF(void(*handler)(void)) {
  183 + Em_App_PAIRINGON(0, handler);
  184 +}
  185 +
  186 +void Em_App_PAIRINGON(uint8_t secs, void(*handler)(void)) {
  187 + if (Em_App_state != Em_App_DISCONNECTED) {
  188 + return;
  189 + }
  190 + Em_App_pdHdlr = handler;
  191 + Em_App_ind.sot = 0;
  192 + Em_App_ind.hdr.kind = Em_Message_PAIRING;
  193 + Em_App_ind.hdr.size = sizeof (Em_Message_Header);
  194 + Em_App_ind.hdr.resId = secs;
  195 + Em_App_startIndSend();
  196 +}
  197 +
  198 +void Em_App_RESET(void) {
  199 + Em_App_recvIdx = Em_App_recvSize = Em_App_xmitIdx = Em_App_xmitSize = 0;
  200 + Em_App_state = Em_App_IDLE;
  201 + Em_App_moreData = false;
  202 + Em_App_readIdle = true;
  203 + Em_App_fileIndex = 0;
  204 + Em_App_xmitMask = 0;
  205 +}
  206 +
  207 +void Em_App_RUN(void) {
  208 + Em_App_state = Em_App_DISCONNECTED;
  209 +}
  210 +
  211 +void Em_App_sendResponse(Em_Message_Kind kind, Em_Message_Size size) {
  212 + if (Em_App_state != Em_App_CONNECTED) {
  213 + return;
  214 + }
  215 + Em_App_msg.sot = 0;
  216 + Em_App_msg.hdr.kind = kind;
  217 + Em_App_msg.hdr.size = size + sizeof (Em_Message_Header);
  218 + if (Em_App_xmitReady(0)) {
  219 + Em_App_startResSend();
  220 + }
  221 +}
  222 +
  223 +void Em_App_startIndSend(void) {
  224 + Em_App_outBuf = (uint8_t*)&Em_App_ind.sot;
  225 + Em_App_xmitSize = Em_App_ind.hdr.size + 1;
  226 + Em_App_xmitIdx = 0;
  227 + Em_Message_startSend();
  228 +}
  229 +
  230 +void Em_App_startResSend(void) {
  231 + Em_App_outBuf = (uint8_t*)&Em_App_msg.sot;
  232 + Em_App_xmitSize = Em_App_msg.hdr.size + 1;
  233 + Em_App_xmitIdx = 0;
  234 + Em_Message_startSend();
  235 +}
  236 +
  237 +void Em_App_sysFetchDispatch(void) {
  238 + uint8_t size = 0;
  239 + int i;
  240 + switch (Em_App_msg.hdr.resId) {
  241 + case Em_Message_SYS_SCHEMA_HASH:
  242 + for (i = 0; i < sizeof (Em_App_hash); i++) {
  243 + Em_App_msg.data[i] = Em_App_hash[i];
  244 + }
  245 + Em_App_msg.data[sizeof (Em_App_hash)] = *((uint8_t*)&Em_App_endian);
  246 + size = sizeof (Em_App_hash) + 1;
  247 + break;
  248 + case Em_Message_SYS_EAP_PROTOCOL_LEVEL:
  249 + *((Em_Message_protocolLevel_t*)Em_App_msg.data) = Em_Message_protocolLevel;
  250 + size = sizeof (Em_Message_protocolLevel_t);
  251 + break;
  252 + case Em_Message_SYS_EAP_BUILD_DATE:
  253 + for (i = 0; i < sizeof (Em_App_build); i++) {
  254 + Em_App_msg.data[i] = Em_App_build[i];
  255 + }
  256 + size = sizeof (Em_App_build);
  257 + break;
  258 + case Em_Message_SYS_RESOURCE_COUNT:
  259 + Em_App_msg.data[0] = Em_App_APP_RESOURCE_COUNT;
  260 + Em_App_msg.data[1] = Em_App_SYS_RESOURCE_COUNT;
  261 + size = 2;
  262 + break;
  263 + }
  264 + Em_App_sendResponse(Em_Message_FETCH_DONE, size);
  265 +}
  266 +
  267 +void Em_App_sysStoreDispatch(void) {
  268 + switch (Em_App_msg.hdr.resId) {
  269 + case Em_Message_SYS_FILE_INDEX_RESET:
  270 + Em_App_fileIndex = 0;
  271 + break;
  272 + }
  273 + Em_App_sendResponse(Em_Message_STORE_DONE, 0);
  274 +}
  275 +
  276 +bool Em_App_xmitReady(Em_Message_ResId indId) {
  277 + uint8_t key = Em_Message_lock();
  278 + bool res = !Em_App_moreData && Em_App_xmitMask == 0;
  279 + if (!res) {
  280 + Em_App_xmitMask |= (1 << indId);
  281 + }
  282 + Em_Message_unlock(key);
  283 + return res;
  284 +}
  285 +
  286 +void Em_App_fetchDispatch(void) {
  287 + uint8_t size = 0;
  288 + switch (Em_App_msg.hdr.resId) {
  289 + case 0:
  290 + break;
  291 + case 2:
  292 + Blinker_count_fetch((Blinker_count_t*)Em_App_msg.data);
  293 + size = 2;
  294 + break;
  295 + case 3:
  296 + Blinker_delay_fetch((Blinker_delay_t*)Em_App_msg.data);
  297 + size = 2;
  298 + break;
  299 + case 4:
  300 + Blinker_ledState_fetch((Blinker_ledState_t*)Em_App_msg.data);
  301 + size = 1;
  302 + break;
  303 + }
  304 + Em_App_sendResponse(Em_Message_FETCH_DONE, size);
  305 +}
  306 +
  307 +void Em_App_storeDispatch(void) {
  308 + switch (Em_App_msg.hdr.resId) {
  309 + case 0:
  310 + break;
  311 + case 1:
  312 + Blinker_cmd_store((Blinker_cmd_t*)Em_App_msg.data);
  313 + break;
  314 + case 2:
  315 + Blinker_count_store((Blinker_count_t*)Em_App_msg.data);
  316 + break;
  317 + case 3:
  318 + Blinker_delay_store((Blinker_delay_t*)Em_App_msg.data);
  319 + break;
  320 + }
  321 + Em_App_sendResponse(Em_Message_STORE_DONE, 0);
  322 +}
  323 +
  324 +void Em_App_sendIndicator(Em_Message_ResId indId) {
  325 + Em_Message_Size resId = 0;
  326 + Em_Message_Size size = 0;
  327 + switch (indId) {
  328 + case 1:
  329 + Blinker_ledState_fetch((Blinker_ledState_t*)&Em_App_ind.data);
  330 + resId = 4;
  331 + size = 1;
  332 + break;
  333 +}
  334 + Em_App_ind.sot = 0;
  335 + Em_App_ind.hdr.kind = Em_Message_INDICATOR;
  336 + Em_App_ind.hdr.size = sizeof (Em_Message_Header) + size;
  337 + Em_App_ind.hdr.resId = resId;
  338 + Em_App_startIndSend();
  339 +}
  340 +
  341 +void Blinker_ledState_indicate(void) {
  342 + if (Em_App_state != Em_App_IDLE && Em_App_xmitReady(1)) Em_App_sendIndicator(1);
  343 +}
  344 +
  345 +#ifdef __cplusplus
  346 +}
  347 +#endif
  348 +
BlinkerSchema/out/Blinker.h 0 → 100644
  1 +++ a/BlinkerSchema/out/Blinker.h
  1 +/**** DO NOT EDIT -- this file has been automatically generated from @emmoco.com.Blinker on 2014-05-09T14:33:35T ****/
  2 +/**** protocolLevel = 12, toolsVersion = 12.0.0.201211010336 ****/
  3 +
  4 +#ifndef Blinker__H
  5 +#define Blinker__H
  6 +
  7 +#include "Em_Types.h"
  8 +#include "Em_Message.h"
  9 +
  10 +#ifdef __cplusplus
  11 +extern "C" {
  12 +#endif
  13 +
  14 +/* enum Cmd */
  15 +typedef uint8_t Blinker_Cmd;
  16 +#define Blinker_START_CMD 0
  17 +#define Blinker_STOP_CMD 1
  18 +
  19 +/* enum LedState */
  20 +typedef uint8_t Blinker_LedState;
  21 +#define Blinker_LED_OFF 0
  22 +#define Blinker_LED_ON 1
  23 +
  24 +/* resource cmd */
  25 +typedef Blinker_Cmd Blinker_cmd_t;
  26 +extern void Blinker_cmd_store(Blinker_cmd_t* const input);
  27 +
  28 +/* resource count */
  29 +typedef int16_t Blinker_count_t;
  30 +extern void Blinker_count_fetch(Blinker_count_t* const output);
  31 +extern void Blinker_count_store(Blinker_count_t* const input);
  32 +
  33 +/* resource delay */
  34 +typedef uint16_t Blinker_delay_t;
  35 +#define Blinker_delay_min 500
  36 +#define Blinker_delay_max 2000
  37 +#define Blinker_delay_step 100
  38 +extern void Blinker_delay_fetch(Blinker_delay_t* const output);
  39 +extern void Blinker_delay_store(Blinker_delay_t* const input);
  40 +
  41 +/* resource ledState */
  42 +typedef Blinker_LedState Blinker_ledState_t;
  43 +extern void Blinker_ledState_fetch(Blinker_ledState_t* const output);
  44 +extern void Blinker_ledState_indicate(void);
  45 +
  46 +void Blinker_reset(void);
  47 +void Blinker_run(void);
  48 +
  49 +void Blinker_accept(bool enable);
  50 +void Blinker_disconnect(void);
  51 +void Blinker_pairingOn(uint8_t secs, void(*handler)(void));
  52 +void Blinker_pairingOff(void(*handler)(void));
  53 +
  54 +void Blinker_connectHandler(void);
  55 +void Blinker_disconnectHandler(void);
  56 +
  57 +#ifdef __cplusplus
  58 +}
  59 +#endif
  60 +
  61 +#endif /* Blinker__H */
BlinkerSchema/out/Blinker.zip 0 → 100644
No preview for this file type
BlinkerSchema/out/Em_Message.h 0 → 100644
  1 +++ a/BlinkerSchema/out/Em_Message.h
  1 +#ifndef Em_Message_H_
  2 +#define Em_Message_H_
  3 +
  4 +#include "Em_Types.h"
  5 +
  6 +#ifdef __cplusplus
  7 +extern "C" {
  8 +#endif
  9 +
  10 +/* protocolLevel #4 */
  11 +#define Em_Message_INDSIZE 4
  12 +
  13 +typedef uint8_t Em_Message_Size;
  14 +typedef uint8_t Em_Message_Kind;
  15 +/* protocolLevel #12 -- split 16-bit resId into <resId, chan> */
  16 +typedef int8_t Em_Message_ResId;
  17 +typedef uint8_t Em_Message_Chan;
  18 +
  19 +#define Em_Message_NOP 0
  20 +#define Em_Message_FETCH 1
  21 +#define Em_Message_FETCH_DONE 2
  22 +#define Em_Message_STORE 3
  23 +#define Em_Message_STORE_DONE 4
  24 +#define Em_Message_INDICATOR 5
  25 +#define Em_Message_CONNECT 6
  26 +#define Em_Message_DISCONNECT 7
  27 +#define Em_Message_ECHO 8
  28 +/* protocolLevel #3 */
  29 +/* protocolLevel #6 -- rename from BROADCAST to PAIRING */
  30 +#define Em_Message_PAIRING 9
  31 +#define Em_Message_PAIRING_DONE 10
  32 +/* protocolLevel #7 */
  33 +#define Em_Message_OFFLINE 11
  34 +/* protocolLevel #8 */
  35 +#define Em_Message_ACCEPT 12
  36 +
  37 +typedef struct Em_Message_Header {
  38 + Em_Message_Size size;
  39 + Em_Message_Kind kind;
  40 + Em_Message_ResId resId;
  41 + Em_Message_Chan chan;
  42 +} Em_Message_Header;
  43 +
  44 +typedef uint16_t Em_Message_protocolLevel_t;
  45 +
  46 +/* protocolLevel #1 */
  47 +
  48 +/* protocolLevel #10 */
  49 +/* #define Em_Message_SYS_SCHEMA_UUID -1 */
  50 +
  51 +#define Em_Message_SYS_MCM_PROTOCOL_LEVEL -2
  52 +#define Em_Message_SYS_EAP_PROTOCOL_LEVEL -3
  53 +#define Em_Message_SYS_EAP_BUILD_DATE -4
  54 +
  55 +/* protocolLevel #2 */
  56 +#define Em_Message_SYS_FILE_INDEX_RESET -5
  57 +
  58 +/* protocolLevel #5 */
  59 +#define Em_Message_SYS_SCHEMA_HASH -6
  60 +
  61 +/* protocolLevel #7 */
  62 +#define Em_Message_SYS_RESOURCE_COUNT -7
  63 +
  64 +/* protocolLevel #9 */
  65 +#define Em_Message_SYS_MOBILE_RSSI -8
  66 +
  67 +/* protocolLevel #11 */
  68 +#define Em_Message_SYS_MCM_DISCONNECT -9
  69 +
  70 +extern void Em_Message_init(void);
  71 +
  72 +extern bool Em_Message_addByte(uint8_t b);
  73 +extern void Em_Message_dispatch(void);
  74 +extern bool Em_Message_getByte(uint8_t *bp);
  75 +extern uint8_t Em_Message_lock(void);
  76 +extern void Em_Message_startSend(void);
  77 +extern void Em_Message_unlock(uint8_t key);
  78 +
  79 +#ifdef __cplusplus
  80 +}
  81 +#endif
  82 +
  83 +#endif /*Em_Message_H_*/
BlinkerSchema/out/Em_Types.h 0 → 100644
  1 +++ a/BlinkerSchema/out/Em_Types.h
  1 +#ifndef Em_Types_H_
  2 +#define Em_Types_H_
  3 +
  4 +#ifndef EM_NOSTDBOOL
  5 +#include <stdbool.h>
  6 +#endif
  7 +
  8 +#ifndef EM_NOSTDINT
  9 +#include <stdint.h>
  10 +#endif
  11 +
  12 +#endif /*Em_Types_H_*/
BlinkerSchema/out/blinker.json 0 → 100644
  1 +++ a/BlinkerSchema/out/blinker.json
  1 +{
  2 + "resources": {
  3 + "$schemaHash": {
  4 + "id": -6,
  5 + "align": 1,
  6 + "attributes": {"readonly": true},
  7 + "type": "A20:u1",
  8 + "access": "r",
  9 + "size": 20
  10 + },
  11 + "$eapProtocolLevel": {
  12 + "id": -3,
  13 + "align": 2,
  14 + "attributes": {"readonly": true},
  15 + "type": "u2",
  16 + "access": "r",
  17 + "size": 2
  18 + },
  19 + "cmd": {
  20 + "id": 1,
  21 + "align": 1,
  22 + "attributes": {"writeonly": true},
  23 + "type": "E:@emmoco.com.Blinker/Cmd",
  24 + "access": "w",
  25 + "size": 1
  26 + },
  27 + "$mcmProtocolLevel": {
  28 + "id": -2,
  29 + "align": 2,
  30 + "attributes": {"readonly": true},
  31 + "type": "u2",
  32 + "access": "r",
  33 + "size": 2
  34 + },
  35 + "count": {
  36 + "id": 2,
  37 + "align": 2,
  38 + "attributes": {"readwrite": true},
  39 + "type": "i2",
  40 + "access": "rw",
  41 + "size": 2
  42 + },
  43 + "$mobileRssi": {
  44 + "id": -8,
  45 + "align": 1,
  46 + "attributes": {"readonly": true},
  47 + "type": "i1",
  48 + "access": "r",
  49 + "size": 1
  50 + },
  51 + "$mcmDisconnect": {
  52 + "id": -9,
  53 + "align": 1,
  54 + "attributes": {"writeonly": true},
  55 + "type": "u1",
  56 + "access": "w",
  57 + "size": 1
  58 + },
  59 + "delay": {
  60 + "id": 3,
  61 + "align": 2,
  62 + "attributes": {"readwrite": true},
  63 + "type": "N:0.500000,2.000000,0.100000,3/u2",
  64 + "access": "rw",
  65 + "size": 2
  66 + },
  67 + "$eapBuildDate": {
  68 + "id": -4,
  69 + "align": 1,
  70 + "attributes": {"readonly": true},
  71 + "type": "A8:u1",
  72 + "access": "r",
  73 + "size": 8
  74 + },
  75 + "$resourceCount": {
  76 + "id": -7,
  77 + "align": 1,
  78 + "attributes": {"readonly": true},
  79 + "type": "S:system@emmoco.com.System/ResourceCount",
  80 + "access": "r",
  81 + "size": 2
  82 + },
  83 + "ledState": {
  84 + "id": 4,
  85 + "align": 1,
  86 + "attributes": {
  87 + "indicator": true,
  88 + "readonly": true
  89 + },
  90 + "type": "E:@emmoco.com.Blinker/LedState",
  91 + "access": "ir",
  92 + "size": 1
  93 + },
  94 + "$fileIndexReset": {
  95 + "id": -5,
  96 + "align": 2,
  97 + "attributes": {"writeonly": true},
  98 + "type": "i2",
  99 + "access": "w",
  100 + "size": 2
  101 + }
  102 + },
  103 + "resourceNamesSys": [
  104 + "$eapBuildDate",
  105 + "$eapProtocolLevel",
  106 + "$fileIndexReset",
  107 + "$mcmDisconnect",
  108 + "$mcmProtocolLevel",
  109 + "$mobileRssi",
  110 + "$resourceCount",
  111 + "$schemaHash"
  112 + ],
  113 + "manifest": {
  114 + "protocolLevel": 12,
  115 + "hash": [
  116 + 194,
  117 + 8,
  118 + 191,
  119 + 173,
  120 + 237,
  121 + 198,
  122 + 193,
  123 + 165,
  124 + 88,
  125 + 202,
  126 + 74,
  127 + 246,
  128 + 70,
  129 + 59,
  130 + 102,
  131 + 128
  132 + ],
  133 + "toolVersion": "12.0.0.201211010336",
  134 + "name": "Blinker",
  135 + "$$md5": "73d98dc6eb4c17eea377d5969c0e49d2",
  136 + "build": [
  137 + 20,
  138 + 116,
  139 + 249,
  140 + 224,
  141 + 69,
  142 + 1,
  143 + 0,
  144 + 0
  145 + ],
  146 + "date": "2014-05-09T14:33:35T",
  147 + "maxAlign": 2,
  148 + "maxSize": 20,
  149 + "version": "1.0.0"
  150 + },
  151 + "resourceNames": [
  152 + "cmd",
  153 + "count",
  154 + "delay",
  155 + "ledState",
  156 + "$mcmProtocolLevel",
  157 + "$eapProtocolLevel",
  158 + "$eapBuildDate",
  159 + "$fileIndexReset",
  160 + "$schemaHash",
  161 + "$resourceCount",
  162 + "$mobileRssi",
  163 + "$mcmDisconnect"
  164 + ],
  165 + "attributes": {
  166 + "description": "Blinker, the hello world program for mobile control",
  167 + "version": "1.0.0"
  168 + },
  169 + "types": {
  170 + "@emmoco.com.Blinker/LedState": {
  171 + "values": [
  172 + "LED_OFF",
  173 + "LED_ON"
  174 + ],
  175 + "align": 1,
  176 + "type": "E:@emmoco.com.Blinker/LedState",
  177 + "size": 1
  178 + },
  179 + "system@emmoco.com.System/ResourceCount": {
  180 + "align": 1,
  181 + "type": "S:system@emmoco.com.System/ResourceCount",
  182 + "size": 2,
  183 + "fields": [
  184 + {
  185 + "pad": 0,
  186 + "align": 1,
  187 + "name": "app",
  188 + "type": "u1",
  189 + "size": 1
  190 + },
  191 + {
  192 + "pad": 0,
  193 + "align": 1,
  194 + "name": "sys",
  195 + "type": "u1",
  196 + "size": 1
  197 + }
  198 + ]
  199 + },
  200 + "std:i2": {
  201 + "align": 2,
  202 + "size": 2
  203 + },
  204 + "std:i1": {
  205 + "align": 1,
  206 + "size": 1
  207 + },
  208 + "std:u1": {
  209 + "align": 1,
  210 + "size": 1
  211 + },
  212 + "@emmoco.com.Blinker/Cmd": {
  213 + "values": [
  214 + "START_CMD",
  215 + "STOP_CMD"
  216 + ],
  217 + "align": 1,
  218 + "type": "E:@emmoco.com.Blinker/Cmd",
  219 + "size": 1
  220 + },
  221 + "std:u2": {
  222 + "align": 2,
  223 + "size": 2
  224 + }
  225 + },
  226 + "resourceNamesApp": [
  227 + "cmd",
  228 + "count",
  229 + "delay",
  230 + "ledState"
  231 + ],
  232 + "imports": {"@emmoco.com.Blinker": true}
  233 +}
0 \ No newline at end of file 234 \ No newline at end of file
BlinkerSchema/schema.ems 0 → 100644
  1 +++ a/BlinkerSchema/schema.ems
  1 +version = "1.0.0"
  2 +description = "Blinker, the hello world program for mobile control"
  3 +
  4 +schema Blinker {
  5 +
  6 + /* -------- resource cmd -------- */
  7 + enum Cmd {
  8 + START_CMD, STOP_CMD
  9 + }
  10 + Cmd cmd {
  11 + writeonly
  12 + }
  13 +
  14 + /* -------- resource count -------- */
  15 + int16 count {
  16 + readwrite
  17 + }
  18 +
  19 + /* -------- resource delay -------- */
  20 + num <0.5, 2.0, 0.100> delay {
  21 + readwrite
  22 + }
  23 +
  24 + /* -------- resource ledState -------- */
  25 + enum LedState {
  26 + LED_OFF, LED_ON
  27 + }
  28 + LedState ledState {
  29 + readonly
  30 + indicator
  31 + }
  32 +}
CommonLaunchPad/.externalToolConfigurations/LaunchPad Application.launch 0 → 100644
  1 +++ a/CommonLaunchPad/.externalToolConfigurations/LaunchPad Application.launch
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
  3 +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
  4 +<mapAttribute key="org.eclipse.debug.core.environmentVariables">
  5 +<mapEntry key="PATH" value="${eclipse_home}/msptools/bin${system_property:path.separator}${env_var:PATH}"/>
  6 +</mapAttribute>
  7 +<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
  8 +<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
  9 +</listAttribute>
  10 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${project}"/>
  11 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${eclipse_home}/msptools/bin/gmake${exe_ext}"/>
  12 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="load COMMON=${project_loc:/CommonLaunchPad}"/>
  13 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}"/>
  14 +</launchConfiguration>
CommonLaunchPad/.project 0 → 100644
  1 +++ a/CommonLaunchPad/.project
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>CommonLaunchPad</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + </buildSpec>
  9 + <natures>
  10 + </natures>
  11 +</projectDescription>
CommonLaunchPad/rules.mk 0 → 100644
  1 +++ a/CommonLaunchPad/rules.mk
  1 +MCU = msp430g2553
  2 +
  3 +CC = msp430-gcc
  4 +OBJCOPY = msp430-objcopy
  5 +SIZE = msp430-size
  6 +MSPDEBUG = mspdebug
  7 +MSP430FLASHER = MSP430Flasher
  8 +EMBUILDER = em-builder
  9 +COPTS = -Os -Wall -fno-strict-aliasing -c -g -mmcu=$(MCU)
  10 +LDOPTS = -mmcu=$(MCU) -Wl,-Map=main.map
  11 +
  12 +EMSOUT = $(SCHEMA)/out
  13 +RMFILES = *.out *.map *.hex *.obj
  14 +CFLAGS = -I$(COMMON) -I$(EMSOUT) $(COPTS)
  15 +LDFLAGS = $(LDOPTS)
  16 +VPATH = $(COMMON)
  17 +OUTFILE = main.out
  18 +
  19 +all: $(OUTFILE)
  20 +
  21 +ifeq (,$(findstring Windows,$(OS)))
  22 +load: out-check
  23 + $(MSPDEBUG) rf2500 "prog $(OUTFILE)" 2>&1
  24 +else
  25 +load: $(OUTFILE:.out=.hex)
  26 + $(MSP430FLASHER) -i USB -m AUTO -e ERASE_MAIN -n $(MCU) -w $< -v -z [VCC] -g
  27 +endif
  28 +
  29 +$(OUTFILE): $(OBJECTS)
  30 + $(CC) $(LDFLAGS) -o $@ $^
  31 + $(SIZE) $@
  32 +
  33 +%.hex: out-check
  34 + $(OBJCOPY) -O ihex $(@:.hex=.out) $@
  35 +
  36 +%.obj: %.c $(EMSOUT)/$(EMSNAME).h
  37 + $(CC) $(CFLAGS) -o $@ $<
  38 +
  39 +$(EMSNAME).obj: $(EMSOUT)/$(EMSNAME).c $(EMSOUT)/$(EMSNAME).h
  40 + $(CC) $(CFLAGS) -o $@ $<
  41 +
  42 +$(EMSOUT)/$(EMSNAME).h: $(SCHEMA)/schema.ems
  43 + $(EMBUILDER) -v --root=$(<D) $<
  44 +
  45 +local-clean:
  46 +ifeq (,$(findstring Windows,$(OS)))
  47 + rm -f $(RMFILES)
  48 +else
  49 +ifneq (,$(wildcard $(RMFILES)))
  50 + cmd /c del /q $(wildcard $(RMFILES))
  51 +endif
  52 +endif
  53 +
  54 +clean: local-clean
  55 +ifeq (,$(findstring Windows,$(OS)))
  56 + rm -rf $(EMSOUT)
  57 +else
  58 +ifneq (,$(wildcard $(EMSOUT)))
  59 + cmd /c rmdir /q /s $(subst /,\,$(EMSOUT))
  60 +endif
  61 +endif
  62 +
  63 +out-check:
  64 +ifeq (,$(wildcard $(OUTFILE)))
  65 + @echo error: $(OUTFILE): No such file or directory 1>&2
  66 + @exit 1
  67 +endif
  68 +
  69 +.PHONY: all load clean local-clean out-check
DUREX/.project 0 → 100644
  1 +++ a/DUREX/.project
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>DUREX</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>com.emmoco.mcmtooling.core.mcmToolingBuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + </buildSpec>
  14 + <natures>
  15 + <nature>com.emmoco.mcmtooling.core.mcmToolingNature</nature>
  16 + </natures>
  17 +</projectDescription>
DUREX/bundle.properties 0 → 100644
  1 +++ a/DUREX/bundle.properties
  1 +# generated file - do not edit
  2 +
  3 +bundle.requires = com.emmoco.schema.translator
  4 +com.emmoco.framework.Properties.applicationDirectory = out
  5 +com.emmoco.framework.Properties.schemaDestinationDirectory = out
  6 +com.emmoco.framework.Properties.serverAPIToken =
  7 +com.emmoco.framework.Properties.align16 = 2
  8 +com.emmoco.framework.Properties.align32 = 4
  9 +com.emmoco.framework.Properties.schemaFile = /Users/imanol/devel/emmoco/DUREX/schema.ems
  10 +com.emmoco.framework.Properties.toolVersion = 12.0.0.201211010336
DUREX/imports/system@emmoco.com/System.ems 0 → 100644
  1 +++ a/DUREX/imports/system@emmoco.com/System.ems
  1 +owner = "system@emmoco.com"
  2 +
  3 +schema System {
  4 +
  5 + // protocolLevel #1
  6 +
  7 + uint8 $schemaUuid[16] { // protocolLevel #10 -- invisible to applications
  8 + readonly
  9 + }
  10 +
  11 + uint16 $mcmProtocolLevel {
  12 + readonly
  13 + }
  14 +
  15 + uint16 $eapProtocolLevel {
  16 + readonly
  17 + }
  18 +
  19 + uint8 $eapBuildDate[8] { // protocolLevel #5 -- rename from $eapBuildNumber
  20 + readonly
  21 + }
  22 +
  23 + // protocolLevel #2
  24 +
  25 + int16 $fileIndexReset {
  26 + writeonly
  27 + }
  28 +
  29 + // protocolLevel #5
  30 +
  31 + // protocolLevel #12 -- increase size to 20
  32 +
  33 + uint8 $schemaHash[20] {
  34 + readonly
  35 + }
  36 +
  37 + // protocolLevel #7
  38 +
  39 + struct ResourceCount {
  40 + uint8 app
  41 + uint8 sys
  42 + }
  43 +
  44 + ResourceCount $resourceCount {
  45 + readonly
  46 + }
  47 +
  48 + // protocolLevel #9
  49 +
  50 + int8 $mobileRssi {
  51 + readonly
  52 + }
  53 +
  54 + // protocolLevel #11
  55 +
  56 + uint8 $mcmDisconnect {
  57 + writeonly
  58 + }
  59 +
  60 +}
DUREX/out/DUREX-TODO.c 0 → 100644
  1 +++ a/DUREX/out/DUREX-TODO.c
  1 +/**** DO NOT EDIT -- this file has been automatically generated from @emmoco.com.DUREX on 2014-05-09T15:19:51T ****/
  2 +/**** protocolLevel = 12, toolsVersion = 12.0.0.201211010336 ****/
  3 +
  4 +#include "DUREX.h"
  5 +
  6 +#ifdef Em_DUREX_TODO /* enables optional inclusion of empty functions */
  7 +
  8 +/* Copy the function skeletons below into your own DUREX.c source file */
  9 +
  10 +void DUREX_connectHandler(void) {
  11 + /* TODO: application is now connected */
  12 +}
  13 +
  14 +void DUREX_disconnectHandler(void) {
  15 + /* TODO: application is now disconnected */
  16 +}
  17 +
  18 +void DUREX_serverBytesAvailable_fetch(DUREX_serverBytesAvailable_t* const output) {
  19 + /* TODO: write resource 'serverBytesAvailable' into 'output' */
  20 +}
  21 +
  22 +void DUREX_serverBytesAvailable_store(DUREX_serverBytesAvailable_t* const input) {
  23 + /* TODO: read resource 'serverBytesAvailable' from 'input' */
  24 +}
  25 +
  26 +void DUREX_clientBytesAvailable_fetch(DUREX_clientBytesAvailable_t* const output) {
  27 + /* TODO: write resource 'clientBytesAvailable' into 'output' */
  28 +}
  29 +
  30 +void DUREX_clientBytesAvailable_store(DUREX_clientBytesAvailable_t* const input) {
  31 + /* TODO: read resource 'clientBytesAvailable' from 'input' */
  32 +}
  33 +
  34 +void DUREX_serverData_fetch(DUREX_serverData_t* const output) {
  35 + /* TODO: write resource 'serverData' into 'output' */
  36 +}
  37 +
  38 +void DUREX_serverData_store(DUREX_serverData_t* const input) {
  39 + /* TODO: read resource 'serverData' from 'input' */
  40 +}
  41 +
  42 +void DUREX_clientData_fetch(DUREX_clientData_t* const output) {
  43 + /* TODO: write resource 'clientData' into 'output' */
  44 +}
  45 +
  46 +void DUREX_clientData_store(DUREX_clientData_t* const input) {
  47 + /* TODO: read resource 'clientData' from 'input' */
  48 +}
  49 +
  50 +void DUREX_serverMoreData_fetch(DUREX_serverMoreData_t* const output) {
  51 + /* TODO: write resource 'serverMoreData' into 'output' */
  52 +}
  53 +
  54 +void DUREX_serverMoreData_store(DUREX_serverMoreData_t* const input) {
  55 + /* TODO: read resource 'serverMoreData' from 'input' */
  56 +}
  57 +
  58 +void DUREX_clientMoreData_fetch(DUREX_clientMoreData_t* const output) {
  59 + /* TODO: write resource 'clientMoreData' into 'output' */
  60 +}
  61 +
  62 +void DUREX_clientMoreData_store(DUREX_clientMoreData_t* const input) {
  63 + /* TODO: read resource 'clientMoreData' from 'input' */
  64 +}
  65 +
  66 +#endif /* dummy file */
DUREX/out/DUREX.c 0 → 100644
  1 +++ a/DUREX/out/DUREX.c
  1 +/**** DO NOT EDIT -- this file has been automatically generated from @emmoco.com.DUREX on 2014-05-09T15:19:51T ****/
  2 +/**** protocolLevel = 12, toolsVersion = 12.0.0.201211010336 ****/
  3 +
  4 +#include "Em_Message.h"
  5 +#include "DUREX.h"
  6 +
  7 +#ifdef __cplusplus
  8 +extern "C" {
  9 +#endif
  10 +
  11 +#define Em_Message_protocolLevel 12
  12 +
  13 +typedef struct Em_App_Message {
  14 + uint8_t dummy;
  15 + uint8_t sot;
  16 + Em_Message_Header hdr;
  17 + uint8_t data[240];
  18 +} Em_App_Message;
  19 +
  20 +const uint8_t Em_App_hash[] = {218, 74, 41, 73, 107, 164, 154, 232, 180, 185, 128, 44, 30, 56, 49, 63, 12, 0, ((sizeof(struct{uint8_t f1; uint16_t f2;}) - sizeof(uint16_t)) << 4) | (sizeof(struct{uint8_t f1; uint32_t f2;}) - sizeof(uint32_t))};
  21 +
  22 +const uint8_t Em_App_build[] = {221, 204, 35, 225, 69, 1, 0, 0};
  23 +
  24 +#define Em_App_APP_RESOURCE_COUNT 6
  25 +#define Em_App_SYS_RESOURCE_COUNT 8
  26 +
  27 +#define Em_App_ACCEPT DUREX_accept
  28 +#define Em_App_DISCONNECT DUREX_disconnect
  29 +#define Em_App_PAIRINGON DUREX_pairingOn
  30 +#define Em_App_PAIRINGOFF DUREX_pairingOff
  31 +#define Em_App_RESET DUREX_reset
  32 +#define Em_App_RUN DUREX_run
  33 +
  34 +#define Em_App_CONNECTHANDLER DUREX_connectHandler
  35 +#define Em_App_DISCONNECTHANDLER DUREX_disconnectHandler
  36 +
  37 +#define Em_App_MAX_INDICATOR 1
  38 +
  39 +enum {Em_App_IDLE, Em_App_DISCONNECTED, Em_App_CONNECTED};
  40 +
  41 +typedef struct Em_App_Indicator {
  42 + uint8_t dummy;
  43 + uint8_t sot;
  44 + Em_Message_Header hdr;
  45 + uint8_t data[Em_Message_INDSIZE];
  46 +} Em_App_Indicator;
  47 +
  48 +void (*Em_App_pdHdlr)(void);
  49 +
  50 +const uint16_t Em_App_endian = 0x0100;
  51 +
  52 +Em_Message_Size Em_App_recvIdx;
  53 +Em_Message_Size Em_App_recvSize;
  54 +Em_Message_Size Em_App_xmitIdx;
  55 +Em_Message_Size Em_App_xmitSize;
  56 +
  57 +uint8_t Em_App_state = Em_App_IDLE;
  58 +Em_App_Message Em_App_msg;
  59 +Em_App_Indicator Em_App_ind;
  60 +bool Em_App_moreData = false;
  61 +bool Em_App_readIdle = true;
  62 +int32_t Em_App_fileIndex;
  63 +uint32_t Em_App_xmitMask;
  64 +
  65 +uint8_t* Em_App_inBuf = (uint8_t*)&Em_App_msg.hdr;
  66 +uint8_t* Em_App_outBuf;
  67 +
  68 +void Em_App_fetchDispatch(void);
  69 +void Em_App_storeDispatch(void);
  70 +void Em_App_sendIndicator(Em_Message_ResId indId);
  71 +void Em_App_sendResponse(Em_Message_Kind kind, Em_Message_Size size);
  72 +void Em_App_startIndSend(void);
  73 +void Em_App_startResSend(void);
  74 +void Em_App_sysFetchDispatch(void);
  75 +void Em_App_sysStoreDispatch(void);
  76 +bool Em_App_xmitReady(Em_Message_ResId indId);
  77 +
  78 +bool Em_Message_addByte(uint8_t b) {
  79 + if (Em_App_readIdle && b) {
  80 + Em_App_recvSize = Em_App_inBuf[0] = b;
  81 + Em_App_recvIdx = 1;
  82 + Em_App_readIdle = false;
  83 + return false;
  84 + }
  85 + Em_App_inBuf[Em_App_recvIdx++] = b;
  86 + if (Em_App_recvIdx < Em_App_recvSize) {
  87 + return false;
  88 + }
  89 + Em_App_readIdle = true;
  90 + return true;
  91 +}
  92 +
  93 +bool Em_Message_getByte(uint8_t* bp) {
  94 + uint8_t key = Em_Message_lock();
  95 + Em_App_moreData = (Em_App_xmitSize != 0);
  96 + if (!Em_App_moreData && (Em_App_xmitMask != 0)) {
  97 + uint8_t i;
  98 + uint32_t m;
  99 + for (i = 0, m = 0x1; i < Em_App_MAX_INDICATOR; i++, m <<= 1) {
  100 + if (Em_App_xmitMask & m) {
  101 + Em_App_xmitMask &= ~m;
  102 + if (i == 0) {
  103 + Em_App_startResSend();
  104 + }
  105 + else {
  106 + Em_App_sendIndicator(i);
  107 + }
  108 + break;
  109 + }
  110 + }
  111 + Em_Message_unlock(key);
  112 + return false;
  113 + }
  114 + else if (Em_App_moreData) {
  115 + *bp = Em_App_outBuf[Em_App_xmitIdx++];
  116 + Em_App_xmitSize -= 1;
  117 + }
  118 + Em_Message_unlock(key);
  119 + return Em_App_moreData;
  120 +}
  121 +
  122 +void Em_App_ACCEPT(bool enable) {
  123 + if (Em_App_state == Em_App_CONNECTED) {
  124 + return;
  125 + }
  126 + Em_App_ind.sot = 0;
  127 + Em_App_ind.hdr.kind = Em_Message_ACCEPT;
  128 + Em_App_ind.hdr.size = sizeof (Em_Message_Header);
  129 + Em_App_ind.hdr.resId = enable;
  130 + Em_App_startIndSend();
  131 +}
  132 +
  133 +void Em_App_DISCONNECT(void) {
  134 + if (Em_App_state != Em_App_CONNECTED) {
  135 + return;
  136 + }
  137 + Em_App_state = Em_App_DISCONNECTED;
  138 + Em_App_ind.sot = 0;
  139 + Em_App_ind.hdr.kind = Em_Message_DISCONNECT;
  140 + Em_App_ind.hdr.size = sizeof (Em_Message_Header);
  141 + Em_App_ind.hdr.resId = 0;
  142 + Em_App_startIndSend();
  143 +}
  144 +
  145 +void Em_Message_dispatch(void) {
  146 + if (Em_App_state == Em_App_IDLE) {
  147 + return;
  148 + }
  149 + switch (Em_App_msg.hdr.kind) {
  150 + case Em_Message_CONNECT:
  151 + Em_App_state = Em_App_CONNECTED;
  152 + Em_App_CONNECTHANDLER();
  153 + break;
  154 + case Em_Message_DISCONNECT:
  155 + Em_App_state = Em_App_DISCONNECTED;
  156 + Em_App_DISCONNECTHANDLER();
  157 + break;
  158 + case Em_Message_PAIRING_DONE:
  159 + if (Em_App_pdHdlr) {
  160 + (*Em_App_pdHdlr)();
  161 + }
  162 + break;
  163 + case Em_Message_FETCH:
  164 + if (Em_App_msg.hdr.resId > 0) {
  165 + Em_App_fetchDispatch();
  166 + }
  167 + else {
  168 + Em_App_sysFetchDispatch();
  169 + }
  170 + break;
  171 + case Em_Message_STORE:
  172 + if (Em_App_msg.hdr.resId > 0) {
  173 + Em_App_storeDispatch();
  174 + }
  175 + else {
  176 + Em_App_sysStoreDispatch();
  177 + }
  178 + break;
  179 + }
  180 +}
  181 +
  182 +void Em_App_PAIRINGOFF(void(*handler)(void)) {
  183 + Em_App_PAIRINGON(0, handler);
  184 +}
  185 +
  186 +void Em_App_PAIRINGON(uint8_t secs, void(*handler)(void)) {
  187 + if (Em_App_state != Em_App_DISCONNECTED) {
  188 + return;
  189 + }
  190 + Em_App_pdHdlr = handler;
  191 + Em_App_ind.sot = 0;
  192 + Em_App_ind.hdr.kind = Em_Message_PAIRING;
  193 + Em_App_ind.hdr.size = sizeof (Em_Message_Header);
  194 + Em_App_ind.hdr.resId = secs;
  195 + Em_App_startIndSend();
  196 +}
  197 +
  198 +void Em_App_RESET(void) {
  199 + Em_App_recvIdx = Em_App_recvSize = Em_App_xmitIdx = Em_App_xmitSize = 0;
  200 + Em_App_state = Em_App_IDLE;
  201 + Em_App_moreData = false;
  202 + Em_App_readIdle = true;
  203 + Em_App_fileIndex = 0;
  204 + Em_App_xmitMask = 0;
  205 +}
  206 +
  207 +void Em_App_RUN(void) {
  208 + Em_App_state = Em_App_DISCONNECTED;
  209 +}
  210 +
  211 +void Em_App_sendResponse(Em_Message_Kind kind, Em_Message_Size size) {
  212 + if (Em_App_state != Em_App_CONNECTED) {
  213 + return;
  214 + }
  215 + Em_App_msg.sot = 0;
  216 + Em_App_msg.hdr.kind = kind;
  217 + Em_App_msg.hdr.size = size + sizeof (Em_Message_Header);
  218 + if (Em_App_xmitReady(0)) {
  219 + Em_App_startResSend();
  220 + }
  221 +}
  222 +
  223 +void Em_App_startIndSend(void) {
  224 + Em_App_outBuf = (uint8_t*)&Em_App_ind.sot;
  225 + Em_App_xmitSize = Em_App_ind.hdr.size + 1;
  226 + Em_App_xmitIdx = 0;
  227 + Em_Message_startSend();
  228 +}
  229 +
  230 +void Em_App_startResSend(void) {
  231 + Em_App_outBuf = (uint8_t*)&Em_App_msg.sot;
  232 + Em_App_xmitSize = Em_App_msg.hdr.size + 1;
  233 + Em_App_xmitIdx = 0;
  234 + Em_Message_startSend();
  235 +}
  236 +
  237 +void Em_App_sysFetchDispatch(void) {
  238 + uint8_t size = 0;
  239 + int i;
  240 + switch (Em_App_msg.hdr.resId) {
  241 + case Em_Message_SYS_SCHEMA_HASH:
  242 + for (i = 0; i < sizeof (Em_App_hash); i++) {
  243 + Em_App_msg.data[i] = Em_App_hash[i];
  244 + }
  245 + Em_App_msg.data[sizeof (Em_App_hash)] = *((uint8_t*)&Em_App_endian);
  246 + size = sizeof (Em_App_hash) + 1;
  247 + break;
  248 + case Em_Message_SYS_EAP_PROTOCOL_LEVEL:
  249 + *((Em_Message_protocolLevel_t*)Em_App_msg.data) = Em_Message_protocolLevel;
  250 + size = sizeof (Em_Message_protocolLevel_t);
  251 + break;
  252 + case Em_Message_SYS_EAP_BUILD_DATE:
  253 + for (i = 0; i < sizeof (Em_App_build); i++) {
  254 + Em_App_msg.data[i] = Em_App_build[i];
  255 + }
  256 + size = sizeof (Em_App_build);
  257 + break;
  258 + case Em_Message_SYS_RESOURCE_COUNT:
  259 + Em_App_msg.data[0] = Em_App_APP_RESOURCE_COUNT;
  260 + Em_App_msg.data[1] = Em_App_SYS_RESOURCE_COUNT;
  261 + size = 2;
  262 + break;
  263 + }
  264 + Em_App_sendResponse(Em_Message_FETCH_DONE, size);
  265 +}
  266 +
  267 +void Em_App_sysStoreDispatch(void) {
  268 + switch (Em_App_msg.hdr.resId) {
  269 + case Em_Message_SYS_FILE_INDEX_RESET:
  270 + Em_App_fileIndex = 0;
  271 + break;
  272 + }
  273 + Em_App_sendResponse(Em_Message_STORE_DONE, 0);
  274 +}
  275 +
  276 +bool Em_App_xmitReady(Em_Message_ResId indId) {
  277 + uint8_t key = Em_Message_lock();
  278 + bool res = !Em_App_moreData && Em_App_xmitMask == 0;
  279 + if (!res) {
  280 + Em_App_xmitMask |= (1 << indId);
  281 + }
  282 + Em_Message_unlock(key);
  283 + return res;
  284 +}
  285 +
  286 +void Em_App_fetchDispatch(void) {
  287 + uint8_t size = 0;
  288 + switch (Em_App_msg.hdr.resId) {
  289 + case 0:
  290 + break;
  291 + case 1:
  292 + DUREX_serverBytesAvailable_fetch((DUREX_serverBytesAvailable_t*)Em_App_msg.data);
  293 + size = 1;
  294 + break;
  295 + case 2:
  296 + DUREX_clientBytesAvailable_fetch((DUREX_clientBytesAvailable_t*)Em_App_msg.data);
  297 + size = 1;
  298 + break;
  299 + case 3:
  300 + DUREX_serverData_fetch((DUREX_serverData_t*)Em_App_msg.data);
  301 + size = 240;
  302 + break;
  303 + case 4:
  304 + DUREX_clientData_fetch((DUREX_clientData_t*)Em_App_msg.data);
  305 + size = 240;
  306 + break;
  307 + case 5:
  308 + DUREX_serverMoreData_fetch((DUREX_serverMoreData_t*)Em_App_msg.data);
  309 + size = 1;
  310 + break;
  311 + case 6:
  312 + DUREX_clientMoreData_fetch((DUREX_clientMoreData_t*)Em_App_msg.data);
  313 + size = 1;
  314 + break;
  315 + }
  316 + Em_App_sendResponse(Em_Message_FETCH_DONE, size);
  317 +}
  318 +
  319 +void Em_App_storeDispatch(void) {
  320 + switch (Em_App_msg.hdr.resId) {
  321 + case 0:
  322 + break;
  323 + case 1:
  324 + DUREX_serverBytesAvailable_store((DUREX_serverBytesAvailable_t*)Em_App_msg.data);
  325 + break;
  326 + case 2:
  327 + DUREX_clientBytesAvailable_store((DUREX_clientBytesAvailable_t*)Em_App_msg.data);
  328 + break;
  329 + case 3:
  330 + DUREX_serverData_store((DUREX_serverData_t*)Em_App_msg.data);
  331 + break;
  332 + case 4:
  333 + DUREX_clientData_store((DUREX_clientData_t*)Em_App_msg.data);
  334 + break;
  335 + case 5:
  336 + DUREX_serverMoreData_store((DUREX_serverMoreData_t*)Em_App_msg.data);
  337 + break;
  338 + case 6:
  339 + DUREX_clientMoreData_store((DUREX_clientMoreData_t*)Em_App_msg.data);
  340 + break;
  341 + }
  342 + Em_App_sendResponse(Em_Message_STORE_DONE, 0);
  343 +}
  344 +
  345 +void Em_App_sendIndicator(Em_Message_ResId indId) {
  346 + Em_Message_Size resId = 0;
  347 + Em_Message_Size size = 0;
  348 + Em_App_ind.sot = 0;
  349 + Em_App_ind.hdr.kind = Em_Message_INDICATOR;
  350 + Em_App_ind.hdr.size = sizeof (Em_Message_Header) + size;
  351 + Em_App_ind.hdr.resId = resId;
  352 + Em_App_startIndSend();
  353 +}
  354 +
  355 +#ifdef __cplusplus
  356 +}
  357 +#endif
  358 +
DUREX/out/DUREX.h 0 → 100644
  1 +++ a/DUREX/out/DUREX.h
  1 +/**** DO NOT EDIT -- this file has been automatically generated from @emmoco.com.DUREX on 2014-05-09T15:19:51T ****/
  2 +/**** protocolLevel = 12, toolsVersion = 12.0.0.201211010336 ****/
  3 +
  4 +#ifndef DUREX__H
  5 +#define DUREX__H
  6 +
  7 +#include "Em_Types.h"
  8 +#include "Em_Message.h"
  9 +
  10 +#ifdef __cplusplus
  11 +extern "C" {
  12 +#endif
  13 +
  14 +/* typedef String */
  15 +typedef struct DUREX_String_t { char elems[240]; } DUREX_String_t;
  16 +#define DUREX_String_length 240
  17 +
  18 +/* enum BOOLEAN */
  19 +typedef uint8_t DUREX_BOOLEAN;
  20 +#define DUREX_TRUE 0
  21 +#define DUREX_FALSE 1
  22 +
  23 +/* resource serverBytesAvailable */
  24 +typedef uint8_t DUREX_serverBytesAvailable_t;
  25 +extern void DUREX_serverBytesAvailable_fetch(DUREX_serverBytesAvailable_t* const output);
  26 +extern void DUREX_serverBytesAvailable_store(DUREX_serverBytesAvailable_t* const input);
  27 +
  28 +/* resource clientBytesAvailable */
  29 +typedef uint8_t DUREX_clientBytesAvailable_t;
  30 +extern void DUREX_clientBytesAvailable_fetch(DUREX_clientBytesAvailable_t* const output);
  31 +extern void DUREX_clientBytesAvailable_store(DUREX_clientBytesAvailable_t* const input);
  32 +
  33 +/* resource serverData */
  34 +typedef DUREX_String DUREX_serverData_t[240];
  35 +extern void DUREX_serverData_fetch(DUREX_serverData_t* const output);
  36 +extern void DUREX_serverData_store(DUREX_serverData_t* const input);
  37 +
  38 +/* resource clientData */
  39 +typedef DUREX_String DUREX_clientData_t[240];
  40 +extern void DUREX_clientData_fetch(DUREX_clientData_t* const output);
  41 +extern void DUREX_clientData_store(DUREX_clientData_t* const input);
  42 +
  43 +/* resource serverMoreData */
  44 +typedef DUREX_BOOLEAN DUREX_serverMoreData_t;
  45 +extern void DUREX_serverMoreData_fetch(DUREX_serverMoreData_t* const output);
  46 +extern void DUREX_serverMoreData_store(DUREX_serverMoreData_t* const input);
  47 +
  48 +/* resource clientMoreData */
  49 +typedef DUREX_BOOLEAN DUREX_clientMoreData_t;
  50 +extern void DUREX_clientMoreData_fetch(DUREX_clientMoreData_t* const output);
  51 +extern void DUREX_clientMoreData_store(DUREX_clientMoreData_t* const input);
  52 +
  53 +void DUREX_reset(void);
  54 +void DUREX_run(void);
  55 +
  56 +void DUREX_accept(bool enable);
  57 +void DUREX_disconnect(void);
  58 +void DUREX_pairingOn(uint8_t secs, void(*handler)(void));
  59 +void DUREX_pairingOff(void(*handler)(void));
  60 +
  61 +void DUREX_connectHandler(void);
  62 +void DUREX_disconnectHandler(void);
  63 +
  64 +#ifdef __cplusplus
  65 +}
  66 +#endif
  67 +
  68 +#endif /* DUREX__H */
DUREX/out/DUREX.zip 0 → 100644
No preview for this file type
DUREX/out/Em_Message.h 0 → 100644
  1 +++ a/DUREX/out/Em_Message.h
  1 +#ifndef Em_Message_H_
  2 +#define Em_Message_H_
  3 +
  4 +#include "Em_Types.h"
  5 +
  6 +#ifdef __cplusplus
  7 +extern "C" {
  8 +#endif
  9 +
  10 +/* protocolLevel #4 */
  11 +#define Em_Message_INDSIZE 4
  12 +
  13 +typedef uint8_t Em_Message_Size;
  14 +typedef uint8_t Em_Message_Kind;
  15 +/* protocolLevel #12 -- split 16-bit resId into <resId, chan> */
  16 +typedef int8_t Em_Message_ResId;
  17 +typedef uint8_t Em_Message_Chan;
  18 +
  19 +#define Em_Message_NOP 0
  20 +#define Em_Message_FETCH 1
  21 +#define Em_Message_FETCH_DONE 2
  22 +#define Em_Message_STORE 3
  23 +#define Em_Message_STORE_DONE 4
  24 +#define Em_Message_INDICATOR 5
  25 +#define Em_Message_CONNECT 6
  26 +#define Em_Message_DISCONNECT 7
  27 +#define Em_Message_ECHO 8
  28 +/* protocolLevel #3 */
  29 +/* protocolLevel #6 -- rename from BROADCAST to PAIRING */
  30 +#define Em_Message_PAIRING 9
  31 +#define Em_Message_PAIRING_DONE 10
  32 +/* protocolLevel #7 */
  33 +#define Em_Message_OFFLINE 11
  34 +/* protocolLevel #8 */
  35 +#define Em_Message_ACCEPT 12
  36 +
  37 +typedef struct Em_Message_Header {
  38 + Em_Message_Size size;
  39 + Em_Message_Kind kind;
  40 + Em_Message_ResId resId;
  41 + Em_Message_Chan chan;
  42 +} Em_Message_Header;
  43 +
  44 +typedef uint16_t Em_Message_protocolLevel_t;
  45 +
  46 +/* protocolLevel #1 */
  47 +
  48 +/* protocolLevel #10 */
  49 +/* #define Em_Message_SYS_SCHEMA_UUID -1 */
  50 +
  51 +#define Em_Message_SYS_MCM_PROTOCOL_LEVEL -2
  52 +#define Em_Message_SYS_EAP_PROTOCOL_LEVEL -3
  53 +#define Em_Message_SYS_EAP_BUILD_DATE -4
  54 +
  55 +/* protocolLevel #2 */
  56 +#define Em_Message_SYS_FILE_INDEX_RESET -5
  57 +
  58 +/* protocolLevel #5 */
  59 +#define Em_Message_SYS_SCHEMA_HASH -6
  60 +
  61 +/* protocolLevel #7 */
  62 +#define Em_Message_SYS_RESOURCE_COUNT -7
  63 +
  64 +/* protocolLevel #9 */
  65 +#define Em_Message_SYS_MOBILE_RSSI -8
  66 +
  67 +/* protocolLevel #11 */
  68 +#define Em_Message_SYS_MCM_DISCONNECT -9
  69 +
  70 +extern void Em_Message_init(void);
  71 +
  72 +extern bool Em_Message_addByte(uint8_t b);
  73 +extern void Em_Message_dispatch(void);
  74 +extern bool Em_Message_getByte(uint8_t *bp);
  75 +extern uint8_t Em_Message_lock(void);
  76 +extern void Em_Message_startSend(void);
  77 +extern void Em_Message_unlock(uint8_t key);
  78 +
  79 +#ifdef __cplusplus
  80 +}
  81 +#endif
  82 +
  83 +#endif /*Em_Message_H_*/
DUREX/out/Em_Types.h 0 → 100644
  1 +++ a/DUREX/out/Em_Types.h
  1 +#ifndef Em_Types_H_
  2 +#define Em_Types_H_
  3 +
  4 +#ifndef EM_NOSTDBOOL
  5 +#include <stdbool.h>
  6 +#endif
  7 +
  8 +#ifndef EM_NOSTDINT
  9 +#include <stdint.h>
  10 +#endif
  11 +
  12 +#endif /*Em_Types_H_*/
DUREX/out/durex.json 0 → 100644
  1 +++ a/DUREX/out/durex.json
  1 +{
  2 + "resources": {
  3 + "$schemaHash": {
  4 + "id": -6,
  5 + "align": 1,
  6 + "attributes": {"readonly": true},
  7 + "type": "A20:u1",
  8 + "access": "r",
  9 + "size": 20
  10 + },
  11 + "$eapProtocolLevel": {
  12 + "id": -3,
  13 + "align": 2,
  14 + "attributes": {"readonly": true},
  15 + "type": "u2",
  16 + "access": "r",
  17 + "size": 2
  18 + },
  19 + "serverData": {
  20 + "id": 3,
  21 + "align": 1,
  22 + "attributes": {},
  23 + "type": "C:240",
  24 + "access": "rw",
  25 + "size": 240
  26 + },
  27 + "clientMoreData": {
  28 + "id": 6,
  29 + "align": 1,
  30 + "attributes": {},
  31 + "type": "E:@emmoco.com.DUREX/BOOLEAN",
  32 + "access": "rw",
  33 + "size": 1
  34 + },
  35 + "serverMoreData": {
  36 + "id": 5,
  37 + "align": 1,
  38 + "attributes": {},
  39 + "type": "E:@emmoco.com.DUREX/BOOLEAN",
  40 + "access": "rw",
  41 + "size": 1
  42 + },
  43 + "$mcmProtocolLevel": {
  44 + "id": -2,
  45 + "align": 2,
  46 + "attributes": {"readonly": true},
  47 + "type": "u2",
  48 + "access": "r",
  49 + "size": 2
  50 + },
  51 + "$mobileRssi": {
  52 + "id": -8,
  53 + "align": 1,
  54 + "attributes": {"readonly": true},
  55 + "type": "i1",
  56 + "access": "r",
  57 + "size": 1
  58 + },
  59 + "serverBytesAvailable": {
  60 + "id": 1,
  61 + "align": 1,
  62 + "attributes": {},
  63 + "type": "u1",
  64 + "access": "rw",
  65 + "size": 1
  66 + },
  67 + "clientBytesAvailable": {
  68 + "id": 2,
  69 + "align": 1,
  70 + "attributes": {},
  71 + "type": "u1",
  72 + "access": "rw",
  73 + "size": 1
  74 + },
  75 + "$mcmDisconnect": {
  76 + "id": -9,
  77 + "align": 1,
  78 + "attributes": {"writeonly": true},
  79 + "type": "u1",
  80 + "access": "w",
  81 + "size": 1
  82 + },
  83 + "$eapBuildDate": {
  84 + "id": -4,
  85 + "align": 1,
  86 + "attributes": {"readonly": true},
  87 + "type": "A8:u1",
  88 + "access": "r",
  89 + "size": 8
  90 + },
  91 + "$resourceCount": {
  92 + "id": -7,
  93 + "align": 1,
  94 + "attributes": {"readonly": true},
  95 + "type": "S:system@emmoco.com.System/ResourceCount",
  96 + "access": "r",
  97 + "size": 2
  98 + },
  99 + "$fileIndexReset": {
  100 + "id": -5,
  101 + "align": 2,
  102 + "attributes": {"writeonly": true},
  103 + "type": "i2",
  104 + "access": "w",
  105 + "size": 2
  106 + },
  107 + "clientData": {
  108 + "id": 4,
  109 + "align": 1,
  110 + "attributes": {},
  111 + "type": "C:240",
  112 + "access": "rw",
  113 + "size": 240
  114 + }
  115 + },
  116 + "resourceNamesSys": [
  117 + "$eapBuildDate",
  118 + "$eapProtocolLevel",
  119 + "$fileIndexReset",
  120 + "$mcmDisconnect",
  121 + "$mcmProtocolLevel",
  122 + "$mobileRssi",
  123 + "$resourceCount",
  124 + "$schemaHash"
  125 + ],
  126 + "manifest": {
  127 + "protocolLevel": 12,
  128 + "hash": [
  129 + 218,
  130 + 74,
  131 + 41,
  132 + 73,
  133 + 107,
  134 + 164,
  135 + 154,
  136 + 232,
  137 + 180,
  138 + 185,
  139 + 128,
  140 + 44,
  141 + 30,
  142 + 56,
  143 + 49,
  144 + 63
  145 + ],
  146 + "toolVersion": "12.0.0.201211010336",
  147 + "name": "DUREX",
  148 + "$$md5": "275479fd2e9dfc29825d3d8004f33029",
  149 + "build": [
  150 + 221,
  151 + 204,
  152 + 35,
  153 + 225,
  154 + 69,
  155 + 1,
  156 + 0,
  157 + 0
  158 + ],
  159 + "date": "2014-05-09T15:19:51T",
  160 + "maxAlign": 2,
  161 + "maxSize": 240,
  162 + "version": "1.0.0"
  163 + },
  164 + "resourceNames": [
  165 + "serverBytesAvailable",
  166 + "clientBytesAvailable",
  167 + "serverData",
  168 + "clientData",
  169 + "serverMoreData",
  170 + "clientMoreData",
  171 + "$mcmProtocolLevel",
  172 + "$eapProtocolLevel",
  173 + "$eapBuildDate",
  174 + "$fileIndexReset",
  175 + "$schemaHash",
  176 + "$resourceCount",
  177 + "$mobileRssi",
  178 + "$mcmDisconnect"
  179 + ],
  180 + "attributes": {
  181 + "description": "",
  182 + "version": "1.0.0"
  183 + },
  184 + "types": {
  185 + "system@emmoco.com.System/ResourceCount": {
  186 + "align": 1,
  187 + "type": "S:system@emmoco.com.System/ResourceCount",
  188 + "size": 2,
  189 + "fields": [
  190 + {
  191 + "pad": 0,
  192 + "align": 1,
  193 + "name": "app",
  194 + "type": "u1",
  195 + "size": 1
  196 + },
  197 + {
  198 + "pad": 0,
  199 + "align": 1,
  200 + "name": "sys",
  201 + "type": "u1",
  202 + "size": 1
  203 + }
  204 + ]
  205 + },
  206 + "std:i2": {
  207 + "align": 2,
  208 + "size": 2
  209 + },
  210 + "std:i1": {
  211 + "align": 1,
  212 + "size": 1
  213 + },
  214 + "@emmoco.com.DUREX/BOOLEAN": {
  215 + "values": [
  216 + "TRUE",
  217 + "FALSE"
  218 + ],
  219 + "align": 1,
  220 + "type": "E:@emmoco.com.DUREX/BOOLEAN",
  221 + "size": 1
  222 + },
  223 + "std:u1": {
  224 + "align": 1,
  225 + "size": 1
  226 + },
  227 + "std:u2": {
  228 + "align": 2,
  229 + "size": 2
  230 + }
  231 + },
  232 + "resourceNamesApp": [
  233 + "clientBytesAvailable",
  234 + "clientData",
  235 + "clientMoreData",
  236 + "serverBytesAvailable",
  237 + "serverData",
  238 + "serverMoreData"
  239 + ],
  240 + "imports": {"@emmoco.com.DUREX": true}
  241 +}
0 \ No newline at end of file 242 \ No newline at end of file
DUREX/schema.ems 0 → 100644
  1 +++ a/DUREX/schema.ems
  1 +version = "1.0.0"
  2 +description = ""
  3 +
  4 +schema DUREX
  5 +{
  6 + enum BOOLEAN{ TRUE, FALSE };
  7 + typedef string<239> String; //MAXIMUM SIZE AVAILABLE
  8 +
  9 + uint8 serverBytesAvailable;
  10 + uint8 clientBytesAvailable;
  11 + String serverData;
  12 + String clientData;
  13 + BOOLEAN serverMoreData;
  14 + BOOLEAN clientMoreData;
  15 +}
FileTestLaunchPad/.externalToolBuilders/FileApp LaunchPad Cleaner.launch 0 → 100644
  1 +++ a/FileTestLaunchPad/.externalToolBuilders/FileApp LaunchPad Cleaner.launch
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
  3 +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
  4 +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
  5 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${eclipse_home}/msptools/bin/gmake${exe_ext}"/>
  6 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="clean"/>
  7 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="local-clean COMMON=${project_loc:/CommonLaunchPad}"/>
  8 +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
  9 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}"/>
  10 +</launchConfiguration>
FileTestLaunchPad/.externalToolBuilders/FileTest LaunchPad Builder.launch 0 → 100644
  1 +++ a/FileTestLaunchPad/.externalToolBuilders/FileTest LaunchPad Builder.launch
  1 +<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2 +<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
  3 +<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
  4 +<mapAttribute key="org.eclipse.debug.core.environmentVariables">
  5 +<mapEntry key="PATH" value="${eclipse_home}/msptools/bin${system_property:path.separator}${env_var:PATH}"/>
  6 +</mapAttribute>
  7 +<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
  8 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_BUILD_SCOPE" value="${working_set:&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;resources&gt;&#13;&#10;&lt;item path=&quot;/TesterLaunchPad/main.c&quot; type=&quot;1&quot;/&gt;&#13;&#10;&lt;item path=&quot;/TesterLaunchPad/main.out&quot; type=&quot;1&quot;/&gt;&#13;&#10;&lt;item path=&quot;/TesterLaunchPad/makefile&quot; type=&quot;1&quot;/&gt;&#13;&#10;&lt;item path=&quot;/TesterSchema/out/Tester.h&quot; type=&quot;1&quot;/&gt;&#13;&#10;&lt;item path=&quot;/TesterSchema/schema.ems&quot; type=&quot;1&quot;/&gt;&#13;&#10;&lt;item path=&quot;/CommonLaunchPad&quot; type=&quot;4&quot;/&gt;&#13;&#10;&lt;/resources&gt;}"/>
  9 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${eclipse_home}/msptools/bin/gmake${exe_ext}"/>
  10 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
  11 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="all COMMON=${project_loc:/CommonLaunchPad} SCHEMA=${project_loc:/FileTestSchema}"/>
  12 +<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
  13 +<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${project_loc}"/>
  14 +</launchConfiguration>
FileTestLaunchPad/.project 0 → 100644
  1 +++ a/FileTestLaunchPad/.project
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>FileTestLaunchPad</name>
  4 + <comment></comment>
  5 + <projects>
  6 + <project>MyAppSchema</project>
  7 + </projects>
  8 + <buildSpec>
  9 + <buildCommand>
  10 + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
  11 + <triggers>full,incremental,</triggers>
  12 + <arguments>
  13 + <dictionary>
  14 + <key>LaunchConfigHandle</key>
  15 + <value>&lt;project&gt;/.externalToolBuilders/FileTest LaunchPad Builder.launch</value>
  16 + </dictionary>
  17 + </arguments>
  18 + </buildCommand>
  19 + <buildCommand>
  20 + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
  21 + <triggers>clean,</triggers>
  22 + <arguments>
  23 + <dictionary>
  24 + <key>LaunchConfigHandle</key>
  25 + <value>&lt;project&gt;/.externalToolBuilders/FileApp LaunchPad Cleaner.launch</value>
  26 + </dictionary>
  27 + </arguments>
  28 + </buildCommand>
  29 + </buildSpec>
  30 + <natures>
  31 + <nature>com.emmoco.mcmtooling.example.mcmToolingExampleNature</nature>
  32 + </natures>
  33 +</projectDescription>
FileTestLaunchPad/Log/log.txt 0 → 100644
  1 +++ a/FileTestLaunchPad/Log/log.txt
FileTestLaunchPad/main.c 0 → 100644
  1 +++ a/FileTestLaunchPad/main.c
  1 +/*
  2 + * ============ Platform Configuration ============
  3 + */
  4 +
  5 +#include <msp430.h>
  6 +
  7 +#define EAP_RX_BUF UCA0RXBUF
  8 +#define EAP_TX_BUF UCA0TXBUF
  9 +
  10 +#define EAP_RX_VECTOR USCIAB0RX_VECTOR
  11 +#define EAP_TX_VECTOR PORT2_VECTOR
  12 +
  13 +#define EAP_RX_ACK_CONFIG() (P2DIR |= BIT0)
  14 +#define EAP_RX_ACK_SET() (P2OUT |= BIT0)
  15 +#define EAP_RX_ACK_CLR() (P2OUT &= ~BIT0)
  16 +
  17 +#define EAP_TX_INT_CONFIG() (P2DIR &= ~BIT1, P2IES |= BIT1, P2IFG &= BIT1, P2IE |= BIT1)
  18 +#define EAP_TX_INT_TST() (P2IFG & BIT1)
  19 +#define EAP_TX_INT_CLR() (P2IFG &= ~BIT1)
  20 +
  21 +void init(void) {
  22 +
  23 + WDTCTL = WDTPW + WDTHOLD;
  24 + BCSCTL2 = SELM_0 + DIVM_0 + DIVS_0;
  25 + if (CALBC1_1MHZ != 0xFF) {
  26 + DCOCTL = 0x00;
  27 + BCSCTL1 = CALBC1_1MHZ; /* Set DCO to 1MHz */
  28 + DCOCTL = CALDCO_1MHZ;
  29 + }
  30 + BCSCTL1 |= XT2OFF + DIVA_0;
  31 + BCSCTL3 = XT2S_0 + LFXT1S_2 + XCAP_1;
  32 +
  33 + P1DIR |= BIT0; /* LED */
  34 + P1OUT &= ~BIT0;
  35 +
  36 + UCA0CTL1 |= UCSWRST;
  37 +
  38 + P1SEL |= BIT1 + BIT2;
  39 + P1SEL2 |= BIT1 + BIT2;
  40 +
  41 + EAP_RX_ACK_CONFIG();
  42 + EAP_RX_ACK_SET();
  43 +
  44 + EAP_TX_INT_CONFIG();
  45 +
  46 + UCA0CTL1 = UCSSEL_2 + UCSWRST;
  47 + UCA0MCTL = UCBRF_0 + UCBRS_6;
  48 + UCA0BR0 = 8;
  49 + UCA0CTL1 &= ~UCSWRST;
  50 +
  51 + IFG2 &= ~(UCA0RXIFG);
  52 + IE2 |= UCA0RXIE;
  53 +
  54 + __enable_interrupt();
  55 +}
  56 +
  57 +/*
  58 + * ============ Serial Driver ============
  59 + */
  60 +
  61 +#include <Em_Message.h>
  62 +
  63 +__attribute__((interrupt(EAP_RX_VECTOR)))
  64 +static void rxHandler(void) {
  65 + uint8_t b = EAP_RX_BUF;
  66 + if (Em_Message_addByte(b)) {
  67 + Em_Message_dispatch();
  68 + }
  69 + EAP_RX_ACK_CLR();
  70 + EAP_RX_ACK_SET();
  71 +}
  72 +
  73 +__attribute__((interrupt(EAP_TX_VECTOR)))
  74 +static void txHandler(void) {
  75 + if (EAP_TX_INT_TST()) {
  76 + uint8_t b;
  77 + if (Em_Message_getByte(&b)) {
  78 + EAP_TX_BUF = b;
  79 + }
  80 + EAP_TX_INT_CLR();
  81 + }
  82 +}
  83 +
  84 +void Em_Message_startSend() {
  85 + uint8_t b;
  86 + if (Em_Message_getByte(&b)) {
  87 + UCA0TXBUF = b;
  88 + }
  89 +}
  90 +
  91 +uint8_t Em_Message_lock() {
  92 + uint8_t key;
  93 + asm ("MOV r2, %0": "=r" (key));
  94 + key &= 0x8;
  95 + asm ("DINT");
  96 + return key;
  97 +}
  98 +
  99 +void Em_Message_unlock(uint8_t key) {
  100 + if (key) {
  101 + asm ("EINT");
  102 + }
  103 + else {
  104 + asm ("DINT");
  105 + }
  106 +}
  107 +
  108 +/*
  109 + * ============ Application Program ============
  110 + */
  111 +
  112 +#include <FileTest.h>
  113 +
  114 +int main(int argc, char *argv[]) {
  115 + volatile int dummy = 0;
  116 + init();
  117 + FileTest_run();
  118 + while (dummy == 0) {
  119 + /* idle */
  120 + }
  121 + return 0;
  122 +}
  123 +
  124 +FileTest_fileSize_t fileSizeVal;
  125 +int seed;
  126 +
  127 +void FileTest_connectHandler(void) {
  128 + P1OUT |= BIT0;
  129 +}
  130 +
  131 +void FileTest_disconnectHandler(void) {
  132 + P1OUT &= ~BIT0;
  133 +}
  134 +
  135 +void FileTest_fileSize_fetch(FileTest_fileSize_t* const output) {
  136 + *output = fileSizeVal;
  137 +}
  138 +
  139 +void FileTest_fileSize_store(FileTest_fileSize_t* const input)
  140 +{
  141 + fileSizeVal = *input;
  142 +}
  143 +
  144 +uint16_t FileTest_fileData_fetch(FileTest_fileData_t* const output, int32_t offset, uint16_t count) {
  145 + int32_t rem = fileSizeVal - offset;
  146 + if (rem < count) {
  147 + count = (uint16_t)rem;
  148 + }
  149 + uint16_t i;
  150 + for (i = 0; i < count; i++) {
  151 + output->elems[i] = (seed + (offset + i)) & 0xFF;
  152 + }
  153 + return count;
  154 +}
  155 +
  156 +uint16_t FileTest_fileData_store(FileTest_fileData_t* const input, int32_t offset, uint16_t count) {
  157 + if (offset == 0 && count) {
  158 + seed = input->elems[0];
  159 + }
  160 + return count;
  161 +}
0 \ No newline at end of file 162 \ No newline at end of file
FileTestLaunchPad/makefile 0 → 100644
  1 +++ a/FileTestLaunchPad/makefile
  1 +EMSNAME = FileTest
  2 +
  3 +COMMON = ../../../Common/Embedded/LaunchPad
  4 +SCHEMA = ../../Schema
  5 +
  6 +OBJECTS = main.obj $(EMSNAME).obj
  7 +
  8 +include $(COMMON)/rules.mk
FileTestSchema/.gitignore 0 → 100644
  1 +++ a/FileTestSchema/.gitignore
  1 +/imports
FileTestSchema/.project 0 → 100644
  1 +++ a/FileTestSchema/.project
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>FileTestSchema</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>com.emmoco.mcmtooling.core.mcmToolingBuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + </buildSpec>
  14 + <natures>
  15 + <nature>com.emmoco.mcmtooling.core.mcmToolingNature</nature>
  16 + </natures>
  17 +</projectDescription>
FileTestSchema/bundle.properties 0 → 100644
  1 +++ a/FileTestSchema/bundle.properties
  1 +# generated file - do not edit
  2 +
  3 +bundle.requires = com.emmoco.schema.translator
  4 +com.emmoco.framework.Properties.applicationDirectory = out
  5 +com.emmoco.framework.Properties.schemaDestinationDirectory = out
  6 +com.emmoco.framework.Properties.serverAPIToken =
  7 +com.emmoco.framework.Properties.align16 = 2
  8 +com.emmoco.framework.Properties.align32 = 4
  9 +com.emmoco.framework.Properties.schemaFile = /Users/imanol/devel/emmoco/FileTestSchema/schema.ems
  10 +com.emmoco.framework.Properties.toolVersion = 12.0.0.201211010336
FileTestSchema/imports/system@emmoco.com/System.ems 0 → 100644
  1 +++ a/FileTestSchema/imports/system@emmoco.com/System.ems
  1 +owner = "system@emmoco.com"
  2 +
  3 +schema System {
  4 +
  5 + // protocolLevel #1
  6 +
  7 + uint8 $schemaUuid[16] { // protocolLevel #10 -- invisible to applications
  8 + readonly
  9 + }
  10 +
  11 + uint16 $mcmProtocolLevel {
  12 + readonly
  13 + }
  14 +
  15 + uint16 $eapProtocolLevel {
  16 + readonly
  17 + }
  18 +
  19 + uint8 $eapBuildDate[8] { // protocolLevel #5 -- rename from $eapBuildNumber
  20 + readonly
  21 + }
  22 +
  23 + // protocolLevel #2
  24 +
  25 + int16 $fileIndexReset {
  26 + writeonly
  27 + }
  28 +
  29 + // protocolLevel #5
  30 +
  31 + // protocolLevel #12 -- increase size to 20
  32 +
  33 + uint8 $schemaHash[20] {
  34 + readonly
  35 + }
  36 +
  37 + // protocolLevel #7
  38 +
  39 + struct ResourceCount {
  40 + uint8 app
  41 + uint8 sys
  42 + }
  43 +
  44 + ResourceCount $resourceCount {
  45 + readonly
  46 + }
  47 +
  48 + // protocolLevel #9
  49 +
  50 + int8 $mobileRssi {
  51 + readonly
  52 + }
  53 +
  54 + // protocolLevel #11
  55 +
  56 + uint8 $mcmDisconnect {
  57 + writeonly
  58 + }
  59 +
  60 +}
FileTestSchema/out/Em_Message.h 0 → 100644
  1 +++ a/FileTestSchema/out/Em_Message.h
  1 +#ifndef Em_Message_H_
  2 +#define Em_Message_H_
  3 +
  4 +#include "Em_Types.h"
  5 +
  6 +#ifdef __cplusplus
  7 +extern "C" {
  8 +#endif
  9 +
  10 +/* protocolLevel #4 */
  11 +#define Em_Message_INDSIZE 4
  12 +
  13 +typedef uint8_t Em_Message_Size;
  14 +typedef uint8_t Em_Message_Kind;
  15 +/* protocolLevel #12 -- split 16-bit resId into <resId, chan> */
  16 +typedef int8_t Em_Message_ResId;
  17 +typedef uint8_t Em_Message_Chan;
  18 +
  19 +#define Em_Message_NOP 0
  20 +#define Em_Message_FETCH 1
  21 +#define Em_Message_FETCH_DONE 2
  22 +#define Em_Message_STORE 3
  23 +#define Em_Message_STORE_DONE 4
  24 +#define Em_Message_INDICATOR 5
  25 +#define Em_Message_CONNECT 6
  26 +#define Em_Message_DISCONNECT 7
  27 +#define Em_Message_ECHO 8
  28 +/* protocolLevel #3 */
  29 +/* protocolLevel #6 -- rename from BROADCAST to PAIRING */
  30 +#define Em_Message_PAIRING 9
  31 +#define Em_Message_PAIRING_DONE 10
  32 +/* protocolLevel #7 */
  33 +#define Em_Message_OFFLINE 11
  34 +/* protocolLevel #8 */
  35 +#define Em_Message_ACCEPT 12
  36 +
  37 +typedef struct Em_Message_Header {
  38 + Em_Message_Size size;
  39 + Em_Message_Kind kind;
  40 + Em_Message_ResId resId;
  41 + Em_Message_Chan chan;
  42 +} Em_Message_Header;
  43 +
  44 +typedef uint16_t Em_Message_protocolLevel_t;
  45 +
  46 +/* protocolLevel #1 */
  47 +
  48 +/* protocolLevel #10 */
  49 +/* #define Em_Message_SYS_SCHEMA_UUID -1 */
  50 +
  51 +#define Em_Message_SYS_MCM_PROTOCOL_LEVEL -2
  52 +#define Em_Message_SYS_EAP_PROTOCOL_LEVEL -3
  53 +#define Em_Message_SYS_EAP_BUILD_DATE -4
  54 +
  55 +/* protocolLevel #2 */
  56 +#define Em_Message_SYS_FILE_INDEX_RESET -5
  57 +
  58 +/* protocolLevel #5 */
  59 +#define Em_Message_SYS_SCHEMA_HASH -6
  60 +
  61 +/* protocolLevel #7 */
  62 +#define Em_Message_SYS_RESOURCE_COUNT -7
  63 +
  64 +/* protocolLevel #9 */
  65 +#define Em_Message_SYS_MOBILE_RSSI -8
  66 +
  67 +/* protocolLevel #11 */
  68 +#define Em_Message_SYS_MCM_DISCONNECT -9
  69 +
  70 +extern void Em_Message_init(void);
  71 +
  72 +extern bool Em_Message_addByte(uint8_t b);
  73 +extern void Em_Message_dispatch(void);
  74 +extern bool Em_Message_getByte(uint8_t *bp);
  75 +extern uint8_t Em_Message_lock(void);
  76 +extern void Em_Message_startSend(void);
  77 +extern void Em_Message_unlock(uint8_t key);
  78 +
  79 +#ifdef __cplusplus
  80 +}
  81 +#endif
  82 +
  83 +#endif /*Em_Message_H_*/
FileTestSchema/out/Em_Types.h 0 → 100644
  1 +++ a/FileTestSchema/out/Em_Types.h
  1 +#ifndef Em_Types_H_
  2 +#define Em_Types_H_
  3 +
  4 +#ifndef EM_NOSTDBOOL
  5 +#include <stdbool.h>
  6 +#endif
  7 +
  8 +#ifndef EM_NOSTDINT
  9 +#include <stdint.h>
  10 +#endif
  11 +
  12 +#endif /*Em_Types_H_*/
FileTestSchema/out/FileTest-TODO.c 0 → 100644
  1 +++ a/FileTestSchema/out/FileTest-TODO.c
  1 +/**** DO NOT EDIT -- this file has been automatically generated from @emmoco.com.FileTest on 2014-05-09T14:33:36T ****/
  2 +/**** protocolLevel = 12, toolsVersion = 12.0.0.201211010336 ****/
  3 +
  4 +#include "FileTest.h"
  5 +
  6 +#ifdef Em_FileTest_TODO /* enables optional inclusion of empty functions */
  7 +
  8 +/* Copy the function skeletons below into your own FileTest.c source file */
  9 +
  10 +void FileTest_connectHandler(void) {
  11 + /* TODO: application is now connected */
  12 +}
  13 +
  14 +void FileTest_disconnectHandler(void) {
  15 + /* TODO: application is now disconnected */
  16 +}
  17 +
  18 +void FileTest_fileSize_fetch(FileTest_fileSize_t* const output) {
  19 + /* TODO: write resource 'fileSize' into 'output' */
  20 +}
  21 +
  22 +void FileTest_fileSize_store(FileTest_fileSize_t* const input) {
  23 + /* TODO: read resource 'fileSize' from 'input' */
  24 +}
  25 +
  26 +uint16_t FileTest_fileData_fetch(FileTest_fileData_t* const output, int32_t offset, uint16_t count) {
  27 + /* TODO: write resource 'fileData' into 'output' */
  28 + return 0;
  29 +}
  30 +
  31 +uint16_t FileTest_fileData_store(FileTest_fileData_t* const input, int32_t offset, uint16_t count) {
  32 + /* TODO: read resource 'fileData' from 'input' */
  33 + return 0;
  34 +}
  35 +
  36 +#endif /* dummy file */