Wiced Sense C++ Applications

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

I am trying to develop a simple C++ application that will grab real time sensor data from the Wiced Sense SDK and hardware.

I have successfully modified the HelloClient windows app to be a simple console application (without MFC).  I have verified I can grab simple device information like battery life and manufacturer/model names.

Now what I am unsure about is how to enable notifications from the device.  Beyond that, once notifications are enabled, how do I poll for sensor data?  Do I need a callback that will hit everytime the BLE device gets data?  I am a bit lost here and since the documentation is a bit sparse, and code not well commented, I am not really sure what I should be doing from here.

There is a function called RegisterNotification(); in the Win8Interface.cpp file, but I am not clear on how I should be using this function.

I have tried analyzing the Android app code to see if I can figure out how its enabling notifications and live streaming sensor data, but havent found the clues I need.

Can anyone lend a hand or point me to some documentation I might have missed?

Thanks in advance,

Justin

0 Likes
1 Solution
Anonymous
Not applicable

Thankyou Vik86.  FYI - I was able to successfully modify the Hello Client windows app example to grab sensor data from the Wiced Sense.  It was not very straightforward and we had to port code over from using MFC and change alot of the variable types from wide character string (wcstr) types to standard (cstr) to work as a simple console application.

I look forward to seeing your official windows wiced sense app example.

Thanks.

View solution in original post

0 Likes
6 Replies
Anonymous
Not applicable

Hello jschunick,

Take a look at this Table of Contents:

WICED Sense Table of Contents

Specifically these sections:

WICED Sense Firmware Walk-Thru Video

WICED Sensor Data Format

Thanks

JT

0 Likes
Anonymous
Not applicable

Hi JT,

I have already reviewd all of the videos and documentation found on your website, but it doesnt speak to anything regarding C++ windows application development.

You have a helloclient.exe app example, which I am trying to use, but it is not documented or commented very well.  I need to figure out how to enable notifications using the functions already existing in the code that Broadcom provided.

The function, I believe, is:  RegisterNotification()

Is this the correct function?  I try running the function, but it doesnt seem to take any inputs to send enable or disable notifications.  From your code:

void CBtWin8Interface::RegisterNotification()

{

  // register to receive notification

  GUID guid = UUID_HELLO_SERVICE;

  HANDLE hService = OpenBleService(&m_bth, &guid);

  if (hService == INVALID_HANDLE_VALUE)

    return;

  BLUETOOTH_GATT_VALUE_CHANGED_EVENT_REGISTRATION reg;

  reg.NumCharacteristics = 1;

  reg.Characteristics[0] = m_charHelloNotify;

  if (m_pEventHandle == INVALID_HANDLE_VALUE)

  {

    HRESULT hr = BluetoothGATTRegisterEvent(hService, CharacteristicValueChangedEvent, &reg, &NotificationCallback, m_NotificationContext, &m_pEventHandle, BLUETOOTH_GATT_FLAG_NONE);

    ods("BluetoothGATTRegisterEvent hr:0x%x\n", hr);

  }

  CloseHandle(hService);

}

0 Likes
Anonymous
Not applicable

@mwf_mmfae,

You have a C++ windows application example in your SDK.  I am referring to the visual studio project, which is located here:  \\WICED-Smart-SDK-2.1.1\WICED-Smart-SDK\Apps\hello_sensor\peerapps\Windows\HelloClient

0 Likes

We have a windows client app to read sensor data, its being tested right now, once we have it we shall post that .

Thnx

vik86

Anonymous
Not applicable

Thankyou Vik86.  FYI - I was able to successfully modify the Hello Client windows app example to grab sensor data from the Wiced Sense.  It was not very straightforward and we had to port code over from using MFC and change alot of the variable types from wide character string (wcstr) types to standard (cstr) to work as a simple console application.

I look forward to seeing your official windows wiced sense app example.

Thanks.

0 Likes