Intel Ultrabook hardware prototype - Windows 8 and the Sensor Platform
What better time to test the Sensors in this Intel Ultrabook prototype then while in the air? I'm on a flight right now from Krakow, Poland to Munich, Germany, and I realized this was the perfect time to bring out this little 3 pound wonder. Even better because I received an email just a few days before with updated Sensor Firmware for this device.
I did an initial review of this non-production Ultrabook last month as well as an unboxing and initial impressions video on YouTube. Check the video out below. I've recently added closed-captioning.
Since that time I've been using this Ultrabook almost exclusively as my main machine, even preferring it over my giant (but super powerful) Lenovo W520. I've always been one to prefer the heavier laptop over a lighter one as long as it's got the power I need. However the i7-3667 Ivy Bridge in this system has been just fine for everything I could throw at it - even running Windows 7 and Ubuntu in a Hyper-V virtual machine while running Visual Studio 2012 under Windows 8. My only real complain so far has been that this model I was provided for review purposes has only 4 gigs of RAM and not 8 or 12. I feel like 4gigs is a real minimum for the kinds of computing I'm doing. That said, the 160 gig Intel SSD has been so fast that I haven't really noticed the lack of memory except when pushing two VMs really hard.
Anyway, I wanted to focus on the sensors as this prototype has all the possible sensors an Ultrabook can have, the most initially interesting sensor to me being the GPS and Location Services.
You can get sensor data in a number of ways. I figured I'd try a few.
There's a Windows 8 Bing Maps Geolocation Sample you can get. It is C# and XAML and uses the Bing Map SDK. You have a little work to do in that you need to:
- Make sure you have a version of Visual Studio that can make Windows 8 apps. There's a free Express version.
- Get the Bing Maps SDK for Windows 8 . This just came out last week. There's JavaScript, C#, C++ andVB support.
- Register at http://bingmapsportal.com for a free Trial key for your Windows 8 Store app.
- Take the resulting key and put it in the XAML markup under "Credentials" of the bm:Map control.
There's also a much simpler (no map) Geolocation Sample that you can just download and run. It includes three scenarios: ongoing tracking of your position, a one time "get" of your position, and a background task that gets your position even after your application has been shutdown. As with all Windows 8-type apps you'll automatically get a permission popup when an application asks for something sensitive like your location.
The code is pretty simple, in fact. There's a Windows.Devices.Geolocation namespace with a Geolocator class. It has both PositionChanged and StatusChanged events. Since you can't physically move your device every time (although I'm flying now) you can actually run your application inside the Windows "Simulator" and effectively LIE about the location.
In the screenshot below I've taken my actual location that was reported by the physical GPS inside this Ultrabook and moved it a few thousand miles using the black menu popup from the Simulator and saw the underlying value reported change. Note the "use simulated location" checkbox. You can change between the sensor subsystem and the faked GPS values.
Here you can see me flying over the Atlantic Ocean while on my flight.
Accessing the Sensors are very easy from Windows 8 as there's now a unified Sensor and Location Platform. You don't have to sweat 3rd party drivers, just ask Windows if it knows things like brightness or location and it will tell you if it knows.
You can access at least Location Services via System.Device under .NET on Windows 7 as well. Here's a quick example Console app I did to prove it to myself:
GeoCoordinateWatcher foo = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
foo.MovementThreshold = 10;
foo.StatusChanged += (sensor, changed) =>
{
Console.WriteLine(changed.Status);
};
foo.PositionChanged += (sensor, changed) => {
Console.WriteLine(changed.Position.Timestamp.ToString("G"));
Console.WriteLine(String.Format("Location: {0}, {1}",
changed.Position.Location.Latitude.ToString("0.000"),
changed.Position.Location.Longitude.ToString("0.000")));
} ;
foo.Start();
Console.ReadLine();
foo.Stop(); //Say you're done to save batteries!
So that means Desktop apps can use System.Device.Location and Windows Store (sandboxed) apps use Microsoft.Devices.GeoLocation, as well as all the other sensors made available via WinRT. If you find WinRT confusing I'd encourage you to listen to my podcast on the topic. I had WinRT explained to me by a WinRT developer and I feel much better about it.
Also worth noting with GPS data you can get ahold of it even from inside a modern browser. Just a little bit of JavaScript:
<script>
navigator.geolocation.getCurrentPosition(
function myfunction(data) {
alert(data.coords.longitude + " " + data.coords.latitude);
});
</script>
Then your browser will warn you and ask permission, similar to this:
I'd like to see all possible sensors become available to the browser, similar to the way the Firefox OS proposes to allow access to hardware from JavaScript.
Of course, within Windows 8 applications I can access any Sensor data at all - regardless of language (JS, VB, C#, C++) - with similar APIs. You instantiate the Sensor class, hook up a few events and you're set, like this LightSensor example. I can even call these WinRT APIs from Desktop Applications.
private LightSensor _lightsensor; // Our app's lightsensor object
private void ReadingChanged(object sender, LightSensorReadingChangedEventArgs e)
{
Dispatcher.InvokeAsync(CoreDispatcherPriority.Normal, (s, a) =>
{
LightSensorReading reading = (a.Context as LightSensorReadingChangedEventArgs).Reading;
txtLuxValue.Text = String.Format("{0,5:0.00}", reading.IlluminanceInLux);
}, this, e);
}
//Then, whenever you need to, just...
_lightsensor = LightSensor.GetDefault(); // Get the default light sensor object
// Assign an event handler for the ALS reading-changed event
if (_lightsensor != null)
{
// Establish the report interval for all scenarios
uint minReportInterval = _lightsensor.MinimumReportInterval;
uint reportInterval = minReportInterval > 16 ? minReportInterval : 16;
_lightsensor.ReportInterval = reportInterval;
// Establish the event handler
_lightsensor.ReadingChanged += new TypedEventHandler<LightSensor, LightSensorReadingChangedEventArgs>(ReadingChanged);
}
It's pretty straightforward. These Ultrabooks have a PILE of sensors, as you can see using the Sensor Diagnostic Tool below.
The really interesting question to me is: How can we use these for games? Sure, there's the obvious utilities for dimming the screen and what not, but what kinds of really creative stuff could be done? What would a Contre Jour look like with compasses and inclinometers feeding information to the game and affecting not just active animations but subtle background ones as well?
What do YOU think? Do we need need these sensor arrays in our portable computers? Have we just not come up with the really creative uses for them?
Disclosure of Material Connection: Intel sent me this Ultrabook for free in the hope that I would review it on my blog. Regardless, I only recommend products or services I I would use and think you would find useful. I am disclosing this in accordance with the Federal Trade Commission’s 16 CFR, Part 255: “Guides Concerning the Use of Endorsements and Testimonials in Advertising.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
@Scott, memory is measured in hertz, not bytes. If you're not using more memory than you have, it won't matter if you have 4GB, 8GB, 16GB, or 256GB of RAM, your computer will perform the same between these sizes. 1600 MHz RAM will outperform 800 MHz RAM by 2x. So what's the memory clock speed on this thing?
Comments are closed.
I'd get a refund