Thursday, November 1, 2018

How many hours do you spend on the development of the blessTags application?

       This is a very hard question. I have never been counting how much time I spent in developing the blessTags application. With the release of each new version, the number of code lines that the new version of the application has it is counted and presented to the users - please see the blessTags version history section. This indicator, the number of code lines of the blessTags application, it is a very good reference for the efforts made in developing the application. But that's not all. Testing the newly developed features, testing their integration with the rest of the application also takes a lot of time.
       In order to highlight these efforts (made in the testing phase of the application), but also those deployed in the development of the blessTags application, I think an image is much more exciting. 
       In the below figure, I present all the coins batteries (CR2032) depleted in the last 6-8 months in the development phase and testing phase of the blessTags application with different types of the SensorTags.

Q&A (question and answer) section

      In this section of this blog, I will answer the various questions from users of the blessTags application. So, if you have questions on which do you have not found answers in the pages of this blog, please email me at mdobrea at - I will answer at each of them. If a question is repeated constantly by many users or the response to a specific question concerns more users of the blessTags application, I will post the answer to it on this page.

  1. Howmany hours do you spend on the development of the blessTagsapplication?

Tuesday, August 28, 2018

Services, Characteristics, Descriptors and Declarations in Bluetooth BLE

      When we interact with a SensorTag device, we interact with a specific element named Attribute. Services, Characteristics, Descriptors, and Declaration are different types of Attribute.
      The behavior of a BLE device (a SensorTag) is given by the different Services that encapsulate different parts of this behavior. Mainly, a service is a container for different data items – these data items can be read (e.g. a sensor value from a SensorTag) or write (e.g. we must write a value in order to configure a sensor – for example, to set the dynamic range for the accelerometer sensor). For example, the behavior of the ThunderBoard Sense SensorTag is encapsulated in the following services
  • Generic Access Service (UUID = 0x1800);
  • Generic Attribute Service (UUID = 0x1801);
  • Device Information Service (UUID = 0x180A);
  • Battery Service (UUID = 0x180F);
  • Environment Sensing Service (UUID = 0x181A);
  • Power Management Service (UUID = EC61A454-ED00-A5E8-B8F9-DE9EC026EC51);
  • Indoor Air Quality Service (UUID = EFD658AE-C400-EF33-76E7-91B00019103B);
  • User Interface Service (UUID = FCB89C40-C600-59F3-7DC3-5ECE444A401B);
  • Automation IO Service (UUID = 0x1815) and
  • Acceleration Orientation Service (UUID = A4E649F4-4BE5-11E5-885D-FEFF819CDC9F).
     As a conclusion, a service represents a specific hardware feature of a SensorTag (or to other type of Bluetooth device) – e.g. in ThunderBoard Sense SensorTag the sensors values related with the air quality (these sensors can detect the existence of ethanol and hazardous gases such as carbon monoxide and a wide range of volatile organic compounds) are grouped in Indoor Air Quality Service. The complete table with all information regarding the services for ThunderBoard Sense SensorTag can be found here. The blessTags software gives the possibility to interrogate different types of unknown BLE devices – in order to be able to obtain the complete GATT attribute table for an unknown BLE device several steps must be done, such example can be found here.

     In a Bluetooth device, a service contains, at least, one or more characteristics. A characteristic owns none or more descriptors. The descriptors are completely optional, but a service must contain at least one characteristic. Each service, characteristic and descriptor must be identified by a unique identifier (UUID). UUIDs can be 16- or 128-bit values. For example, the Generic Access Service (presented above) have a UUID on 16 bits value (0x1800) while the service Acceleration Orientation Service (presented above) have a UUID on 128 bits value (A4E649F4-4BE5-11E5-885D-FEFF819CDC9F).
     A characteristic of a service is related to an internal state of a BLE device – e.g. a value that quantifies the volatile organic compounds from the air, obtained from the CCS811 digital gas sensor embedded inside the ThunderBoard Sense SensorTag. Also, Characteristics contain various properties. A property describes what another device (a client) can do with a characteristic over Bluetooth.  The operations such as READ, WRITE, NOTIFY or INDICATE are permitted or not, functions of specific value defined by a property associated with a characteristic. For a deep description of properties please visit the post “Reading vs. notifying”

Example 1: So, let’s take an example. The Service Automation IO Service (with the short UUID = 0x1815 and with the long UUID = 00001815-0000-1000-8000-00805F9B34FB) have two Characteristics. The first one with UUID_0 = 0x2a56 and the second one with UUID_1 = 0x2a56. The first Characteristics owns three Descriptors, with UUIDs: 0x2902, 0x2904 and 0x2909. The second Characteristics owns only two descriptors with the UUIDs: 0x2902 and 0x2909. See the figure from below (the figure was obtained with the developer function of the blessTags application).

     The characteristics UUID can be predefined ones - like the ones presented above with the UUID = 0x2a56. These predefine UUIDs have specific functions associated by the Bluetooth BLE standard.  The Characteristic’s UUIDs defined by Bluetooth BLE standard always follow the formats: (a) 0x2A[xx] – where the [xx] are two hex values and (b) 0x2B[yy] – where the [yy] are hex values.
     The Descriptors are special types of attributes that describe a characteristic value (they contain different type of metadata, based on this information they augment a characteristic) with which they are associated. A very important descriptor is the Client Characteristic Configuration Descriptor (abbreviated to CCCD) – based on this descriptor the notification messages can be switched on or off.  Up to now, descriptors have associated only short UUIDs (16 bits value). The descriptor’s UUIDs identifiers always follow the format: 0x290[y] – where the [y] value is a hex number.
     A special type of attribute is the declarations. The declarations are used to separate distinct group of attributes: in services and inside a service in characteristics. A Service Declaration attribute has always the standard UUID the 0x2800 value. The Characteristic Declaration have the standard UUID the 0x2803 value. Please see this in the figure presented above. The declaration’s UUIDs identifiers always follow the format: 0x280[z] – where the [z] value is a hex number as follow {0, 1, 2, 3}.

Example 2: In ThunderBoard Sense, the service Indoor Air Quality Service has three characteristics – the service attribute table is presented in the above picture. A service starts with a Service Declaration attribute (UUID = 0x2800) and each characteristic is separated by the other characteristics with a Characteristic Declaration (UUID = 0x2803). All the characteristics UUIDs, of this service, are not defined in Bluetooth BLE standard – have UUIDs different from 0x2A[xx] and 0x2AB[yy] format. In this case, the UUIDs values are defined by the producer of the ThunderBoard Sense SensorTagthe Silicon Labs company. The third characteristic has associated only one descriptor – the CCCD. To access the data from the first two characteristics, a READ operation must be initiated – the [R] property in the figure.

      Starting with the version of the blessTags application all the characteristics (more than 200 characteristics) defined by the Bluetooth BLE standard are identified and presented to the user.

Example 3: To understand better the advantage of knowing the characteristics defined by the Bluetooth BLE standard, below are presented: (a) the attribute table for the Device Information Service (UUID = 0x180A) knowing the characteristics defined by the Bluetooth BLE standard – the first figure presented below and (b) the same table unknowing the characteristics defined by the Bluetooth BLE standard – the second image presented below.

The blessTags application can be downloaded from the Windows Store Apps:
The blessTags Lite application (the free version of blessTags) can be downloaded from the Windows Store Apps:

Thank you very much for reading this article and your interest in Bluetooth LE technology!

Tuesday, July 31, 2018


     An activity is a specific action that the blessTags application will execute when a specific event will take place. Here we have two key concepts: event and action.
     Events are things that happen within your blessTags app. environment at which you might want to take a specific action. An event is triggered from a specific value (a numerical value presented in black color on the blessTags user interface) obtained from an active sensor placed inside a SensorTag.

     The values types able to generate events are the instantaneous value, the mean value or the variance value of the data flow from a specific sensor or a specific channel from a specific sensor (e.g. channel Z of the gyroscopic sensor). If the desired value (instantaneous, mean or the variance) is lower or higher than a threshold value or is inside or outside of a specific range of values an event will be generated.


Execute an action

     After an event has taken place, an action will be executed. At this moment, on blessTags app., several actions are implemented: run an application selected by the user, send an email, quit the blessTags application, lock, hibernate, sleep, logoff or shutdown the system (the device on which the blessTags application is running). 

     Since the application allows the user to select up to 2 actions to be executed, there must be a clear priority between these actions (which action will be executed first, and which action will be executed second). So, regardless of the selected sequences, the execution priorities are the following ones:
  1. Send an email;
  2. Run a user selected application;
  3. Hibernate, sleep, lock, logoff, restart, and shutdown;
  4. Quit the blessTags application.
     In the video presented below, I will show you this new product feature (starting from version) of the blessTags application: activities.

Sending an email

     The blessTags application can send emails when a specific event occurs. However, in order for this feature to work properly, we need to configure correctly the mail engine of the blessTags. To do this, a special panel was developed – see below.

     In the upper part of the panel are placed the SMTP (Simple Mail Transfer Protocol) server settings. The SMTP server is the server that will take care of the delivery of your emails. Here you have 2 edit boxes (Host and Port) and one ring control (Security type) to set the SMTP server. The Host is the DNS name of your SMTP server - you can find it consulting the web page of your provider. The Port is the endpoint of your computer connection – different number are associated with different types of protocols. The default SMTP port (default transmission channel for internet email) is 25. The mail engine of the blessTags application support SSL connection on 465 (25025) port or TLS connection on 587 (2525 - it is an alternate port, which mirrors port 587 and also supports TLS encryption) port. In any case, the email provider may decide to use a custom port to establish the connection – in such case please consults the web information of your provider. The security type ring control allows you to configure the encryption of your transfer: no encryption or to use an encrypted communication like STARTTLS or SSL/TLS.
     You can manually enter the SMTP settings for your server or you can use the fourth ring control that encapsulates SMTP server settings for nine of the commonly used email services: Google (Gmail), Microsoft (Outlook/Hotmail), Yahoo (Yahoo! Mail), Zoho, AOL (AOL Mail), GMX, Lycos, Yandex, and All the setting information, for these SMTP servers, were collected from the official sources (namely, the official websites of these company) and were tested previously. But you may consider that the email service provider may change its mail server settings without any prior notification. I suggested you to contact your email service provider in case you encounter any error during the account setup.
     In the following fields, you must enter the username and the password. These information are specific for each mail server. A bit lower you must enter the email addresses, select the priority of your email, the email’s subject and the body of your email. All these fields are constrained to 60 chars, apart from email’s body which is limited to 90 characters.
    The test button lets you send an email when you click on it. If this email arrives well, then it means that everything is set up correctly and when an event will occur the email that will be sent will certainly arrive also. In this panel as long as your blessTags application sends a message, the LED will be red and the “Send a test email” button disabled.
     A very nice feature specific to the mail engine of the blessTags is that you can include two types of specific strings (in the body text of your email) that will be replaced by the date (%d) and by the time (%t) of the device on which the blessTags application is running.
     For example, an email sent in this form:

will arrive at the destination in this form:

     A small problem that may occur from time to time is that some email providers accept the user's name in the username field, while others want the full email address. For example, the Gmail email provider accepts mdobrea or as a username, while others, like GMX, accepts only as a username.
     The entire configuration process if the mail engine of the blessTags is presented in the following movie.

Thursday, June 21, 2018

Converting a Windows MSI package to an APPX


    This article is a tutorial that will present to you all the steps required to take in order to convert a traditional Windows app into the Windows 10 app packaging format (APPX). Appx is a special type of software package format used by the Windows developers to put together code and resources and, finally, to submit for publication the program in Windows Apps Store.

   In fact, all the steps I will present here are the steps I have made to develop the blessTags application (Windows Store link - the only app able to manage 4 different SensorTags) and the blessTags Lite application (Windows Store link) – a free version of blessTags applications.



  1. A computer with Windows 10 Professional or Enterprise operating system (OS);
  2. A  64 bit (x64) processor with support for: (a) Hardware-assisted virtualization and (b) Second Level Address Translation (SLAT)
  3. Desktop App Converter tool;
  4. The base Windows image;
  5. Windows 10 SDK;
  6. An existing installer (a MSI file) of your application – in a following post, I will present how to generate a MSI file, from the LabWindows CVI environment, able to work as an UWP application.

 Components installation:

  1. Update the windows. Desktop App Converter requires at least Windows 10 Anniversary Update to work - version 1607 (released on August 2, 2016; end of support: April 10, 2018; end of additional servicing: October 9, 2018).
  2. Install the Desktop App Converter tool itself, from the following link:
  1. Download the base Windows image. This package is used as a container and it is required in order to generate your AppX package. But, each type of Windows (each specific build like 17134, 16299, 15063 or 14393) needs to have a matching base Windows image for the Desktop App Converter to work correctly. As a result:
    1. First, find your Windows build version. Press Win + R keys together to launch the RUN dialog box and then type cmd and press Enter.
    1. From there, you can find the needed information – the build number: the number placed inside the red rectangle.
    2. From the following link download the base Windows image associated with your Windows build (this file is big, approximately 3.3 GB, be prepared to have enough free space on the HDD):
  1. Run Desktop App Converter as administrator (under administrative privileges): Press Win key → Desktop App Converter + click rightMoreRun as administrator (see the figure from below). 
  1. Bypass the standard Windows execution policies:
PS C:\Windows\system32> Set-ExecutionPolicy bypass
  1. Install the base Windows image, by executing the following command:
PS C:\Windows\system32> DesktopAppConverter.exe -Setup -BaseImage "D:\Windows_BaseImage_DAC_17134.wim" -Verbose
  1. A container is the equivalent of a virtual machine; a virtual machine of a specific type sustained by the fewest number of components from the Windows operating system. So, a container = a "little" virtual machine. Containers enable you to execute an application in an isolated environment. In order to build an APPX, you will need the windows feature “Container”. So, you have several options to install “Containers”:
    1. If in the process to install the base image, you will receive the following warning: “WARNING: DesktopAppConverter : warning 'W_ENABLING_FEATURE': Required feature 'Containers' is not enabled. Attempting to enable it now (this will require a restart)”. Respond with yes to restart the computer and the component will be installed automatically.
    2. You can manually install this feature (use one of the two options, depending on the version of your OS): 
      • Right-click on the Start button, choose Apps and Features, from the right Programs and features and, in the left panel, the option Turn Windows features on or off. Here tick the “Container” component.
      • Right-click on the Start button, choose Programs and features and, in the left panel, the option Turn Windows features on or off. Here tick the “Container” component.
    1. In an elevated PowerShell session, with Administrator rights, please use the following command:
PS C:\Windows\system32> Enable-WindowsOptionalFeature -Online
-FeatureName containers –All
    1. The worst scenario is when you will receive the following error: “DesktopAppConverter : error 'E_FEATURE_NOT_AVAILABLE': Required Windows Feature 'Containers' is not available on your system”. This error means your system does not have the Container feature!!! To have the Container feature as a component of the Windows OS you need to run the Professional or Enterprise version of Windows 10. The previous message has warned you that this component is not available because your computer it runs an operating system that does not support it. So, upgrade or downgrade your OS in order to match the requirements: Windows 10 Professional or Enterprise versions.
  1. To perform the conversion process, you will need also the Windows 10 SDK installed on your system. Download the Windows 10 SDK from here and install it. 

 Building the AppX

    Right now, you have all components installed and set. You are ready now to create your first application AppX file.  
     I am going to present two ways to build an AppX file. Each approach tracks a different goal: (1) to submit your AppX to the Windows Store and (2) to test your app locally on your PC.


So, first, let us build an Appx for Windows Store submission:

  1. In the first step, put the file with the extension MSI (SensorTag_BLE.msi in my case) into the folder:

    In order to have an error-free conversion, it is very important that your installer to be capable of silent/quiet installation - i.e. that it does not display one or more blocking user interface messages (e.g. to ask the user to press a couple of Next buttons). This requirement must be obeyed since in the conversion process you will not be able to interact with your application installer.
  1. Run Desktop App Converter (DAC) under administrative privileges.
  2. Inside the DAC environment run the command:
Some helpful information:
  • The Destination parameter is the place where the AppX package will be placed, not where the app is installed.
  • Note that the least-significant value of the Version (revision number) must be zero. For example, instead of the, you must use as the version number. 
  • The parameters PackageName, Publisher and PackagePublisherDisplayName must be the same as the ones from your developer account: App ManagementApp Identity (see the information from the figure presented below).
  • MakeAppx has the significance that, other than generating the folder that will contain all the files that need to be packaged, you want also to generate the AppX package. In our case, this parameter can be excluded – anyway, we will build the AppX manually.
  • If the installer package (MSI file) ask the user to press a couple of Next buttons, it is possible that the installer still offers a silent installation mode, but it requires to be launched with a special parameter (like Setup.exe /s).  If that is your case, please specify this information with an additional parameter provided to the Desktop App Converter called “InstallerArguments”. For example, the previous command would be completed with: 
-InstallerArguments "/s"  
  1. Check if between the files used to build the AppX package (in this case all placed in the folder: d:\Temp\InstallerWork\Output\82971DobreaDan.BLESensorTags\PackageFiles\) you have an “uninstall.exe” file. If yes, delete this file. Uninstall.exe requires administrative privileges and Microsoft does not allow this for a UWP application.
      The following steps are required only you deleted the Uninstall.exe files otherwise you already have the file 82971DobreaDan.BLESensorTags.appx required to be submitted to the Microsoft Store.
  1. Now delete the file: 82971DobreaDan.BLESensorTags.appx.
  2. Being in the folder d:\Temp\InstallerWork\Output\82971DobreaDan.BLESensorTags run the command (MakeAppx.exe - creates an application package from the individual files on the disk):
"c:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64\makeappx.exe"
pack /d d:\Temp\InstallerWork\Output\82971DobreaDan.BLESensorTags\PackageFiles
/l /p BLESensorTags.appx
  1. And as a result finally, you have the file: BLESensorTags.appx.

Second, we will build the package required in order to install your app locally on your PC:

  1.  Put the file with the extension MSI (SensorTag_BLE.msi file in my case) into the folder:
  1. Run Desktop App Converter (DAC) under administrative privileges.
  2. Inside the DAC, run the same command as it was presented previously (at the third step) but at the end add “-Sign”.  The Sign parameter allows to automatically generate a certificate needed to properly sign the AppX package. Without this digital signature, the AppX package cannot be installed on a PC, which will not trust the application without an associated certificate.
  3. Enable Sideloading: you can install an Appx or an AppxBundle software package only if sideloading is enabled on your Windows 10 device. So, follow the steps: SettingsUpdate & SecurityFor Developers. In this point, set either “Sideload apps” or “Developer mode”.
  1. Now, manually install an AppX package without using the Microsoft Store. Just:
    1. double-click on the file 82971DobreaDan.BLESensorTags.appx or
    2. run the following cmdlet within PowerShell:
PS C:\Windows\system32> Add-AppxPackage -Path
            and you will be prompted with a dialog similar with the following one: 

  1. Pressing the Install button and the following error will appear:

     The reason for this error is that an AppX package must be signed with a valid certificate in order to be installed and this certificate needs to be trusted by the computer. To solve this problem, you will need to add the certificate (generated automatically by the “Sign” parameter) in the Trusted Root Certification Authority of the computer.
  1. Double click on auto-generated.cer and choose Install certificate.
  2. On the new window, choose Local machine and then the option Place all certificates in the following store
  3. By pressing the Browse button, make sure to choose Trusted Root Certification Authorities and complete the process.
  4. Tray again the steps 4 and 5. Now, after pressing the Install button, you will see a progress bar showing the installation status.

 Other problems and solutions


Windows 10 update

     With a new Windows 10 update, your specific build (like 16299) will go to another superior build (e.g. 17134) But, each specific Windows build needs to have a matching base Windows image for the Desktop App Converter to work correctly. So, a new base Windows image must be installed. For this, follow the steps:
  1. Open Desktop App Converter (DAC) with Administrative rights.
  2. You need to clean up the old base Windows image, otherwise the tool won’t be able to install the new one. To do it, you perform the following command: 
PS C:\Windows\system32>  DesktopAppConverter -Cleanup "ExpandedImage" –Verbose
  1. Once the operation is completed, you are ready to install the new base Windows image. So, follow the step 3 from the Components installation sub-chapter.


     After you install your application, several times (dozens or hundreds of installations) locally and from the store to test different scenarios, you may face different types of problems while using Windows Store such as:
  • You can't update or install apps from Windows Store,
  • Frequent Store apps crashing or freezing problems,
  • Windows Store apps won't open or give error messages,
  • Windows Store opens and suddenly closes etc.
     After I tested several solutions to fix them, I discovered the ultimate solution, which will fix all these apps related problems (in 70% of the cases): WSReset. WSRese is OS’s program that can be used to clear and reset Windows Store cache. So, do the steps are:
  1. Press WIN+R keys together to launch RUN dialog box and then type wsreset and press Enter.
  2. It will immediately start the cache resetting process which may take a few moments. After clearing the cache, it'll launch Windows Store.
     WSReset.exe file is present in C:\Windows\System32 folder. You can also directly launch it from there.     If you are worried about your personalized settings or installed apps, no problem! WSReset command does not change any application setting or remove any previously installed app. It just clears Windows Store cache.

-= πŸ‘πŸ‘πŸ‘ =-