SlideShare uma empresa Scribd logo
1 de 83
Building Client Apps with C# and Xamarin
Why Xamarin ? Build Once works universally across platforms on billions of devices..
Basic Hardware –OBD-II Port Connectivity
An ODB-II Elm 327 type interface (connected to
USB, Bluetooth or wi-fi) on your smart phone or
tablet connected to the diagnostic port below your
steering wheel, or broadband in your newer
vehicle. Newer vehicles now have optional
broadband in-vehicle.
Visual Studio Community Edition
Free IDE (Integrated Development Environment) for PCs Integrates with Xamarin for iOS,
Android and Mac Development.. Xamarin is free for students and affordable for Indy Developers
Polling Data From OBD-II
Your Xamarin Studio or Visual Studio project will need you to install an OBD manager to
communicate with your vehicle’s network of diagnostic codes.. I suggest installing the OBD-II
manager from Microsoft’s Coding for Fun Channel 9 Project.. You can integrate this easily in your
app using either Xamarin Studio or Visual Studio’s NuGet Package Manager also available from
the NuGet gallery..
Microsoft’s Project Detroit
Communicating with the OBD-II Port
OBD-II stands for On-Board Diagnostics. Connecting to this port allows us to query for
different types of data from the car. We can get the current speed, RPMs, fuel level,
etc. for display in the Instrument Cluster and other locations.
For the vehicle, because only one application can open and communicate with a serial
port at one time, we created a WCF service that polls the OBD-II data from the car and
GPS and returns it to our application when it queries the service.
For the OBD library a manual connection will be used to poll different values at
different intervals. For values critical to driving the car—like RPM, speed, etc, it is
necessary to poll for the values as quickly as the vehicle can return them. With other
values which aren’t critical to driving the car—like the fuel level, engine coolant
temperature, can be polled at a 1-2 second interval. For GPS, we can create a code to
read the GPS and create a LocationChanged event, which would fire when the GPS
values changed.
Rather than creating a new serial port connection for every WCF request for OBD data,
it’s important to use a singleton service that is instantiated when the service first runs.
Only one object in the WCF service that represents the last OBD and GPS data
returned, which is obtained by the continual reading of the latest OBD data using the
OBD library as described above. Calls to a WCF service ReadMeasurement method
didn’t actually compute anything, but instead serializes the last saved data and
returned it via the WCF service.
Instantiating the OBD Service
_service = new ObdService();
_service.ObdMeasurementChanged += service_ObdMeasurementChanged;
_service.Start(new TimeSpan(0, 0, 0, 0, 1000), localhost, Protocol.Http,
false);
void service_ObdMeasurementChanged(object sender,
ObdMeasurementChangedEventArgs e)
{
Debug.Writeline("MPH=” + e.Measurement.MilesPerHour);
}
This code creates a new ObdService class and signs up for an event when the measurement has changed. The Start method does the
following:
• Set the interval that you want to poll the ObdService, in this case every second (to update the instrument cluster).
• Determines what IP address the service is hosted at (localhost), the protocol (HTTP or TCP), and whether to send “demo mode” data.
So we can have some sample data for testing.
To capture the car telemetry data like MPH, RPM, engine load, and throttle (accelerator) position, as well as location data (latitude, longitude,
altitude, and course), we used a SQL database with a flat Entity Framework model.
• The primary key, the ObdMeasurementID is a GUID that is returned via the ObdService.
• The database logger subscribes to the ObdMeasurementChanged event and receives a new reading at the time interval set in the Start()
method.
Instantiating the OBD Service
public override string RowKey
{
get { return new DateTimeOffset(TimeStamp).ToEndOfDays(); }
set { }
}
public static class DateTimeExtensions
{ public static string ToEndOfDays(this DateTimeOffset source)
{ TimeSpan timeUntilTheEnd = DateTimeOffset.MaxValue.Subtract(source);
return timeUntilTheEnd.Ticks.ToString();
}
public static DateTimeOffset FromEndOfDays(this String daysToEnd)
{ TimeSpan timeFromTheEnd = newTimeSpan(Int64.Parse(daysToEnd));
DateTimeOffset source = DateTimeOffset.MaxValue.Date.Subtract(timeFromTheEnd);
return source;
}
}
The Windows Azure data model uses Azure Table Services instead of SQL Server. The data mapping is essentially the same since both have a
flat schema.
For Azure Table Storage, in addition to the schema above, you also need a partition key and a row key. For the partition key, we used a
custom TripID (GUID) to represent a Trip. When the car is turned on/off a new TripID is created. That way we could group all measurements
for that particular trip and do calculations based on that trip, like the average miles per gallon, distance traveled, fastest speed, etc. For the
row key, we used a DateTimeOffset and a custom extension method, ToEndOfDays() that provides a unique numerical string (since Azure's
row key is a string type) that subtracts the time from the DateTime.Max value. The result is that the earlier a DateTime value, the larger the
number.
Example:
Time=5/11/2012 9:14:09 AM, EndOfDays=2520655479509478223 //larger
Time=5/11/2012 9:14:11 AM, EndOfDays=2520655479482804811 //smaller
Since they are ordered in reverse order, with the most recent date/time being the first row, we can write an efficient query to pull just the
first row to get the current latitude/longitude without needing to scan the entire table for the last measurement.
Instantiating the OBD Service
public ActionResult PostData()
{
try
{
StreamReader incomingData = new StreamReader(HttpContext.Request.InputStream);
string data = incomingData.ReadToEnd();
JavaScriptSerializer oSerializer = new JavaScriptSerializer();
List<MeasurementForTransfer> measurements;
measurements = oSerializer.Deserialize(data, typeof(List<MeasurementForTransfer>)) as
List<MeasurementForTransfer>;
if (measurements != null) {
CloudBlob blob = _blob.UploadStringToIncoming(data);
_queue.PushMessageToPostQueue(blob.Uri.ToString());
return new HttpStatusCodeResult(200);
}
}}
To upload data to Azure, we used a timer-based background uploader that would check to see if there was an internet connection, and then
filter and upload all of the local SQL rows that had not been submitted to Azure using the Submitted boolean database field. On the Azure
side, we used an ASP.NET MVC controller to submit data. The controller deserializes the data into a List<MeasurementForTransfer> type, it
adds the data to a blob, and adds the blob to a queue.
A worker role (or many) will then read items off the queue and the new OBD measurement rows are placed into Azure Table Storage.
Xamarin already has App Store Apps for OBD-II
Xamarin is already popular among App Store Developers
Matt O’Connor from OCTech, and creator of OBD Fusion, shared his app
that wirelessly reads onboard vehicle diagnostics from a car. The app
enables car enthusiasts to create their own dashboards and access much of
the same diagnostic information a master mechanic would use with
specialized automotive equipment to diagnose and tune an automobile.
With OBD Fusion, users can calculate fuel economy, graph data, and also
test emissions in real-time.
Matt originally created his app in C# as a desktop application. Utilizing
Xamarin, he was able to convert it to iOS and Android with over 90% code-
reuse, and by using app templates he’s created native smartphone and
tablet user experiences. In addition to the automobile’s sensor data, he’s
also integrated sensors on the mobile device, including the GPS and
accelerometer to measure position and vehicle acceleration.
https://www.youtube.com/watch?v=Sd3N8zrD7qs
Client App (Tablet Dashboards)
Starting Point
http://obd.codeplex.com/
Creating a OBD-II Client Dashboard
Creating a dashboard is a lot like
game programming, to move the
needle updates at reasonable speed
the code needs to be setup as a
game loop as you are seeing here in
C Sharp for their XAML interface..
To do this in Xamarin, we can use
monogame.
Creating a OBD-II Client Dashboard
using System;
using System.Windows.Controls;
using System.Windows;
using System.Windows.Media;
using System.ComponentModel;
using System.Windows.Media.Animation;
namespace Coding4Fun.Obd.InstrumentCluster.Classes
{
public class Needle : UserControl
{
private const double SLOWNESS = 5;
Storyboard uxSB_GameLoop;
FrameworkElement uxNeedle;
public RotateTransform Needle_RotateTransform = new RotateTransform();
public TransformGroup tg = new TransformGroup();
private double desiredAngle;
public Needle()
{
Loaded += new System.Windows.RoutedEventHandler(Needle_Loaded);
Initialized += new EventHandler(Needle_Initialized);
}
void Needle_Initialized(object sender, EventArgs e)
{
uxNeedle = (FrameworkElement)FindName("uxNeedle");
uxSB_GameLoop = (Storyboard)TryFindResource("uxSB_GameLoop");
}
void Needle_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
if (uxNeedle != null) uxNeedle.RenderTransform = Needle_RotateTransform;
if (uxSB_GameLoop != null)
{
uxSB_GameLoop.Completed += new
EventHandler(uxSB_GameLoop_Completed);
uxSB_GameLoop.Begin();
}}
void uxSB_GameLoop_Completed(object sender, EventArgs e)
{
Needle_RotateTransform.Angle += (desiredAngle -
Needle_RotateTransform.Angle) / Math.Max(SLOWNESS, 1);
uxSB_GameLoop.Begin();
}
public void UpdateNeedle()
{
desiredAngle = Maximum == Minimum ? Maximum : MinAngle + (MaxAngle -
MinAngle) * (Math.Min(Math.Max(Value, Minimum), Maximum) - Minimum) /
(Maximum - Minimum);
if (uxSB_GameLoop == null)
{
Needle_RotateTransform.Angle = desiredAngle;
}
}
private static void OnValuesChanged(DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
Needle ln = (Needle)d;
ln.UpdateNeedle();
}
[Category("Common Properties")]
public double Value
{
get { return (double)GetValue(ValueProperty); }
set { SetValue(ValueProperty, value); }
}
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(double), typeof(Needle), new
PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged)));
[Category("Common Properties")]
public double Minimum
{
get { return (double)GetValue(MinimumProperty); }
set { SetValue(MinimumProperty, value); }
}
public static readonly DependencyProperty MinimumProperty =
DependencyProperty.Register("Minimum", typeof(double), typeof(Needle), new
PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged)));
[Category("Common Properties")]
public double Maximum
{
get { return (double)GetValue(MaximumProperty); }
set { SetValue(MaximumProperty, value); }
}
public static readonly DependencyProperty MaximumProperty =
DependencyProperty.Register("Maximum", typeof(double), typeof(Needle), new
PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged)));
[Category("Common Properties")]
public double MinAngle
{
get { return (double)GetValue(MinAngleProperty); }
set { SetValue(MinAngleProperty, value); }
}
public static readonly DependencyProperty MinAngleProperty =
DependencyProperty.Register("MinAngle", typeof(double), typeof(Needle), new
PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged)));
[Category("Common Properties")]
public double MaxAngle
{
get { return (double)GetValue(MaxAngleProperty); }
set { SetValue(MaxAngleProperty, value); }
}
public static readonly DependencyProperty MaxAngleProperty =
DependencyProperty.Register("MaxAngle", typeof(double), typeof(Needle), new
PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged)));
}}
Real-time Sensor Data Networks with HDInsight and Apache Storm
Creating a sensor data network that we can use with our Xamarin App
Apache Storm and Real-Time Sensor Networks
Data Capture in Real-Time
What is Apache Storm ?
What you need to get started
1. An Azure subscription with HDInsight and Apache
Storm (in beta) Active
2. Visual Studio with the Microsoft Azure SDK for .NET
3. Java and JDK
4. Maven
5. Git
6. Source Code for the Sample Project
http://azure.microsoft.com/en-
us/documentation/articles/hdinsight-storm-sensor-
data-analysis/
https://github.com/Blackmist/hdinsight-eventhub-
example
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Creating the Dashboard
The dashboard is used to display near-real time sensor information. In this case, the dashboard
is an ASP.NET application hosted in an Azure Website. The application's primary purpose is to
serve as a SignalR hub that receives information from the Storm topology as it processes
messages.
The website also contains a static index.html file, which also connects to SignalR, and uses D3.js
to graph the data transmitted by the Storm topology.
NOTE: While you could also use raw WebSockets instead of SignalR, WebSockets does not
provide a built-in scaling mechanism if you need to scale out the web site. SignalR can be scaled
using Azure Service Bus (http://www.asp.net/signalr/overview/performance/scaleout-with-
windows-azure-service-bus).
For an example of using a Storm topology to communicate with a Python website using raw
WebSockets, see the Storm Tweet Sentiment D3 Visualization project.
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Creating the Dashboard
The dashboard is used to display near-real time sensor information. In this case, the dashboard is an ASP.NET
application hosted in an Azure Website. The application's primary purpose is to serve as a SignalR hub that receives
information from the Storm topology as it processes messages.
The website also contains a static index.html file, which also connects to SignalR, and uses D3.js to graph the data
transmitted by the Storm topology.
NOTE: While you could also use raw WebSockets instead of SignalR, WebSockets does not provide a built-in scaling
mechanism if you need to scale out the web site. SignalR can be scaled using Azure Service Bus
(http://www.asp.net/signalr/overview/performance/scaleout-with-windows-azure-service-bus).
For an example of using a Storm topology to communicate with a Python website using raw WebSockets, see the
Storm Tweet Sentiment D3 Visualization project.
1.In Visual Studio, create a new C# application using the ASP.NET Web Application project template. Name the new
application Dashboard.
2.In the New ASP.NET Project window, select the Empty application template. In the Windows Azure section, select
Host in the cloud and Web site. Finally, click Ok
NOTE: If prompted, sign in to your Azure subscription.
3.In the Configure Windows Azure Site dialog, enter a Site name and Region for your web site, then click OK. This will
create the Azure Website that will host the dashboard.
4.In Solution Explorer, right-click the project and then select Add | SignalR Hub Class (v2). Name the class DashHub.cs
and add it to the project. This will contain the SignalR hub that is used to communicate data between HDInsight and
the dashboard web page.
DashHub.cs
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Creating the Dashboard
Startup.cs
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Creating the Dashboard
Next Steps
• In Solution Explorer, right-click
the project and then click Add
| HTML Page. Name the new
page index.html. This page will
contain the realtime
dashboard for this project. It
will receive information from
DashHub and display a graph
using D3.js.
• In Solution Explorer, right-click
on index.html and select Set as
Start Page.
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Creating the Dashboard
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Creating the Dashboard
Next Steps
• In Solution Explorer, right-click the project and click Add | HTML Page.
• Name the new page test.html. This page can be used to test DashHub and the dashboard
by sending and receiving messages. Save All for the project.
• In Solution Explorer, right-click on the Dashboard project and select Publish. Select the
website you created for this project, then click Publish.
• Once the site has been published, a web page should open displaying a moving timeline.
Test the dashboard
To verify that SignalR is working, and that the dashboard will display graph lines for data sent to
SignalR, open a new browser window to the test.html page on this website. For example,
http://sensordash.azurewebsites.net/test.html.
The dashboard expects JSON formatted data, with a device id and temperature value. For
example {"device":0, "temperature":80}. Enter some test values on the test.html page, using
device IDs 0 through 9, while the dashboard is open in another page. Note that the lines for
each device ID are drawn using a different color.
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Configuring the Azure Event Hub
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Sending Messages to the Event Hub
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Building and
Scaffolding
Program.cs http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Program.cs
For now, you will receive a warning on lines that
reference the Event class. Ignore these for now.
In the Program.cs file, set the value of the following
variables at the beginning of the file to the
corresponding values retrieved from your Event Hub in
the Azure Management Portal.
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Program.cs
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Program.cs
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Program.cs
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Setting up your
cluster and
virtual network
Creating your network..
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Setting up your cluster and virtual
network
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Setting up your
cluster and
virtual network
Creating your network..
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Setting up your
cluster and
virtual network
Creating your network..
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Enabling
Real-Time
Communication
Enabling
Real-Time
Communication
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Enabling
Real-Time
Communication
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Enabling
Real-Time
Communication
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Enabling
Real-Time
Communication
This tells Maven to do the following
when building the project:
Include the /conf/Config.properties
resource file. This file will be created
later, but it will contain configuration
information for connecting to Azure
Event Hub.
Include the /conf/hbase-site.xml
resource file. This file will be created
later, but it will contain information on
how to connect to HBase
Use the maven-compiler-plugin to
compile the application.
Use the maven-shade-plugin to build an
uberjar or fat jar, which contains this
project and any required dependencies.
Use the exec-maven-plugin, which
allows you to run the application locally
without a Hadoop cluster.
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Adding
Configuration
Files
Scaffolding
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Adding
Configuration
Files
Scaffolding
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Adding
Configuration
Files
Scaffolding
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Adding
Configuration
Files
Scaffolding
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Adding Configuration Files
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Topology
Dataflows
http://azure.
microsoft.com
/en-
us/documenta
tion/articles/h
dinsight-
storm-sensor-
data-analysis/
Topology
Dataflows
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Topology
Dataflows
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
Topology
Dataflows
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-
storm-sensor-data-analysis/
Topology
Dataflows
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-
storm-sensor-data-analysis/
Topology
Dataflows
Summary
You have now learned how to use Storm to read data from
Event Hub, store data in HBase, and display information from
Storm on an external dashboard using SignalR and D3.js.
•For more information on Apache Storm, see
https://storm.incubator.apache.org/
•For more information on HBase with HDInsight, see the HBase
with HDInsight Overview
•For more information on SignalR, see ASP.NET SignalR
•For more information on D3.js, see D3.js - Data Driven
Documents
•For information on creating topologies in .NET, see Develop
streaming data processing applications with SCP.NET and C# on
Storm in HDInsight
http://azure.microsoft.com/en-us/documentation/articles/hdinsight-
storm-sensor-data-analysis/
SendEvents
Pushing Data to
Azure HDInsight
and Apache Storm
Our Example running pushing
temperature data
CONNECTING TO REAL-TIME VEHICLE DATA AND MODELING IN THE LAB
Azure Mobile Services for Unity 3D
The Azure Mobile Services have a free tier that includes up to 500 devices as well as 500k API calls and you can also
use the free tier for up to 10 services. This means that you can test out a few things without having to pay for it.
Azure Mobile Services
Azure Mobile Services is a part of Azure that allows access to a database and has connection and sample code to talk
to any mobile system that is out there. This will provide you with the code or library to do the connection to Android,
iOS, Windows 8, Windows Phone, HTML5/JavaScript, or even the Xamarin libraries. To get started, if you do not have
any Mobile Services defined yet you can click on the Mobile Services tab on the left and then the Create a New
Mobile Service link next to it. You can also click on the New option on the bottom the of the screen and select
Compute -> Mobile Service -> Create.
From here, you will get a popup to fill in to finish up the creation. The first field is the name of the Mobile
Service. This name will also be the address for the service. It must be unique. For this example, I named mine
“unityleaderboard”. The next field is the database to use as a back end for the service. You can choice from “Use an
existing SQL database“, “Create a free 20 MB SQL database“, or “Create a new SQL database instance“.
Azure Mobile Services for Unity 3D
Azure Mobile Services for Unity 3D
So up to now we have the Mobile Service setup, but
there is no data yet. Go into your new Mobile Service
and then click on the Data link at the top. You can now
add a new Table to the database that was setup earlier.
Azure Mobile Services for Unity 3D
The next step is to add the data fields to the new leaderboard table. This will allow
us to save the data for the UserName and the Score that is saved. This is going to
be a basic sample and not an optimized database, so I will be adding the UserName
as just a string field to the table. If this was a bigger system supporting multiple
games, I would probably make a Player table with all of the players info there and
then a leaderboard table that cross referenced that player table. Since this is just a
quick and simple leaderboard for a single game, keeping the raw text in the table is
not that bad. The Score field is going to be added as a Number so that we do not
have to change the numbers of the score into a text field back and forth. After
clicking on the table name, you will see and can click on the Columns link to get to
add new columns. To add a new column, use the Add Column link at the bottom of
the page.
Bitrave Mobile Services Plugin API
https://github.com/bitrave/azure-mobile-services-for-unity3d
Bitrave Mobile Services Plugin API
Put the plugin binaries in your Assets/Plugins folder. These get built into an Output folder in the
root of the solution in the right folder structure. And it’s as simple as…
var data = new LevelSaveData() { SaveData = "some data here", Id = 1 };
var azure = new AzureMobileServices(_azureEndPoint, _applicationKey);
azure.Update<LevelSaveData>(data);
or
var azure = new AzureMobileServices(_azureEndPoint, _applicationKey);
azure.Lookup<LevelSaveData>(1, azureResponse =>
{
if (azureResponse.Status == AzureResponseStatus.Success)
{ var ourObject = azureReponse.ResponseData; }}
Data comes back via callbacks and response objects. Unity doesn’t support await/async, but when
it does it will move to that model.
Bitrave Mobile Services Plugin API
API
Initialize
initialiation is just as simple as you’d expect.
var service = new AzureMobileServices(“url”, “token”);
Insert
Insert an item into your Azure database in a single line of code from Unity.
service.Insert<ToDoItem>(myItem);
Update
Update items in the Azure databsae with just one line of code from Unity.
service.Update<ToDoItem>(myItem);
Delete
Remove items from the Azure database in 1 line of code from Unity.
service.Delete<ToDoItem>(myItem);
Query
Query items in your Azure Mobile Services from Unity.
service.Where<ToDoItem>(p => p.Category == “Exercise”, azureResponse =>{List<ToDoItem> exerciseItems = azureRepsonse.ResponseData;
NOTE: await / async will be available when supported by Unity. Until then we are using callbacks.
Lookup
Lookup items in your Azure Mobile Services from Unity.
service.Lookup<ToDoItem>(myItem, azureResponse =>{ToDoItem myToDoItem = azureResponse.ResponseData;
NOTE: await / async will be available when supported by Unity. Until then we are using callbacks.
Login
On supported platforms, LoginAsync can be called for authenticated services.
azure.LoginAsync(AuthenticationProvider.Facebook, loginResponse => {var token = loginResponse.ResponseData.MobileServiceAuthenticationToken;});
NOTE: await / async will be available when supported by Unity. Until then we are using callbacks.
Bitrave Mobile Services Plugin API
API
Initialize
initialiation is just as simple as you’d expect.
var service = new AzureMobileServices(“url”, “token”);
Insert
Insert an item into your Azure database in a single line of code from Unity.
service.Insert<ToDoItem>(myItem);
Update
Update items in the Azure databsae with just one line of code from Unity.
service.Update<ToDoItem>(myItem);
Delete
Remove items from the Azure database in 1 line of code from Unity.
service.Delete<ToDoItem>(myItem);
Query
Query items in your Azure Mobile Services from Unity.
service.Where<ToDoItem>(p => p.Category == “Exercise”, azureResponse =>{List<ToDoItem> exerciseItems = azureRepsonse.ResponseData;
NOTE: await / async will be available when supported by Unity. Until then we are using callbacks.
Lookup
Lookup items in your Azure Mobile Services from Unity.
service.Lookup<ToDoItem>(myItem, azureResponse =>{ToDoItem myToDoItem = azureResponse.ResponseData;
NOTE: await / async will be available when supported by Unity. Until then we are using callbacks.
Login
On supported platforms, LoginAsync can be called for authenticated services.
azure.LoginAsync(AuthenticationProvider.Facebook, loginResponse => {var token =
loginResponse.ResponseData.MobileServiceAuthenticationToken;});
NOTE: await / async will be available when supported by Unity. Until then we are using callbacks.
MapNav Plug-In Unity 3D
https://www.assetstore.unity3d.com/en/#!/content/13153
MapNav Plug-In Unity 3D
https://www.assetstore.unity3d.com/en/#!/content/13153
Prime 31 Plug-in for Unity
Prime 31 Plug-in for Unity
Sign-in to Azure portal. If you don’t have an Azure account yet game developers can register for
the Cloud GameDev Offer. Create Azure Mobile Service
Prime 31 Plug-in for Unity
Sign-in to Azure portal. If you don’t have an Azure account yet game developers can register for
the Cloud GameDev Offer. Create Azure Mobile Service
Add a Demo To-Do Table
Get the Plug-in
https://prime31.com/plugins
Get the Plug-ins you need to install
https://prime31.com/plugins
Create a New Project and Install the Plug-in
Import the Plug-In Scene
Open the MetroAzure Scene
Open MetroAzureDemoUI.cs
Paste in your Azure Connection Strings
Target Windows Store In your program settings
• “Add Current”
scene
• Select “Windows
Store” and “Switch
Platform”
• Select C# Solution
and SDK “8.1”
Select Player Settings
Under “Metro
Unprocessed Plugins” set:
Size: 1
Element 0:
P31MetroAzure.dll
Click Build
Launch Visual Studio Open Windows Store Build
Open Package.AppXManifest.xml
Add Internet Capabilities to Manifest
Open Configuration Manager Target Current Hardware
Build and Run
You will see your items in Azure
Connecting to Vehicle Data Near Real-Time in the Cloud
The WCC Connected Pontiac G6
Modeled and Connected to Real-
Time Vehicle Data..

Mais conteúdo relacionado

Destaque

Introduction to the connected vehicle imsa 2015 annual conference
Introduction to the connected vehicle   imsa 2015 annual conferenceIntroduction to the connected vehicle   imsa 2015 annual conference
Introduction to the connected vehicle imsa 2015 annual conferenceJim Frazer
 
Connected Car Conundrum (A Pecha Kucha Presentation)
Connected Car Conundrum (A Pecha Kucha Presentation)Connected Car Conundrum (A Pecha Kucha Presentation)
Connected Car Conundrum (A Pecha Kucha Presentation)Spatial Shift, LLC
 
Connected Vehicle 101 - US Department of Transportation
Connected Vehicle 101 - US Department of TransportationConnected Vehicle 101 - US Department of Transportation
Connected Vehicle 101 - US Department of TransportationAndy Palanisamy
 
Connected vehicle technology in business operations. Demands, approaches and ...
Connected vehicle technology in business operations. Demands, approaches and ...Connected vehicle technology in business operations. Demands, approaches and ...
Connected vehicle technology in business operations. Demands, approaches and ...Evgeni
 
Oracle Embedded Connected Vehicle
Oracle Embedded Connected VehicleOracle Embedded Connected Vehicle
Oracle Embedded Connected VehicleSteven Cull
 
Connected Vehicle Webinar for Training
Connected Vehicle Webinar for Training Connected Vehicle Webinar for Training
Connected Vehicle Webinar for Training Elaina Farnsworth
 
Enabling the Connected Vehicle_Vehicles Summit_Shanghai_April 2015
Enabling the Connected Vehicle_Vehicles Summit_Shanghai_April 2015Enabling the Connected Vehicle_Vehicles Summit_Shanghai_April 2015
Enabling the Connected Vehicle_Vehicles Summit_Shanghai_April 2015Wiren Perera
 
How to Get Started with Google Voice
How to Get Started with Google VoiceHow to Get Started with Google Voice
How to Get Started with Google VoiceKeitaro Matsuoka
 
Digital tech and consumer behaviour
Digital tech and consumer behaviourDigital tech and consumer behaviour
Digital tech and consumer behaviourryan-webb
 
Insurance is the most profitable connected vehicle service
Insurance is the most profitable connected vehicle serviceInsurance is the most profitable connected vehicle service
Insurance is the most profitable connected vehicle serviceCambridge Mobile Telematics
 
Building Event Driven API Services Using Webhooks
Building Event Driven API Services Using WebhooksBuilding Event Driven API Services Using Webhooks
Building Event Driven API Services Using WebhooksCloud Elements
 
Value for a Connected Vehicle (IoT)
Value for a Connected Vehicle (IoT)Value for a Connected Vehicle (IoT)
Value for a Connected Vehicle (IoT)Brian Loomis
 
How Mobile Voice Search Changes SEO
How Mobile Voice Search Changes SEOHow Mobile Voice Search Changes SEO
How Mobile Voice Search Changes SEOPepper Gang
 
Microsoft Cognitive Services 概要
Microsoft Cognitive Services 概要Microsoft Cognitive Services 概要
Microsoft Cognitive Services 概要Koichiro Sasaki
 
The Connected Vehicle: Viewing the Road Ahead
The Connected Vehicle: Viewing the Road AheadThe Connected Vehicle: Viewing the Road Ahead
The Connected Vehicle: Viewing the Road AheadAccenture Insurance
 
Cognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational InterfacesCognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational InterfacesPavel Veller
 
Key Success Factors for Connected Vehicle, Ride-share and Multi-Modal Transpo...
Key Success Factors for Connected Vehicle, Ride-share and Multi-Modal Transpo...Key Success Factors for Connected Vehicle, Ride-share and Multi-Modal Transpo...
Key Success Factors for Connected Vehicle, Ride-share and Multi-Modal Transpo...Covisint
 
第5回 cogbot勉強会!
第5回 cogbot勉強会!第5回 cogbot勉強会!
第5回 cogbot勉強会!貴志 上坂
 
Consulを頑張って理解する
Consulを頑張って理解するConsulを頑張って理解する
Consulを頑張って理解するMasakazu Watanabe
 

Destaque (20)

Introduction to the connected vehicle imsa 2015 annual conference
Introduction to the connected vehicle   imsa 2015 annual conferenceIntroduction to the connected vehicle   imsa 2015 annual conference
Introduction to the connected vehicle imsa 2015 annual conference
 
Connected Car Conundrum (A Pecha Kucha Presentation)
Connected Car Conundrum (A Pecha Kucha Presentation)Connected Car Conundrum (A Pecha Kucha Presentation)
Connected Car Conundrum (A Pecha Kucha Presentation)
 
Connected Vehicle 101 - US Department of Transportation
Connected Vehicle 101 - US Department of TransportationConnected Vehicle 101 - US Department of Transportation
Connected Vehicle 101 - US Department of Transportation
 
Connected vehicle technology in business operations. Demands, approaches and ...
Connected vehicle technology in business operations. Demands, approaches and ...Connected vehicle technology in business operations. Demands, approaches and ...
Connected vehicle technology in business operations. Demands, approaches and ...
 
Oracle Embedded Connected Vehicle
Oracle Embedded Connected VehicleOracle Embedded Connected Vehicle
Oracle Embedded Connected Vehicle
 
Connected Vehicle Webinar for Training
Connected Vehicle Webinar for Training Connected Vehicle Webinar for Training
Connected Vehicle Webinar for Training
 
Enabling the Connected Vehicle_Vehicles Summit_Shanghai_April 2015
Enabling the Connected Vehicle_Vehicles Summit_Shanghai_April 2015Enabling the Connected Vehicle_Vehicles Summit_Shanghai_April 2015
Enabling the Connected Vehicle_Vehicles Summit_Shanghai_April 2015
 
How to Get Started with Google Voice
How to Get Started with Google VoiceHow to Get Started with Google Voice
How to Get Started with Google Voice
 
Digital tech and consumer behaviour
Digital tech and consumer behaviourDigital tech and consumer behaviour
Digital tech and consumer behaviour
 
Insurance is the most profitable connected vehicle service
Insurance is the most profitable connected vehicle serviceInsurance is the most profitable connected vehicle service
Insurance is the most profitable connected vehicle service
 
Building Event Driven API Services Using Webhooks
Building Event Driven API Services Using WebhooksBuilding Event Driven API Services Using Webhooks
Building Event Driven API Services Using Webhooks
 
Value for a Connected Vehicle (IoT)
Value for a Connected Vehicle (IoT)Value for a Connected Vehicle (IoT)
Value for a Connected Vehicle (IoT)
 
How Mobile Voice Search Changes SEO
How Mobile Voice Search Changes SEOHow Mobile Voice Search Changes SEO
How Mobile Voice Search Changes SEO
 
Microsoft Cognitive Services 概要
Microsoft Cognitive Services 概要Microsoft Cognitive Services 概要
Microsoft Cognitive Services 概要
 
The Connected Vehicle: Viewing the Road Ahead
The Connected Vehicle: Viewing the Road AheadThe Connected Vehicle: Viewing the Road Ahead
The Connected Vehicle: Viewing the Road Ahead
 
Cognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational InterfacesCognitive APIs and Conversational Interfaces
Cognitive APIs and Conversational Interfaces
 
Key Success Factors for Connected Vehicle, Ride-share and Multi-Modal Transpo...
Key Success Factors for Connected Vehicle, Ride-share and Multi-Modal Transpo...Key Success Factors for Connected Vehicle, Ride-share and Multi-Modal Transpo...
Key Success Factors for Connected Vehicle, Ride-share and Multi-Modal Transpo...
 
第5回 cogbot勉強会!
第5回 cogbot勉強会!第5回 cogbot勉強会!
第5回 cogbot勉強会!
 
DDoS対策の自動化
DDoS対策の自動化DDoS対策の自動化
DDoS対策の自動化
 
Consulを頑張って理解する
Consulを頑張って理解するConsulを頑張って理解する
Consulを頑張って理解する
 

Semelhante a Building Client Apps with C# and Xamarin using OBD-II

Reactive Application Using METEOR
Reactive Application Using METEORReactive Application Using METEOR
Reactive Application Using METEORNodeXperts
 
maXbox Starter 40 REST API Coding
maXbox Starter 40 REST API CodingmaXbox Starter 40 REST API Coding
maXbox Starter 40 REST API CodingMax Kleiner
 
IoT with OpenPicus Flyport
IoT with OpenPicus FlyportIoT with OpenPicus Flyport
IoT with OpenPicus FlyportIonela
 
Mobile applications using tcp (1)
Mobile applications using tcp (1)Mobile applications using tcp (1)
Mobile applications using tcp (1)Nainita Thakkar
 
Internet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemInternet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemPrasannPatel4
 
Data Integration Solutions for Airports
Data Integration Solutions for AirportsData Integration Solutions for Airports
Data Integration Solutions for AirportsSafe Software
 
Final year project working documentation 2020
Final year project working documentation 2020Final year project working documentation 2020
Final year project working documentation 2020Vikram Singh
 
GurgaonPoliceSummerCyberSecurityInternship
GurgaonPoliceSummerCyberSecurityInternshipGurgaonPoliceSummerCyberSecurityInternship
GurgaonPoliceSummerCyberSecurityInternshipMandeep Singh Kapoor
 
Similarity Search For Web Services
Similarity Search For Web ServicesSimilarity Search For Web Services
Similarity Search For Web ServicesTalal Alsubaie
 
Integrate Sas With Google Maps
Integrate Sas With Google MapsIntegrate Sas With Google Maps
Integrate Sas With Google Mapsvineetkaul
 
FME User Stories from Around the World
FME User Stories from Around the WorldFME User Stories from Around the World
FME User Stories from Around the WorldSafe Software
 
Accelerating automotive test development may 2008
Accelerating automotive test development   may 2008Accelerating automotive test development   may 2008
Accelerating automotive test development may 2008Thorsten MAYER
 
INAC Online Hazards Database App
INAC Online Hazards Database AppINAC Online Hazards Database App
INAC Online Hazards Database AppGerry James
 
Simple APIs for Spatial Data (OGC API - Features)
Simple APIs for Spatial Data (OGC API - Features)Simple APIs for Spatial Data (OGC API - Features)
Simple APIs for Spatial Data (OGC API - Features)Sampo Savolainen
 
Busy Bee Application Develompent Platform
Busy Bee Application Develompent PlatformBusy Bee Application Develompent Platform
Busy Bee Application Develompent PlatformUtkarsh Shukla
 
Optimizing Apps for Better Performance
Optimizing Apps for Better PerformanceOptimizing Apps for Better Performance
Optimizing Apps for Better PerformanceElif Boncuk
 

Semelhante a Building Client Apps with C# and Xamarin using OBD-II (20)

Cariot
CariotCariot
Cariot
 
Unit 2 part-2
Unit 2 part-2Unit 2 part-2
Unit 2 part-2
 
Reactive Application Using METEOR
Reactive Application Using METEORReactive Application Using METEOR
Reactive Application Using METEOR
 
maXbox Starter 40 REST API Coding
maXbox Starter 40 REST API CodingmaXbox Starter 40 REST API Coding
maXbox Starter 40 REST API Coding
 
IoT with OpenPicus Flyport
IoT with OpenPicus FlyportIoT with OpenPicus Flyport
IoT with OpenPicus Flyport
 
Lot Explorer Report
Lot Explorer ReportLot Explorer Report
Lot Explorer Report
 
Mobile applications using tcp (1)
Mobile applications using tcp (1)Mobile applications using tcp (1)
Mobile applications using tcp (1)
 
Internet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemInternet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking System
 
Data Integration Solutions for Airports
Data Integration Solutions for AirportsData Integration Solutions for Airports
Data Integration Solutions for Airports
 
Final year project working documentation 2020
Final year project working documentation 2020Final year project working documentation 2020
Final year project working documentation 2020
 
GurgaonPoliceSummerCyberSecurityInternship
GurgaonPoliceSummerCyberSecurityInternshipGurgaonPoliceSummerCyberSecurityInternship
GurgaonPoliceSummerCyberSecurityInternship
 
Similarity Search For Web Services
Similarity Search For Web ServicesSimilarity Search For Web Services
Similarity Search For Web Services
 
Integrate Sas With Google Maps
Integrate Sas With Google MapsIntegrate Sas With Google Maps
Integrate Sas With Google Maps
 
FME User Stories from Around the World
FME User Stories from Around the WorldFME User Stories from Around the World
FME User Stories from Around the World
 
Accelerating automotive test development may 2008
Accelerating automotive test development   may 2008Accelerating automotive test development   may 2008
Accelerating automotive test development may 2008
 
Amilkar_Curriculum
Amilkar_CurriculumAmilkar_Curriculum
Amilkar_Curriculum
 
INAC Online Hazards Database App
INAC Online Hazards Database AppINAC Online Hazards Database App
INAC Online Hazards Database App
 
Simple APIs for Spatial Data (OGC API - Features)
Simple APIs for Spatial Data (OGC API - Features)Simple APIs for Spatial Data (OGC API - Features)
Simple APIs for Spatial Data (OGC API - Features)
 
Busy Bee Application Develompent Platform
Busy Bee Application Develompent PlatformBusy Bee Application Develompent Platform
Busy Bee Application Develompent Platform
 
Optimizing Apps for Better Performance
Optimizing Apps for Better PerformanceOptimizing Apps for Better Performance
Optimizing Apps for Better Performance
 

Mais de Our Community Exchange LLC (10)

2012 Updated Portfolio
2012 Updated Portfolio2012 Updated Portfolio
2012 Updated Portfolio
 
Roi and user experience
Roi and user experienceRoi and user experience
Roi and user experience
 
I phone versus windows phone 7 coding
I phone versus windows phone 7 codingI phone versus windows phone 7 coding
I phone versus windows phone 7 coding
 
U Xmagic Agile Presentation
U Xmagic Agile PresentationU Xmagic Agile Presentation
U Xmagic Agile Presentation
 
Porting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application GuidancePorting the Legacy Application to Composite Application Guidance
Porting the Legacy Application to Composite Application Guidance
 
WPF Line of Business Control Templates Styles
WPF Line of Business Control Templates StylesWPF Line of Business Control Templates Styles
WPF Line of Business Control Templates Styles
 
WPF Fundamentals
WPF FundamentalsWPF Fundamentals
WPF Fundamentals
 
WPF Line of Business Application XAML Layouts Presentation
WPF Line of Business Application XAML Layouts PresentationWPF Line of Business Application XAML Layouts Presentation
WPF Line of Business Application XAML Layouts Presentation
 
Wpf Tech Overview2009
Wpf Tech Overview2009Wpf Tech Overview2009
Wpf Tech Overview2009
 
New Introductionfor Flash Designers
New Introductionfor Flash DesignersNew Introductionfor Flash Designers
New Introductionfor Flash Designers
 

Último

Chapter-1.3-Four-Basic-Computer-periods.pptx
Chapter-1.3-Four-Basic-Computer-periods.pptxChapter-1.3-Four-Basic-Computer-periods.pptx
Chapter-1.3-Four-Basic-Computer-periods.pptxAnjieVillarba1
 
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp NumberVip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Numberkumarajju5765
 
What Could Cause Your Subaru's Touch Screen To Stop Working
What Could Cause Your Subaru's Touch Screen To Stop WorkingWhat Could Cause Your Subaru's Touch Screen To Stop Working
What Could Cause Your Subaru's Touch Screen To Stop WorkingBruce Cox Imports
 
How To Troubleshoot Mercedes Blind Spot Assist Inoperative Error
How To Troubleshoot Mercedes Blind Spot Assist Inoperative ErrorHow To Troubleshoot Mercedes Blind Spot Assist Inoperative Error
How To Troubleshoot Mercedes Blind Spot Assist Inoperative ErrorAndres Auto Service
 
Dubai Call Girls Size E6 (O525547819) Call Girls In Dubai
Dubai Call Girls  Size E6 (O525547819) Call Girls In DubaiDubai Call Girls  Size E6 (O525547819) Call Girls In Dubai
Dubai Call Girls Size E6 (O525547819) Call Girls In Dubaikojalkojal131
 
Delhi Call Girls East Of Kailash 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls East Of Kailash 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls East Of Kailash 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls East Of Kailash 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
ENJOY Call Girls In Okhla Vihar Delhi Call 9654467111
ENJOY Call Girls In Okhla Vihar Delhi Call 9654467111ENJOY Call Girls In Okhla Vihar Delhi Call 9654467111
ENJOY Call Girls In Okhla Vihar Delhi Call 9654467111Sapana Sha
 
John deere 425 445 455 Maitenance Manual
John deere 425 445 455 Maitenance ManualJohn deere 425 445 455 Maitenance Manual
John deere 425 445 455 Maitenance ManualExcavator
 
Bandra Escorts, (*Pooja 09892124323), Bandra Call Girls Services
Bandra Escorts, (*Pooja 09892124323), Bandra Call Girls ServicesBandra Escorts, (*Pooja 09892124323), Bandra Call Girls Services
Bandra Escorts, (*Pooja 09892124323), Bandra Call Girls ServicesPooja Nehwal
 
Hot And Sexy 🥵 Call Girls Delhi Daryaganj {9711199171} Ira Malik High class G...
Hot And Sexy 🥵 Call Girls Delhi Daryaganj {9711199171} Ira Malik High class G...Hot And Sexy 🥵 Call Girls Delhi Daryaganj {9711199171} Ira Malik High class G...
Hot And Sexy 🥵 Call Girls Delhi Daryaganj {9711199171} Ira Malik High class G...shivangimorya083
 
꧁ ୨⎯Call Girls In Ashok Vihar, New Delhi **✿❀7042364481❀✿**Escorts ServiCes C...
꧁ ୨⎯Call Girls In Ashok Vihar, New Delhi **✿❀7042364481❀✿**Escorts ServiCes C...꧁ ୨⎯Call Girls In Ashok Vihar, New Delhi **✿❀7042364481❀✿**Escorts ServiCes C...
꧁ ୨⎯Call Girls In Ashok Vihar, New Delhi **✿❀7042364481❀✿**Escorts ServiCes C...Hot Call Girls In Sector 58 (Noida)
 
꧁ ୨ Call Girls In Radisson Blu Plaza Delhi Airport, New Delhi ❀7042364481❀ Es...
꧁ ୨ Call Girls In Radisson Blu Plaza Delhi Airport, New Delhi ❀7042364481❀ Es...꧁ ୨ Call Girls In Radisson Blu Plaza Delhi Airport, New Delhi ❀7042364481❀ Es...
꧁ ୨ Call Girls In Radisson Blu Plaza Delhi Airport, New Delhi ❀7042364481❀ Es...Hot Call Girls In Sector 58 (Noida)
 
定制多伦多大学毕业证(UofT毕业证)成绩单(学位证)原版一比一
定制多伦多大学毕业证(UofT毕业证)成绩单(学位证)原版一比一定制多伦多大学毕业证(UofT毕业证)成绩单(学位证)原版一比一
定制多伦多大学毕业证(UofT毕业证)成绩单(学位证)原版一比一meq5nzfnk
 
Hauz Khas Call Girls ☎ 7042364481 independent Escorts Service in delhi
Hauz Khas Call Girls ☎ 7042364481 independent Escorts Service in delhiHauz Khas Call Girls ☎ 7042364481 independent Escorts Service in delhi
Hauz Khas Call Girls ☎ 7042364481 independent Escorts Service in delhiHot Call Girls In Sector 58 (Noida)
 
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂Hot Call Girls In Sector 58 (Noida)
 
John Deere Tractors 6130M 6140M Diagnostic Manual
John Deere Tractors  6130M 6140M Diagnostic ManualJohn Deere Tractors  6130M 6140M Diagnostic Manual
John Deere Tractors 6130M 6140M Diagnostic ManualExcavator
 
Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...
Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...
Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...Delhi Call girls
 
Delhi Call Girls Mayur Vihar 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Mayur Vihar 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Mayur Vihar 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Mayur Vihar 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 

Último (20)

Chapter-1.3-Four-Basic-Computer-periods.pptx
Chapter-1.3-Four-Basic-Computer-periods.pptxChapter-1.3-Four-Basic-Computer-periods.pptx
Chapter-1.3-Four-Basic-Computer-periods.pptx
 
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp NumberVip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
Vip Hot Call Girls 🫤 Mahipalpur ➡️ 9711199171 ➡️ Delhi 🫦 Whatsapp Number
 
Call Girls In Kirti Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Kirti Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICECall Girls In Kirti Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
Call Girls In Kirti Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SERVICE
 
What Could Cause Your Subaru's Touch Screen To Stop Working
What Could Cause Your Subaru's Touch Screen To Stop WorkingWhat Could Cause Your Subaru's Touch Screen To Stop Working
What Could Cause Your Subaru's Touch Screen To Stop Working
 
How To Troubleshoot Mercedes Blind Spot Assist Inoperative Error
How To Troubleshoot Mercedes Blind Spot Assist Inoperative ErrorHow To Troubleshoot Mercedes Blind Spot Assist Inoperative Error
How To Troubleshoot Mercedes Blind Spot Assist Inoperative Error
 
Dubai Call Girls Size E6 (O525547819) Call Girls In Dubai
Dubai Call Girls  Size E6 (O525547819) Call Girls In DubaiDubai Call Girls  Size E6 (O525547819) Call Girls In Dubai
Dubai Call Girls Size E6 (O525547819) Call Girls In Dubai
 
Delhi Call Girls East Of Kailash 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls East Of Kailash 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls East Of Kailash 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls East Of Kailash 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
ENJOY Call Girls In Okhla Vihar Delhi Call 9654467111
ENJOY Call Girls In Okhla Vihar Delhi Call 9654467111ENJOY Call Girls In Okhla Vihar Delhi Call 9654467111
ENJOY Call Girls In Okhla Vihar Delhi Call 9654467111
 
John deere 425 445 455 Maitenance Manual
John deere 425 445 455 Maitenance ManualJohn deere 425 445 455 Maitenance Manual
John deere 425 445 455 Maitenance Manual
 
Call Girls In Kirti Nagar 7042364481 Escort Service 24x7 Delhi
Call Girls In Kirti Nagar 7042364481 Escort Service 24x7 DelhiCall Girls In Kirti Nagar 7042364481 Escort Service 24x7 Delhi
Call Girls In Kirti Nagar 7042364481 Escort Service 24x7 Delhi
 
Bandra Escorts, (*Pooja 09892124323), Bandra Call Girls Services
Bandra Escorts, (*Pooja 09892124323), Bandra Call Girls ServicesBandra Escorts, (*Pooja 09892124323), Bandra Call Girls Services
Bandra Escorts, (*Pooja 09892124323), Bandra Call Girls Services
 
Hot And Sexy 🥵 Call Girls Delhi Daryaganj {9711199171} Ira Malik High class G...
Hot And Sexy 🥵 Call Girls Delhi Daryaganj {9711199171} Ira Malik High class G...Hot And Sexy 🥵 Call Girls Delhi Daryaganj {9711199171} Ira Malik High class G...
Hot And Sexy 🥵 Call Girls Delhi Daryaganj {9711199171} Ira Malik High class G...
 
꧁ ୨⎯Call Girls In Ashok Vihar, New Delhi **✿❀7042364481❀✿**Escorts ServiCes C...
꧁ ୨⎯Call Girls In Ashok Vihar, New Delhi **✿❀7042364481❀✿**Escorts ServiCes C...꧁ ୨⎯Call Girls In Ashok Vihar, New Delhi **✿❀7042364481❀✿**Escorts ServiCes C...
꧁ ୨⎯Call Girls In Ashok Vihar, New Delhi **✿❀7042364481❀✿**Escorts ServiCes C...
 
꧁ ୨ Call Girls In Radisson Blu Plaza Delhi Airport, New Delhi ❀7042364481❀ Es...
꧁ ୨ Call Girls In Radisson Blu Plaza Delhi Airport, New Delhi ❀7042364481❀ Es...꧁ ୨ Call Girls In Radisson Blu Plaza Delhi Airport, New Delhi ❀7042364481❀ Es...
꧁ ୨ Call Girls In Radisson Blu Plaza Delhi Airport, New Delhi ❀7042364481❀ Es...
 
定制多伦多大学毕业证(UofT毕业证)成绩单(学位证)原版一比一
定制多伦多大学毕业证(UofT毕业证)成绩单(学位证)原版一比一定制多伦多大学毕业证(UofT毕业证)成绩单(学位证)原版一比一
定制多伦多大学毕业证(UofT毕业证)成绩单(学位证)原版一比一
 
Hauz Khas Call Girls ☎ 7042364481 independent Escorts Service in delhi
Hauz Khas Call Girls ☎ 7042364481 independent Escorts Service in delhiHauz Khas Call Girls ☎ 7042364481 independent Escorts Service in delhi
Hauz Khas Call Girls ☎ 7042364481 independent Escorts Service in delhi
 
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
꧁༒☬ 7042364481 (Call Girl) In Dwarka Delhi Escort Service In Delhi Ncr☬༒꧂
 
John Deere Tractors 6130M 6140M Diagnostic Manual
John Deere Tractors  6130M 6140M Diagnostic ManualJohn Deere Tractors  6130M 6140M Diagnostic Manual
John Deere Tractors 6130M 6140M Diagnostic Manual
 
Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...
Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...
Call Girls in Malviya Nagar Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts Ser...
 
Delhi Call Girls Mayur Vihar 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Mayur Vihar 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Mayur Vihar 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Mayur Vihar 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 

Building Client Apps with C# and Xamarin using OBD-II

  • 1.
  • 2. Building Client Apps with C# and Xamarin Why Xamarin ? Build Once works universally across platforms on billions of devices..
  • 3. Basic Hardware –OBD-II Port Connectivity An ODB-II Elm 327 type interface (connected to USB, Bluetooth or wi-fi) on your smart phone or tablet connected to the diagnostic port below your steering wheel, or broadband in your newer vehicle. Newer vehicles now have optional broadband in-vehicle.
  • 4. Visual Studio Community Edition Free IDE (Integrated Development Environment) for PCs Integrates with Xamarin for iOS, Android and Mac Development.. Xamarin is free for students and affordable for Indy Developers
  • 5. Polling Data From OBD-II Your Xamarin Studio or Visual Studio project will need you to install an OBD manager to communicate with your vehicle’s network of diagnostic codes.. I suggest installing the OBD-II manager from Microsoft’s Coding for Fun Channel 9 Project.. You can integrate this easily in your app using either Xamarin Studio or Visual Studio’s NuGet Package Manager also available from the NuGet gallery..
  • 7. Communicating with the OBD-II Port OBD-II stands for On-Board Diagnostics. Connecting to this port allows us to query for different types of data from the car. We can get the current speed, RPMs, fuel level, etc. for display in the Instrument Cluster and other locations. For the vehicle, because only one application can open and communicate with a serial port at one time, we created a WCF service that polls the OBD-II data from the car and GPS and returns it to our application when it queries the service. For the OBD library a manual connection will be used to poll different values at different intervals. For values critical to driving the car—like RPM, speed, etc, it is necessary to poll for the values as quickly as the vehicle can return them. With other values which aren’t critical to driving the car—like the fuel level, engine coolant temperature, can be polled at a 1-2 second interval. For GPS, we can create a code to read the GPS and create a LocationChanged event, which would fire when the GPS values changed. Rather than creating a new serial port connection for every WCF request for OBD data, it’s important to use a singleton service that is instantiated when the service first runs. Only one object in the WCF service that represents the last OBD and GPS data returned, which is obtained by the continual reading of the latest OBD data using the OBD library as described above. Calls to a WCF service ReadMeasurement method didn’t actually compute anything, but instead serializes the last saved data and returned it via the WCF service.
  • 8. Instantiating the OBD Service _service = new ObdService(); _service.ObdMeasurementChanged += service_ObdMeasurementChanged; _service.Start(new TimeSpan(0, 0, 0, 0, 1000), localhost, Protocol.Http, false); void service_ObdMeasurementChanged(object sender, ObdMeasurementChangedEventArgs e) { Debug.Writeline("MPH=” + e.Measurement.MilesPerHour); } This code creates a new ObdService class and signs up for an event when the measurement has changed. The Start method does the following: • Set the interval that you want to poll the ObdService, in this case every second (to update the instrument cluster). • Determines what IP address the service is hosted at (localhost), the protocol (HTTP or TCP), and whether to send “demo mode” data. So we can have some sample data for testing. To capture the car telemetry data like MPH, RPM, engine load, and throttle (accelerator) position, as well as location data (latitude, longitude, altitude, and course), we used a SQL database with a flat Entity Framework model. • The primary key, the ObdMeasurementID is a GUID that is returned via the ObdService. • The database logger subscribes to the ObdMeasurementChanged event and receives a new reading at the time interval set in the Start() method.
  • 9. Instantiating the OBD Service public override string RowKey { get { return new DateTimeOffset(TimeStamp).ToEndOfDays(); } set { } } public static class DateTimeExtensions { public static string ToEndOfDays(this DateTimeOffset source) { TimeSpan timeUntilTheEnd = DateTimeOffset.MaxValue.Subtract(source); return timeUntilTheEnd.Ticks.ToString(); } public static DateTimeOffset FromEndOfDays(this String daysToEnd) { TimeSpan timeFromTheEnd = newTimeSpan(Int64.Parse(daysToEnd)); DateTimeOffset source = DateTimeOffset.MaxValue.Date.Subtract(timeFromTheEnd); return source; } } The Windows Azure data model uses Azure Table Services instead of SQL Server. The data mapping is essentially the same since both have a flat schema. For Azure Table Storage, in addition to the schema above, you also need a partition key and a row key. For the partition key, we used a custom TripID (GUID) to represent a Trip. When the car is turned on/off a new TripID is created. That way we could group all measurements for that particular trip and do calculations based on that trip, like the average miles per gallon, distance traveled, fastest speed, etc. For the row key, we used a DateTimeOffset and a custom extension method, ToEndOfDays() that provides a unique numerical string (since Azure's row key is a string type) that subtracts the time from the DateTime.Max value. The result is that the earlier a DateTime value, the larger the number. Example: Time=5/11/2012 9:14:09 AM, EndOfDays=2520655479509478223 //larger Time=5/11/2012 9:14:11 AM, EndOfDays=2520655479482804811 //smaller Since they are ordered in reverse order, with the most recent date/time being the first row, we can write an efficient query to pull just the first row to get the current latitude/longitude without needing to scan the entire table for the last measurement.
  • 10. Instantiating the OBD Service public ActionResult PostData() { try { StreamReader incomingData = new StreamReader(HttpContext.Request.InputStream); string data = incomingData.ReadToEnd(); JavaScriptSerializer oSerializer = new JavaScriptSerializer(); List<MeasurementForTransfer> measurements; measurements = oSerializer.Deserialize(data, typeof(List<MeasurementForTransfer>)) as List<MeasurementForTransfer>; if (measurements != null) { CloudBlob blob = _blob.UploadStringToIncoming(data); _queue.PushMessageToPostQueue(blob.Uri.ToString()); return new HttpStatusCodeResult(200); } }} To upload data to Azure, we used a timer-based background uploader that would check to see if there was an internet connection, and then filter and upload all of the local SQL rows that had not been submitted to Azure using the Submitted boolean database field. On the Azure side, we used an ASP.NET MVC controller to submit data. The controller deserializes the data into a List<MeasurementForTransfer> type, it adds the data to a blob, and adds the blob to a queue. A worker role (or many) will then read items off the queue and the new OBD measurement rows are placed into Azure Table Storage.
  • 11. Xamarin already has App Store Apps for OBD-II Xamarin is already popular among App Store Developers Matt O’Connor from OCTech, and creator of OBD Fusion, shared his app that wirelessly reads onboard vehicle diagnostics from a car. The app enables car enthusiasts to create their own dashboards and access much of the same diagnostic information a master mechanic would use with specialized automotive equipment to diagnose and tune an automobile. With OBD Fusion, users can calculate fuel economy, graph data, and also test emissions in real-time. Matt originally created his app in C# as a desktop application. Utilizing Xamarin, he was able to convert it to iOS and Android with over 90% code- reuse, and by using app templates he’s created native smartphone and tablet user experiences. In addition to the automobile’s sensor data, he’s also integrated sensors on the mobile device, including the GPS and accelerometer to measure position and vehicle acceleration. https://www.youtube.com/watch?v=Sd3N8zrD7qs
  • 12. Client App (Tablet Dashboards) Starting Point http://obd.codeplex.com/
  • 13. Creating a OBD-II Client Dashboard Creating a dashboard is a lot like game programming, to move the needle updates at reasonable speed the code needs to be setup as a game loop as you are seeing here in C Sharp for their XAML interface.. To do this in Xamarin, we can use monogame.
  • 14. Creating a OBD-II Client Dashboard using System; using System.Windows.Controls; using System.Windows; using System.Windows.Media; using System.ComponentModel; using System.Windows.Media.Animation; namespace Coding4Fun.Obd.InstrumentCluster.Classes { public class Needle : UserControl { private const double SLOWNESS = 5; Storyboard uxSB_GameLoop; FrameworkElement uxNeedle; public RotateTransform Needle_RotateTransform = new RotateTransform(); public TransformGroup tg = new TransformGroup(); private double desiredAngle; public Needle() { Loaded += new System.Windows.RoutedEventHandler(Needle_Loaded); Initialized += new EventHandler(Needle_Initialized); } void Needle_Initialized(object sender, EventArgs e) { uxNeedle = (FrameworkElement)FindName("uxNeedle"); uxSB_GameLoop = (Storyboard)TryFindResource("uxSB_GameLoop"); } void Needle_Loaded(object sender, System.Windows.RoutedEventArgs e) { if (uxNeedle != null) uxNeedle.RenderTransform = Needle_RotateTransform; if (uxSB_GameLoop != null) { uxSB_GameLoop.Completed += new EventHandler(uxSB_GameLoop_Completed); uxSB_GameLoop.Begin(); }} void uxSB_GameLoop_Completed(object sender, EventArgs e) { Needle_RotateTransform.Angle += (desiredAngle - Needle_RotateTransform.Angle) / Math.Max(SLOWNESS, 1); uxSB_GameLoop.Begin(); } public void UpdateNeedle() { desiredAngle = Maximum == Minimum ? Maximum : MinAngle + (MaxAngle - MinAngle) * (Math.Min(Math.Max(Value, Minimum), Maximum) - Minimum) / (Maximum - Minimum); if (uxSB_GameLoop == null) { Needle_RotateTransform.Angle = desiredAngle; } } private static void OnValuesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Needle ln = (Needle)d; ln.UpdateNeedle(); } [Category("Common Properties")] public double Value { get { return (double)GetValue(ValueProperty); } set { SetValue(ValueProperty, value); } } public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(double), typeof(Needle), new PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged))); [Category("Common Properties")] public double Minimum { get { return (double)GetValue(MinimumProperty); } set { SetValue(MinimumProperty, value); } } public static readonly DependencyProperty MinimumProperty = DependencyProperty.Register("Minimum", typeof(double), typeof(Needle), new PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged))); [Category("Common Properties")] public double Maximum { get { return (double)GetValue(MaximumProperty); } set { SetValue(MaximumProperty, value); } } public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register("Maximum", typeof(double), typeof(Needle), new PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged))); [Category("Common Properties")] public double MinAngle { get { return (double)GetValue(MinAngleProperty); } set { SetValue(MinAngleProperty, value); } } public static readonly DependencyProperty MinAngleProperty = DependencyProperty.Register("MinAngle", typeof(double), typeof(Needle), new PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged))); [Category("Common Properties")] public double MaxAngle { get { return (double)GetValue(MaxAngleProperty); } set { SetValue(MaxAngleProperty, value); } } public static readonly DependencyProperty MaxAngleProperty = DependencyProperty.Register("MaxAngle", typeof(double), typeof(Needle), new PropertyMetadata(new Double(), new PropertyChangedCallback(OnValuesChanged))); }}
  • 15. Real-time Sensor Data Networks with HDInsight and Apache Storm Creating a sensor data network that we can use with our Xamarin App
  • 16. Apache Storm and Real-Time Sensor Networks Data Capture in Real-Time
  • 17. What is Apache Storm ?
  • 18. What you need to get started 1. An Azure subscription with HDInsight and Apache Storm (in beta) Active 2. Visual Studio with the Microsoft Azure SDK for .NET 3. Java and JDK 4. Maven 5. Git 6. Source Code for the Sample Project http://azure.microsoft.com/en- us/documentation/articles/hdinsight-storm-sensor- data-analysis/ https://github.com/Blackmist/hdinsight-eventhub- example http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 19.
  • 20. Creating the Dashboard The dashboard is used to display near-real time sensor information. In this case, the dashboard is an ASP.NET application hosted in an Azure Website. The application's primary purpose is to serve as a SignalR hub that receives information from the Storm topology as it processes messages. The website also contains a static index.html file, which also connects to SignalR, and uses D3.js to graph the data transmitted by the Storm topology. NOTE: While you could also use raw WebSockets instead of SignalR, WebSockets does not provide a built-in scaling mechanism if you need to scale out the web site. SignalR can be scaled using Azure Service Bus (http://www.asp.net/signalr/overview/performance/scaleout-with- windows-azure-service-bus). For an example of using a Storm topology to communicate with a Python website using raw WebSockets, see the Storm Tweet Sentiment D3 Visualization project. http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 21. Creating the Dashboard The dashboard is used to display near-real time sensor information. In this case, the dashboard is an ASP.NET application hosted in an Azure Website. The application's primary purpose is to serve as a SignalR hub that receives information from the Storm topology as it processes messages. The website also contains a static index.html file, which also connects to SignalR, and uses D3.js to graph the data transmitted by the Storm topology. NOTE: While you could also use raw WebSockets instead of SignalR, WebSockets does not provide a built-in scaling mechanism if you need to scale out the web site. SignalR can be scaled using Azure Service Bus (http://www.asp.net/signalr/overview/performance/scaleout-with-windows-azure-service-bus). For an example of using a Storm topology to communicate with a Python website using raw WebSockets, see the Storm Tweet Sentiment D3 Visualization project. 1.In Visual Studio, create a new C# application using the ASP.NET Web Application project template. Name the new application Dashboard. 2.In the New ASP.NET Project window, select the Empty application template. In the Windows Azure section, select Host in the cloud and Web site. Finally, click Ok NOTE: If prompted, sign in to your Azure subscription. 3.In the Configure Windows Azure Site dialog, enter a Site name and Region for your web site, then click OK. This will create the Azure Website that will host the dashboard. 4.In Solution Explorer, right-click the project and then select Add | SignalR Hub Class (v2). Name the class DashHub.cs and add it to the project. This will contain the SignalR hub that is used to communicate data between HDInsight and the dashboard web page. DashHub.cs http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 23. Creating the Dashboard Next Steps • In Solution Explorer, right-click the project and then click Add | HTML Page. Name the new page index.html. This page will contain the realtime dashboard for this project. It will receive information from DashHub and display a graph using D3.js. • In Solution Explorer, right-click on index.html and select Set as Start Page. http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 25. Creating the Dashboard Next Steps • In Solution Explorer, right-click the project and click Add | HTML Page. • Name the new page test.html. This page can be used to test DashHub and the dashboard by sending and receiving messages. Save All for the project. • In Solution Explorer, right-click on the Dashboard project and select Publish. Select the website you created for this project, then click Publish. • Once the site has been published, a web page should open displaying a moving timeline. Test the dashboard To verify that SignalR is working, and that the dashboard will display graph lines for data sent to SignalR, open a new browser window to the test.html page on this website. For example, http://sensordash.azurewebsites.net/test.html. The dashboard expects JSON formatted data, with a device id and temperature value. For example {"device":0, "temperature":80}. Enter some test values on the test.html page, using device IDs 0 through 9, while the dashboard is open in another page. Note that the lines for each device ID are drawn using a different color. http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 26. Configuring the Azure Event Hub http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 27. Sending Messages to the Event Hub http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 30. Program.cs For now, you will receive a warning on lines that reference the Event class. Ignore these for now. In the Program.cs file, set the value of the following variables at the beginning of the file to the corresponding values retrieved from your Event Hub in the Azure Management Portal. http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 34. Setting up your cluster and virtual network Creating your network.. http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 35. Setting up your cluster and virtual network http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 36. Setting up your cluster and virtual network Creating your network.. http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 37. Setting up your cluster and virtual network Creating your network.. http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 42. Enabling Real-Time Communication This tells Maven to do the following when building the project: Include the /conf/Config.properties resource file. This file will be created later, but it will contain configuration information for connecting to Azure Event Hub. Include the /conf/hbase-site.xml resource file. This file will be created later, but it will contain information on how to connect to HBase Use the maven-compiler-plugin to compile the application. Use the maven-shade-plugin to build an uberjar or fat jar, which contains this project and any required dependencies. Use the exec-maven-plugin, which allows you to run the application locally without a Hadoop cluster. http://azure.microsoft.com/en-us/documentation/articles/hdinsight-storm-sensor-data-analysis/
  • 53. Topology Dataflows Summary You have now learned how to use Storm to read data from Event Hub, store data in HBase, and display information from Storm on an external dashboard using SignalR and D3.js. •For more information on Apache Storm, see https://storm.incubator.apache.org/ •For more information on HBase with HDInsight, see the HBase with HDInsight Overview •For more information on SignalR, see ASP.NET SignalR •For more information on D3.js, see D3.js - Data Driven Documents •For information on creating topologies in .NET, see Develop streaming data processing applications with SCP.NET and C# on Storm in HDInsight http://azure.microsoft.com/en-us/documentation/articles/hdinsight- storm-sensor-data-analysis/
  • 54. SendEvents Pushing Data to Azure HDInsight and Apache Storm Our Example running pushing temperature data
  • 55. CONNECTING TO REAL-TIME VEHICLE DATA AND MODELING IN THE LAB
  • 56. Azure Mobile Services for Unity 3D The Azure Mobile Services have a free tier that includes up to 500 devices as well as 500k API calls and you can also use the free tier for up to 10 services. This means that you can test out a few things without having to pay for it. Azure Mobile Services Azure Mobile Services is a part of Azure that allows access to a database and has connection and sample code to talk to any mobile system that is out there. This will provide you with the code or library to do the connection to Android, iOS, Windows 8, Windows Phone, HTML5/JavaScript, or even the Xamarin libraries. To get started, if you do not have any Mobile Services defined yet you can click on the Mobile Services tab on the left and then the Create a New Mobile Service link next to it. You can also click on the New option on the bottom the of the screen and select Compute -> Mobile Service -> Create. From here, you will get a popup to fill in to finish up the creation. The first field is the name of the Mobile Service. This name will also be the address for the service. It must be unique. For this example, I named mine “unityleaderboard”. The next field is the database to use as a back end for the service. You can choice from “Use an existing SQL database“, “Create a free 20 MB SQL database“, or “Create a new SQL database instance“.
  • 57. Azure Mobile Services for Unity 3D
  • 58. Azure Mobile Services for Unity 3D So up to now we have the Mobile Service setup, but there is no data yet. Go into your new Mobile Service and then click on the Data link at the top. You can now add a new Table to the database that was setup earlier.
  • 59. Azure Mobile Services for Unity 3D The next step is to add the data fields to the new leaderboard table. This will allow us to save the data for the UserName and the Score that is saved. This is going to be a basic sample and not an optimized database, so I will be adding the UserName as just a string field to the table. If this was a bigger system supporting multiple games, I would probably make a Player table with all of the players info there and then a leaderboard table that cross referenced that player table. Since this is just a quick and simple leaderboard for a single game, keeping the raw text in the table is not that bad. The Score field is going to be added as a Number so that we do not have to change the numbers of the score into a text field back and forth. After clicking on the table name, you will see and can click on the Columns link to get to add new columns. To add a new column, use the Add Column link at the bottom of the page.
  • 60. Bitrave Mobile Services Plugin API https://github.com/bitrave/azure-mobile-services-for-unity3d
  • 61. Bitrave Mobile Services Plugin API Put the plugin binaries in your Assets/Plugins folder. These get built into an Output folder in the root of the solution in the right folder structure. And it’s as simple as… var data = new LevelSaveData() { SaveData = "some data here", Id = 1 }; var azure = new AzureMobileServices(_azureEndPoint, _applicationKey); azure.Update<LevelSaveData>(data); or var azure = new AzureMobileServices(_azureEndPoint, _applicationKey); azure.Lookup<LevelSaveData>(1, azureResponse => { if (azureResponse.Status == AzureResponseStatus.Success) { var ourObject = azureReponse.ResponseData; }} Data comes back via callbacks and response objects. Unity doesn’t support await/async, but when it does it will move to that model.
  • 62. Bitrave Mobile Services Plugin API API Initialize initialiation is just as simple as you’d expect. var service = new AzureMobileServices(“url”, “token”); Insert Insert an item into your Azure database in a single line of code from Unity. service.Insert<ToDoItem>(myItem); Update Update items in the Azure databsae with just one line of code from Unity. service.Update<ToDoItem>(myItem); Delete Remove items from the Azure database in 1 line of code from Unity. service.Delete<ToDoItem>(myItem); Query Query items in your Azure Mobile Services from Unity. service.Where<ToDoItem>(p => p.Category == “Exercise”, azureResponse =>{List<ToDoItem> exerciseItems = azureRepsonse.ResponseData; NOTE: await / async will be available when supported by Unity. Until then we are using callbacks. Lookup Lookup items in your Azure Mobile Services from Unity. service.Lookup<ToDoItem>(myItem, azureResponse =>{ToDoItem myToDoItem = azureResponse.ResponseData; NOTE: await / async will be available when supported by Unity. Until then we are using callbacks. Login On supported platforms, LoginAsync can be called for authenticated services. azure.LoginAsync(AuthenticationProvider.Facebook, loginResponse => {var token = loginResponse.ResponseData.MobileServiceAuthenticationToken;}); NOTE: await / async will be available when supported by Unity. Until then we are using callbacks.
  • 63. Bitrave Mobile Services Plugin API API Initialize initialiation is just as simple as you’d expect. var service = new AzureMobileServices(“url”, “token”); Insert Insert an item into your Azure database in a single line of code from Unity. service.Insert<ToDoItem>(myItem); Update Update items in the Azure databsae with just one line of code from Unity. service.Update<ToDoItem>(myItem); Delete Remove items from the Azure database in 1 line of code from Unity. service.Delete<ToDoItem>(myItem); Query Query items in your Azure Mobile Services from Unity. service.Where<ToDoItem>(p => p.Category == “Exercise”, azureResponse =>{List<ToDoItem> exerciseItems = azureRepsonse.ResponseData; NOTE: await / async will be available when supported by Unity. Until then we are using callbacks. Lookup Lookup items in your Azure Mobile Services from Unity. service.Lookup<ToDoItem>(myItem, azureResponse =>{ToDoItem myToDoItem = azureResponse.ResponseData; NOTE: await / async will be available when supported by Unity. Until then we are using callbacks. Login On supported platforms, LoginAsync can be called for authenticated services. azure.LoginAsync(AuthenticationProvider.Facebook, loginResponse => {var token = loginResponse.ResponseData.MobileServiceAuthenticationToken;}); NOTE: await / async will be available when supported by Unity. Until then we are using callbacks.
  • 64. MapNav Plug-In Unity 3D https://www.assetstore.unity3d.com/en/#!/content/13153
  • 65. MapNav Plug-In Unity 3D https://www.assetstore.unity3d.com/en/#!/content/13153
  • 66. Prime 31 Plug-in for Unity
  • 67. Prime 31 Plug-in for Unity Sign-in to Azure portal. If you don’t have an Azure account yet game developers can register for the Cloud GameDev Offer. Create Azure Mobile Service
  • 68. Prime 31 Plug-in for Unity Sign-in to Azure portal. If you don’t have an Azure account yet game developers can register for the Cloud GameDev Offer. Create Azure Mobile Service
  • 69. Add a Demo To-Do Table
  • 71. Get the Plug-ins you need to install https://prime31.com/plugins
  • 72. Create a New Project and Install the Plug-in
  • 76. Paste in your Azure Connection Strings
  • 77. Target Windows Store In your program settings • “Add Current” scene • Select “Windows Store” and “Switch Platform” • Select C# Solution and SDK “8.1”
  • 78. Select Player Settings Under “Metro Unprocessed Plugins” set: Size: 1 Element 0: P31MetroAzure.dll Click Build
  • 79. Launch Visual Studio Open Windows Store Build
  • 80. Open Package.AppXManifest.xml Add Internet Capabilities to Manifest
  • 81. Open Configuration Manager Target Current Hardware
  • 82. Build and Run You will see your items in Azure
  • 83. Connecting to Vehicle Data Near Real-Time in the Cloud The WCC Connected Pontiac G6 Modeled and Connected to Real- Time Vehicle Data..