keskiviikko 4. elokuuta 2010

Using libmirror to read RFID tags with Violet's Mir:ror-reader


Libmirror is .NET-library that allows reading RFID tags with cheap reader from Violet called Mir:ror. Libmirror works in Windows on top of .NET Framework but by design it should also work in Linux and Mac OS X over mono but that hasn't been tested. Reader itself supports both A and B standards, connects to USB, looks cool and costs only about 50 €.
Violet is more known for their bunny Nabaztag. Personally I find the Nabaztag bunny pretty useless as also the Internet of Things ideology behind Mir:ror. At August 2009 Violet filed bankruptcy as their business seemed to have failed. Few months after bankruptcy, in October 2009, Violet was acquired by Mindscape. Recently the availability of Mir:rors and Nabaztags has resumed to pre-bankruptcy level so I decided to resurrect the libmirror projects.
Usually Mir:ror is used together with Violet's Mirware application that is based around the idea of internet of things. This means that every time you show RFID tag for the reader it will send it's identifier to Violet's server and look for any associated actions or applications. If applications or actions are found, them are then executed on client machine. For example you can associate action open URL with tag attached to umbrella and it will open Internet weather forecast site for you.
Libmirror frees Mir:ror from its restrictions and allows you to communicate directly with it without annoying Mirware. Current 2.0 version allows getting events for tag shown, hid, orientation changed and device removed.
Choreographies would allow controlling leds and sounds of Mir:ror but currently support for choreographies is non-existent as no-one has been able to reverse engineer the protocol. Currently it is possible to disable sounds and lights of device by calling SetChoreoOff after initialization before any tags are shown for the device but as no-one really understands the protocol I would recommend against using any methods related to choreographies. It's also possible to re-enable lights and sounds by calling PlayChoreo. That command also replays previous choreography.
To use libmirror go to https://sourceforge.net/projects/libmirror/ and download latest version. Currently library uses 3.5 framework and should work on both 32 bit and 64 bit projects.
To get all connected mirrors you need to call MirrorFactory.GetMirrors() or if you want only the first one call MirrorFactory.GetMirror(). Here is example how to initialize one Mir:ror and attach events to it.
var description = MirrorFactory.GetMirror();
if( !description.IsInUse )
{
    var mirror = description.Create();
    mirror.TagShown += OnTagShown;
    mirror.DeviceRemoved += OnDeviceRemoved;
    mirror.OrientationChanged += OnOrientationChanged;
}
Remember that HIDDevice objects has to be correctly disposed otherwise device might appear in use as handler to device stays open until garbage collector disposes the object. This should be done with using syntax or binding to DeviceRemoved event and then gracefully disposing the object. Note that if you don't handle DeviceRemoved event then DeviceRemovedException is thrown by next method that tries to read or write to mirror. Here is example how to handle DeviceRemoved event.
private void OnDeviceRemoved(object sender, DeviceRemovedEventArgs e)
{
    e.Device.Dispose();
    e.IsHandled = true;
}

Other related projects and resources at net:

9 kommenttia:

  1. I have read this post. collection of post is a nice one ..that am doing website designing company chennai india and website development company chennai india. That I will inform about your post to my friends and all the best for your future posts..

    VastaaPoista
  2. As online businesses have bloomed on the World Wide Web, it has facilitated entry of different technologies into the business environment; SharePoint services being one of them.

    .Net Development

    VastaaPoista
  3. Hey!
    After a long time I got something fresh and quality content on related topic. I searched a lot for the related material but got almost replica work. Keep it up! It is really very informative.

    Vachel
    .NET Development Chicago
    cmscentral.net

    VastaaPoista
  4. Hey!
    I'm truly enjoying the design and layout of your site. I can’t resist myself to leave a comment and trust me it’s hard to impress me.

    Vachel
    PHP Development Chicago
    .NET Development Chicago
    Chicago Development Team
    cmscentral.net

    VastaaPoista
  5. Kirjoittaja on poistanut tämän kommentin.

    VastaaPoista
  6. Dot NET development, ASP development, SharePoint development
    .NET development, Microsoft development , software development, Singapore – Total eBiz Solutions Home

    VastaaPoista
  7. This is a new contain RFID tags is use in .net language in Mirror i have some time search this tage thank for give knowledge this tag

    Php development chicago

    VastaaPoista
  8. .NET framework offers you to create secure Application design in which you can also work in ASP development and share point development.

    VastaaPoista
  9. ASP.NET is a web development framework that’s behind many of the internet’s most dynamic websites, web-based systems and mobile applications.
    .net development sydney

    VastaaPoista