Jimmy Engström

2015

Build 2015 was epic, there was so much content so Microsoft even recorded some content before build (now available at Channel9).I usually download everything to my laptop and watch it to and from work, this script will download all videos from Build 2015 =)

This is an updated version of my script I previously blogged about here.

2014

A week ago I found a kettle that can be controlled over Wi-fi.It is called iKettle and can be found over here.

When I find a device I look for two things:Is there an app for Windows (Phone or 8)? Can I make one?

If the answer is yes to at least one of those questions (well actually none is ok too) I know I need to buy one.

Mark Cox had already done most of the heavy lifting so I only had to implement the protocol found on this blog (Thanks Mark).I’m a bit sad that it didn’t use http protocol, it could have replied with status 418

There are still features missing, some because I haven’t gotten around to it yet and some because there are hardware or software limitations, like you won’t be able to set up the iKettle from a Windows phone since you can’t connect directly to it.

With Windows phone 8.1 Microsoft also released the ability to communicate with Bluetooth Low Energy devices. This is really exciting for Windows phone developers, this way we can start developing apps that can talk to devices without draining the battery dry.

Sadly this is not available in the developer preview of Windows phone 8.1, but will be available when Windows Phone 8.1 is released for general availability.

Pairing

The first step is always to pair with the device you want to connect to.This is easy to do by going to Settings –> Bluetooth on your phone and tapping on the device you wish to pair with, just as you would do with a “ordinary” Bluetooth device.

Capabilities

To be able to communicate with Bluetooth Low energy (or Bluetooth Smart, as it’s also called) you need to add a capability to your app.This can’t be done from a GUI, you need to edit the package.appmanifest manually and add the following lines of code just above </Package>.

Find out what your device can do

GATT (Generic Attribute Profile) provides profile discovery and description services for Bluetooth Low Energy protocol, it basically makes it possible to ask your device what it can do. The documentation for this is very thorough and shows how to communicate.

Time for some fun, Lets make it beep!

In my case I have a Key finder (key fob) and it implements (among other services) the Immediate Alert Service, which makes it possible to make it beep.The GATT specification shows us how to communicate with the ImmediateAlertServiceDownload the PDF here.

The documentation shows us that if we want to set the alert level we need to do that with “Write without Response”.The different values for Alert Level can be found here.

This is a series of blog posts on how to do notifications in Universal apps.

Managing notifications can be a bit “tricky”, you need to edit xml (or write the xml as a string yourself).Luckily Microsoft has provided an Universal app project in their sample code that helps with creating notifications, it uses nice interfaces and classes to create the notifications.I took their help classes from the sample, compiled and uploaded it as a Nuget package to make it simple to do notifications.

Right click on the solution then choose “Manage Nuget packages for solution”

Search for NotificationsExtensions.UniversalApps, press install.

You need to make sure you add the package to both the Windows phone and the Windows Store project (you don’t need to add it to the shared project).

To be able to do notifications you also need to enable Toasts, open edit Package.appxmanifest in the Windows phone and Windows 8 project and set Toast capable to “yes”.

Now you are good to go!

Microsoft has made the tiles and toast templates available on both platforms (Awesome!), they may look a bit different, see links in each blog post: Live Tiles

How to use

The future

I hope to be able to add more veichles and helicopters to the API, please let me know (or contribute) what you want me too add =D

If you are an RC device manufacturer and would like to include your device in the API, please let me know and I’ll make it happen. Making the API I have used inspiration from the Lego EV3 codeplex project, I liked how they solved Bluetooth communication and I decided to do it basically the same way.

Source code for RC API is available on Codeplex and also available as a nuget package.

Let’s bring more gadgets and RC-stuff to the Windows platforms =D

2013

Here is my take on what is the most exciting products for the 2013 Christmas.Some are available and some will be available early 2014, I mention these cause they are so awesome it could be worth the wait.For those who know me, wait isn't what I do best so I feel your pain and I am sorry, I just had to include them.

Lumia 1520

Xbox One

If you live in a country that gets the Xbox One in the first batch, I guess it won't be on any Christmas list cause you already should have bought it :DFor those (like me) who live in a country that is not included in the first batch there might still be time to import one :)

Lego Mindstorms EV3

There is no age restrictions for Lego, this is a really awesome product.It has motors, sensors and you can build almost anything.The best part is that there is a .net library so you can build your own apps.

Raspberry Pi

A micro computer that runs Linux. It has everything you might need, Ethernet, hdmi, USB, audio and controllable pins you can use to connect to other things.Since it runs on Linux, Mono can be used to develop for it.

Agent Smartwatch

A wristwatch capable of running .net Micro framework code (how awesome is that?), much like the S.P.O.T watch back in the day.As far as I understand they won't ship until after Christmas bit there is an SDK already available so start coding :)

.NET Gadgeteer

Speaking of .NET micro framework, this is a fast prototyping kit, that makes building basically any electronics really easy.It has standardized connectors that means you don't have to know any electronics. It is really simple to get going.

Nymi

Kinect 2 for Windows

The new Kinect is even more sensitive than the first generation, it can even read your heartbeat *mind blown*.I think wearable tech is the next big thing, but lets face it, tech you don't even have to wear is even cooler.

Leap Motion

Anki

This is a racing track that connects to your iOS device (iPhone/iPad) using Bluetooth, the cars will drive around that track themselves but you control speed, lane and weapons. Yes weapons.Real cars and real track but software shields and weapons *bummer*.All the logic is in the iOS app and you can "upgrade" the cars with shields and new weapons.If you shoot a car it will derail.Very cool stuff so if you have an iPhone or iPad this is probably the must by Christmas gift this year.

If you don't find anything on the list or if you have a husband or wife that share my love for not waiting (eg already have or have ordered most of this stuff) you might consider printing your own.

3D Printer

There are many 3D printer out there. I like the cube 2, it is small and so is (sadly) the printing size. But it is large enough, the alternatives (having a reeeeally large one) isn't that appealing.If you have trouble convincing your wife about a 3D printer, show her that it is possible to print chocolate :PBesides that, Windows 8.1 has build in support for 3D Printers.

I recently got the Lego Mindstorms EV3-kit and of course I wanted to make a Windows Phone app to control it =D.Here is a tutorial on how to make your own.

The basics

The EV3 has 2 different types of ports, motors and sensors.Motor ports are A, B, C and D, Sensor ports are 1, 2, 3 and 4.

Check the firmware

To be able to use the API you need to have a firmware version >= 1.03, You can check the version on the brick from the Settings tab-> Brick Info –> Brick FWTo update the firmware run “LEGO MINDSTORMS EV3 Home Edition” and choose Tools –> Firmware Update

Enable Bluetooth

To be able to connect to the brick you need to enable Bluetooth you can do that on the brick from the Settings tab-> Bluetooth.Enable Visibility and Bluetooth.

Pair with the brick

Pair your phone with the brick by going to Settings –> Bluetooth tap on “EV3”, the brick will now ask Ii f its ok to pair and then show a pin code.Accept the default pin “1234” and enter it on the phone.

We are now all set up to start coding.

I have a Nokia Lumia 920 that I got from //Build, I can’t connect to the brick using that one, it might be a problem with all Lumia 920 developer phone (please let me know).Luckily I also have a retail Lumia 920 and I have tested this code on a Lumia 1020, 720, 920 and HTC 8X and it works great (just not the //Build one).

The API has the ability to connect to the EV3 by Wi-Fi, Bluetooth and USB for this project I will focus on Bluetooth only.

In MainPage.xamlCreate a button named “ConnectButton” and give it the text “Connect”Create a button named “MotorAForwardButton” and give it the text “Motor A forward”Create a button named “MotorStopButton” and give it the text “Stop”

Double click on each button to create the event handler in the code behind.

I have kept this sample really simple so you can get a quick start.You should always add error handling and you should disable the buttons unless you already connected and so on.This is just to get you started.I realize that this sample isn’t that exciting, but now we know how to control motors, time to kick things into gear and build some fun stuff =D

Last Christmas my mother-in-law gave me a Bluetooth controlled car.These kind of gifts are the best for a developer like me, its a toy/gadget and there is no app for Windows Phone which means I just got a gadget AND a development project.I have been in contact with Silverlit (the company that manufacture the car) who sadly decided not to take my offer of developing their app/API for free, and also didn't supply me with any details regarding the protocol (I guess they where short of resources).

Challenge accepted.

After a couple of weeks I managed to figure out the protocol .Now I have an API for the car ready but I would like Silverlits permission to release it before I do so.I am also working on making the API available for Windows 8.1.

</param></embed>

Me contorolling a Silverlit Ferrari 458 Italia with my Windows Phone

Currently Silverlit isn't returning my emails, not sure why (could be that the contacts I had doesn't work there anymore).If you know a good contact at Silverlit please let me know, I really would like to release this API so that more developers will be able to develop for this BT car because it is really awesome.

I’m currently watching all the videos from Build 2013 to be able to create a blog post with the best sessions from build.

If you also would like to watch all the videos here is a simple PowerShell script I found at Michael Crump’s blog with a small modification to get 2013 videos instead of 2011 and added more descriptive names.

A preview of Windows 8.1 is available for download and as if that isn’t awesome enough a preview of Visual Studio 2013 is also available.

At the keynote they showed the Windows Store version of outlook with social and newsletter filtering among other things.

Bing will be more integrated in Windows 8.1, in Sweden Bing isn’t that good, but as a visitor in the states I quickly realized that Bing is really good.

Sweden is still missing a lot of data.

When you search in Windows 8.1 you will get results from all the places, including web results.

Xbox Music has a new make over focused on playing music instead of discoverability and they showed off a function where you can share a web page to Xbox Music and it will parse the page and create a play list.

One of the biggest things here is 3d printing, Windows 8.1 has native support for 3D printing, its is just as simple as printing a piece of paper.

There are loads of 3D printers on display and they will start selling 3D printers in Microsofts stores soon.

I just wish Sweden will get one soon =D

Bluetooth is now available to developers (in windows 8.1) that means we have the opportunity to talk to all kinds of devices. I have really waited for that, going to be so fun to test how it works.

There are a couple of sessions at Build covering device communication I will try to catch them all.

Bing is brining a whole lot of APIs for searching, maps and much more.

The keynote ends with showing off Project Spark, a game development tool that makes it really easy to develop games.

I've been drooling over a yellow Nokia Lumia 920 for a while now, but since I already have two (one from Build 2012 and one from a contest) it was a bit hard to motivate another one =D.

After reading an article on WPCentral I decided to change the cover myself.

I bought a cover on ebay that includes the tools I needed to open the phone.

Opening the phone turned out not to be quite as simple as in this tear down video (You don’t have to do everything in the video). Remove the Sim card tray. Remove the screws at the bottom of the phone and bend in the corners, then carefully run you nail or plastic tool along the sides of the phone to release the snaps.

The really scary part is when you need to move the charging coils from one cover on to the other.

It is glued to the cover so remove it very very carefully! One trick you can try is to use a hairdryer to loosen the glue (as mentioned in the guide, see link below, I’m not sure if it actually helped or not).

Same thing goes for the headphone jack.

When my phone was done I noticed that my power button was hard to press, and since I use that button quite a lot I decided to take the buttons from my old cover and put them into my new.

The plastic piece holding the buttons in place was glued with glue a from hell so it took me and my screwdriver quite some time to get the plastic piece off.

Accelerometer + Gyroscope The accelerometer can tell the orientation of the phone by measuring the gravitational forces. The gyroscope measures the changes in the orientation which means when you start the gyro it won’t be able to tell you what orientation the phone has but it can tell when and how much the orientation changes. The motion API combines these two values to get the phone's orientation with the accelerometers and uses that as a baseline and then adjust these values with changes from the Gyroscope. The gyro has a tendency to drift over time so the accelerometer will be used to adjust the gyroscope from time to time.

Compass + Gyroscope The compass is a slow sensor and is used the same way as the accelerometer as a baseline for the gyro.

The Motion API uses the compass to get the heading (North) and then uses the gyro changes to adjust the bearing. Since the gyro has a tendency to drift (as I mentioned before) the compass will be used to adjust these values over time.

The compass is also very sensitive to magnetic fields and jumps around a lot, the gyro will smooth these readings out.

The gyro do not contribute with any “new” values, the accelerometer and compass will do just fine when it come to retrieving the phone's orientation and which way it is facing however it will speed up these readings and make them a whole lot smoother.

The gyro is also more precise for smaller movements.

I’m definitely seeing to that my next phone will have a gyroscope, it makes the augmented reality experience a whole lot better.

Quite simple huh? But there is a catch, the above code won’t work if you are using a regions format that uses comma instead of dot as a decimal separator. Swedish is one of those. I have tried some different ways of solving that by doing a reverse geocoding with the bing services but it didn’t help. I haven’t done a deep analysis of this but what I think happens is that the BingMapsDirectionsTask wont recognize the GeoCoordinates as a correct point and then uses the text I have supplied (in this case "start" and "stop") to try to find the address instead. But in this demo I don’t have the correct address, and IF I did it wouldn’t understand the special character of the swedish language (åäö) which will result in a box asking which address is the correct one, even though I know the correct GPS coordinates.

I don’t want to ask the user, the user won't know. My guess is that Microsoft will fix this soon, but perhaps not in Mango when it releases.

What can we do? There is a quite simple solution to solve this. Before you call the directions.Show() you can set the current culture to en-US and set it back. This is how I solved it:

It will however still have problems with Swedish characters in LabeledMapLocation labels so you might want to avoid to supply special characters. In this particular case the important thing to me is that the direction task is working.

Augmented reality has really caught my eye, I just love how the computer generated items interact with the real world.

I have played with the SLAR toolkit which is a really awesome library, but its a little bit limited in what it can do since you need a marker to get it to work.

How about augmented reality without markers? In mango, developers are given access to two necessary components to make augmented reality a ehm.. reality.

Raw camera access (So we can show what the camera sees) Compass (access to the compass)

With mango we also get a new sensor, the gyroscope (optional on mango phones).

When I first tried using the compass it didn’t work, that’s because I was running the Mango Beta supplied by Microsoft.

The drivers for the compass is not included in that build, it is supplied by the phone manufacturer later on in the process.

Let’s go through the available sensors

Accelerometer

An accelerometer measures acceleration forces. These could be static like measuring the constant pulling of gravity or more dynamic like moving (sudden starts and stops) or vibrating the accelerometer.

The normal use for an accelerometer is sensing if the phone is tilted (portrait or landscape) but can also be uses for example in games to steer something.

I got a few request on sharing the source so I cleaned up the code a little bit and posted the source for a version of that demo.

But let’s face it a 3d model on a piece of paper is cool but is there a way to make it even more exciting?

As you may or may not know I’m working on a ZX Spectrum emulator for Windows phone 7 and my goal is to have it ready very close to the mango release.

Perhaps integrate the two? How about an augmented reality ZX Spectrum emulator?

Short video

What amazes me is the performance of these phones, I have the Samsung Omnia 7 and it manages detecting the marker, showing the camera feed, rendering the 3d model and emulating a ZX Spectrum with sound and all at 25 fps.

With the release of Mango, the new OS upgrade for Windows Phone 7, it will be possible to create augmented reality applications.

Sadly the beta version of the mango update doesn’t have drivers for the compass which kind of spoils most of the plans I had for augmented reality applications.

Then I realised maybe I could do something with the SLARToolkit. All the samples I could find used Silverlight (not a big surprise right?) no samples used the new XNA + Silverlight combination available in Windows Phone 7 so I decided to give it a try.

Since I’m working on a ZX Spectrum Emulator for Windows Phone 7 I used a ZX Spectrum 3d model that I made a couple of years ago (maybe this feature will make it in to the emulator =) ).

I’m not an XNA superstar and this project really showed me that I need to read more About Matrix

When using the Applicationbar in WP7 I noticed that it can’t be translated like all the other controls.

Therefore I built a simple helper class to help with the translations.

The usage is simple, just add the translations in a resource file (like you normally would) and then set the text property on the buttons or menu items to the name in the resource file. Change the access modifier to public.

The Resources:

The xaml:

Now in the page loaded event add:ApplicationBarHelper.LocalizeAppBar(newAppResource (), ApplicationBar);

Your application bar will now be automagically translated.

Update 2011-09-30 Found a small bug where “No Translation” was shown the second time the page was shown (and the translation was already done). I have updated the sample code to fix that problem.