Merge pull request #168 from vcgomes/bluetooth-fix-invalid-access

bluetooth: Fix accessing invalid memory when creating the service proxy
Fix the style of the Power API JS file using the new checking tool.

Issue #162
Merge pull request #169 from darktears/power-style-fix

Fix the style of the Power API JS file using the new checking tool.
[Time] Fix the style of Time API JS File using the new checking tool.

Issue #165
Merge pull request #170 from ricardotk/wip

[Time] Fix the style of Time API JS File using the new checking tool.
[Notification] Clean up example a bit
[Notification] Fix JS style

Fixes #161.
Merge pull request #172 from cmarcelo/notification-cleanup

Notification cleanup
[Power] Fix a TCT failure with isScreenOn()

TCT tests are expecting turnScreenOn/Off to have a synchronous behavior
which in fact means that querying the screen state right after should
return the correct value. In fact the underlaying platform does not
necessarily switch on or off the screen right away, it may take few
ms. This patch add a synchronous behavior to isScreenOn by
making sure to return when the platform informed us about the state
change of the screen (if called previously with turnScreenOn/Off).
This is slightly better than a busy wait.
Merge pull request #171 from darktears/power-isscreenon-fix

[Power] Fix a TCT failure with isScreenOn()
bluetooth: Add BluetoothSocket.readData()

This will only return valid data if called during onmessage() callback.
bluetooth: Add support for BluetoothSocket.onclose() callback

This function will be called when the socket is closed.
bluetooth: Add support for BluetoothSocket.writeData()

writeData() is implemented using a "sync" message, because we need
to reply to the caller the number of bytes written.
bluetooth: Notify that the socket has closed

In some cases, the socket may close unexpectedly, for example, the
remote device goes out of range, we need to notify that the socket
has been closed in these cases.
bluetooth: Add BluetoothSocket.close()

This method allows the application to request the socket to
be closed.