why i can not find this files:XDK_community?  Do i need download something?
please help me ,thank you
0 (0 Votes)
why i can not find this files: XDK_community - access sensor data
Answer
4/25/16 6:57 AM as a reply to Shen Mingning.
Hello,

I will try to help you with your issue. To do so I need further information about what you are trying to do with this file or why you are searching for it ?

Kind regards,
Franjo
0 (0 Votes)
why i can not find this files: XDK_community - access sensor data
Answer
4/25/16 12:22 PM as a reply to Franjo Stjepandic.
I want to learn how to import a project in guiding of the tutorial.i operate step by step.but the project is load from that file in the tutorial.but i can not find that files.so please help me.thank you
0 (0 Votes)
why i can not find this files: XDK_community - access sensor data
Answer
4/25/16 1:28 PM as a reply to Shen Mingning.
Hello,

I checked the tutorial you are trying to solve. The rootpath as you can see in step3 is an example of the writer of the tutorial. If you want to import any project, you have to set up the correct path to the project file. For example if you download the Datalogger Demo, you have to set up the path to:

…/YourDownloadFolder/XDK_Data_logger/XDK

Please tell me if this helps you.

Kind regards,
Franjo
0 (0 Votes)
why i can not find this files: XDK_community - access sensor data
Answer
4/26/16 6:05 AM as a reply to Franjo Stjepandic.
i want run the DSM_demoSensorMonitor ,but i can not find it,i want to ask :did i need dowmload this project? why i can't find it
0 (0 Votes)
why i can not find this files: XDK_community - access sensor data
Answer
4/26/16 6:22 AM as a reply to Shen Mingning.
Hello,

the demoproject DSM_demoSensorMonitor is not integrated as example project in the workbench. You have to download it from the download section in the community. Unfortunatly it is currently unavailable to download.

Kind regards,
Franjo
0 (0 Votes)
why i can not find this files: XDK_community - access sensor data
Answer
4/26/16 11:46 PM as a reply to Franjo Stjepandic.
Oh,i know,thank you,but i have another question: how to check the temperature and vibration value the sensor measured?
0 (0 Votes)
why i can not find this files: XDK_community - access sensor data
Answer
5/10/16 5:59 AM as a reply to Shen Mingning.
Hello,

Unfortunately there is no tutorial, how to read and initialize the sensors of the XDK right now.

For your case, I wrote some basic code snippets. The example code initializes and reads the data of the accelerator and the temperature sensor.
The values of the read data will be printed on the console. Because there is no option to upload code,
I will give you code examples in this thread with short explanations.

First of all, you will use the XdkApplicationTemplate example to embed the following code.
In the XdkApplicationTemplate.h file you have embed the next three lines of code.
 

#define ONESECONDDELAY UINT32_C(1000)

static void initSensors(OS_timerHandle_tp xTimer);

static void readSensors(OS_timerHandle_tp xTimer);


The define represents an one second delay, that will be neccessary for the timer initialization.
The first function will initialize the sensors, the second one will read the data values from the sensors.

In the XdkApplicationTemplate.c file you have to include the following headerfiles.
 

#include <stdio.h>

#include "XdkSensorHandle.h"

#include "BCDS_AbsoluteHumidity.h"


At the next step you have declare and initialize the following local variables.
 

OS_timerHandle_tp sensorInitTimerHandle_gdt = NULL;

OS_timerHandle_tp readSensordataTimerHandle = NULL;


These two variables will be necessary for the timer sequences.
Successive, you have to initialize the sensors and start a periodic timer.
 

static void initSensors(OS_timerHandle_tp xTimer) {
 
 (void) xTimer;
 Retcode_T returnValue = RETCODE_FAILURE;

  /* initialize environmental sensor */
  returnValue = Environmental_init(xdkEnvironmental_BME280_Handle);
  if ( RETCODE_OK != returnValue) {
    printf("Environmental Sensor initialization failed\n\r");
  }

  /* initialize calibrated accelerator */
  returnValue = RETCODE_FAILURE;
  returnValue = CalibratedAccel_init(xdkCalibratedAccelerometer_Handle);
  if ( RETCODE_OK != returnValue) {
    printf("Calibrated Accelerator initialization failed\n\r");
  }

  /*start the periodic timer for read and print of the sensor data*/
  OS_timerStart(readSensordataTimerHandle, TIMERBLOCKTIME);
}

Next, you have to implement the code to read and print the sensor data.
 

static void readSensors(OS_timerHandle_tp xTimer)
{
  (void) xTimer;

  Retcode_T returnValue = RETCODE_FAILURE;

  /* read and print environmental sensor data */
  Environmental_Data_T bme280 = { INT32_C(0), UINT32_C(0), UINT32_C(0) };
  returnValue = Environmental_readData(xdkEnvironmental_BME280_Handle, &bme280);

  if ( RETCODE_OK == returnValue) {

    printf("BME280 Environmental Conversion Data :\n\rp =%ld Pa\n\rt =%ld mDeg\n\rh =%ld %%rh\n\r",
      (long int) bme280.pressure, (long int) bme280.temperature, (long int) bme280.humidity);
  }

  /* read and print calibrated accelerator data*/
  CalibratedAccel_XyzMps2Data_T calibAccelMps2Data;
  memset(&calibAccelMps2Data, 0, sizeof(CalibratedAccel_XyzMps2Data_T));
  returnValue = CalibratedAccel_readXyzMps2Value(&calibAccelMps2Data);

  if (RETCODE_OK == returnValue) {
    printf("CALIBRATED ACCEL DATA - M/S2\t: %0.4f m/s2\t%0.4f m/s2\t%0.4f m/s2\n\r",
      (float) calibAccelMps2Data.xAxisData, (float) calibAccelMps2Data.yAxisData, (float) calibAccelMps2Data.zAxisData);
  }
}

Following, you have to create the timer tasks, that will run once to
initiate the sensors and periodically read and print the sensor data.
 

void Application_init(void) {

sensorInitTimerHandle_gdt = OS_timerCreate(
          (const int8_t *) "initSensors", ONESECONDDELAY,
          OS_AUTORELOAD_OFF, NULL, initSensors);

  /* create timer task to read and print the sensor data every second*/
  readSensordataTimerHandle = OS_timerCreate(
          (const int8_t *) "readSensors", ONESECONDDELAY,
          OS_AUTORELOAD_ON, NULL, readSensors);

  /*start the timer for the initialization*/
 OS_timerStart(sensorInitTimerHandle_gdt, TIMERBLOCKTIME);
}

Finally, you have to include the following function call to the appInitSystem function.
 

Application_init();

I hope the example code helps you.

Kind regards,
Franjo
+1 (1 Vote)
why i can not find this files: XDK_community - access sensor data
Answer
4/28/16 12:46 AM as a reply to Franjo Stjepandic.
thank for your help ,but i want to know when i do this whether i need a SD card?
0 (0 Votes)
why i can not find this files: XDK_community - access sensor data
Answer
4/28/16 10:53 AM as a reply to Shen Mingning.
Hello,

it depends on your use of the sensor data. The example is only a short version how you can access the sensors and print them to the console. If you want to log the data, you will need a SD card. If you are trying to display the data via the console or send them over UDP to a server, you won't need a SD card.

I guess this issue is completed and I will close this thread for now.
If I can help you with anything else, please feel free to open a new thread.

Kind regards
Franjo
+1 (1 Vote)
RE: why i can not find this files: XDK_community - access sensor data
Answer
6/6/16 5:22 AM as a reply to Franjo Stjepandic.

Hello Franjo,

 

thanx for the effort but "OS_timerHandle_tp" can not be found anywhere.

where did "OS_timerHandle_tp" declared because i can not find the in any headers files

 

Thnax in advance

+1 (1 Vote)
RE: why i can not find this files: XDK_community - access sensor data
Answer
6/6/16 7:02 AM as a reply to Arash Eftekhar.
You probably updated to XDK 1.5.2. The OS Interfaces have changed from 1.5.1. It is not possible anymore to compile the Bosch IOT Suite. I reinstalled 1.5.1 and disabled automated update, maybe this is possible for you too. Otherwise there is a migration guide here: http://xdk.bosch-connectivity.com/community/-/message_boards/message/116228. Note: I tried to change the IOT Suite but gave up after several hours - there were to much issues rising up).
+1 (1 Vote)
RE: why i can not find this files: XDK_community - access sensor data
Answer
6/6/16 7:12 AM as a reply to Juergen Blob.

yeah i did change to the 1.5.2 and i have problem running all my older programs. and so many hearfiles are missing or some defenitions are changed! like everything with xTimerHandle... is now OS_TimerHandl_tp or some things like that.

Thank you i will try your solution now.

0 (0 Votes)
RE: why i can not find this files: XDK_community - access sensor data
Answer
6/6/16 7:44 AM as a reply to Franjo Stjepandic.

UPDATE:

for all the people cant run the Franjo 's example:

- you may did update your SDK to 1.5.2

- add "#include "XdkSystemStartup.h" to your *.c file

- you should change "OS_timerHandle_tp" to "xTimerHandle" in both  *.c  and  *.h  files

- you should change "OS_timerHandle_tp" to "TimerHandle_t"

- you should change "OS_timerStart" to "xTimerStart"

- you should change "OS_AUTORELOAD_OFF" to "pdFALSE"

- you should change "OS_AUTORELOAD_ON" to "pdTRUE"

Arash

+1 (1 Vote)
RE: why i can not find this files: XDK_community - access sensor data
Answer
6/6/16 1:11 PM as a reply to Arash Eftekhar.

Hello guys,

I am glad to see that you made further progress to update the code example to the latest workbench update. Arash your code changes seems quite well, but you missed some parts.

I will post the complete updated code with small explanations. Therefore new users don't need to make changes to the old code. The changes to the latest workbench version will be highlighted.

First of all, you will use the XdkApplicationTemplate example to embed the following code.
In the XdkApplicationTemplate.h file you have embed the next six lines of code.

 

#define ONESECONDDELAY                  UINT32_C(1000)
#define TIMERBLOCKTIME                  UINT32_MAX  
#define TIMER_AUTORELOAD_ON             UINT32_C(1)
#define TIMER_AUTORELOAD_OFF            UINT32_C(0)

static void initSensors(xTimerHandle xTimer);

static void readSensors(xTimerHandle xTimer);

 

The define represents an one second delay, that will be neccessary for the timer initialization. The other defines are related to the workbench update. These are necessary properties for the timer tasks. Unfortunately these have to be defined manually.

The first function will initialize the sensors, the second one will read the data values from the sensors.

In the XdkApplicationTemplate.c file you have to include the following headerfiles.

 

#include <stdio.h>

#include "XdkSensorHandle.h"

#include "BCDS_AbsoluteHumidity.h"

 

At the next step you have declare and initialize the following local variables.
 
xTimerHandle sensorInitTimerHandle_gdt = NULL;

xTimerHandle readSensordataTimerHandle = NULL;

 

These two variables will be necessary for the timer sequences.
Successive, you have to initialize the sensors and start a periodic timer.

 

static void initSensors(xTimerHandle xTimer) {

 (void) xTimer;
 Retcode_T returnValue = RETCODE_FAILURE;

  /* initialize environmental sensor */
  returnValue = Environmental_init(xdkEnvironmental_BME280_Handle);
  if ( RETCODE_OK != returnValue) {
    printf("Environmental Sensor initialization failed\n\r");
  }

  /* initialize calibrated accelerator */
  returnValue = RETCODE_FAILURE;
  returnValue = CalibratedAccel_init(xdkCalibratedAccelerometer_Handle);
  if ( RETCODE_OK != returnValue) {
    printf("Calibrated Accelerator initialization failed\n\r");
  }

  /*start the periodic timer for read and print of the sensor data*/
  xTimerStart(readSensordataTimerHandle, TIMERBLOCKTIME);
}

 

Next, you have to implement the code to read and print the sensor data.

 

static void readSensors(xTimerHandle xTimer)
{
  (void) xTimer;

  Retcode_T returnValue = RETCODE_FAILURE;

  /* read and print environmental sensor data */
  Environmental_Data_T bme280 = { INT32_C(0), UINT32_C(0), UINT32_C(0) };
  returnValue = Environmental_readData(xdkEnvironmental_BME280_Handle,

 &bme280);

  if ( RETCODE_OK == returnValue) {

    printf("BME280 Environmental Conversion Data :\n\rp =%ld Pa\n\rt =%ld

    mDeg\n\rh =%ld%%rh\n\r",(long int) bme280.pressure, (long int)

    bme280.temperature,(long int) bme280.humidity);
  }

  /* read and print calibrated accelerator data*/
  CalibratedAccel_XyzMps2Data_T calibAccelMps2Data;
  memset(&calibAccelMps2Data, 0, sizeof(CalibratedAccel_XyzMps2Data_T));
  returnValue = CalibratedAccel_readXyzMps2Value(&calibAccelMps2Data);

  if (RETCODE_OK == returnValue) {
    printf("CALIBRATED ACCEL DATA - M/S2\t: %0.4f m/s2\t%0.4f m/s2\t%0.4f

   m/s2\n\r", (float) calibAccelMps2Data.xAxisData, (float)

   calibAccelMps2Data.yAxisData, (float) calibAccelMps2Data.zAxisData);
  }
}

 

Following, you have to create the timer tasks, that will run once to initiate the sensors and

periodically read and print the sensor data.

 

void applicationInit(void) {

sensorInitTimerHandle_gdt = xTimerCreate((const int8_t *) "initSensors",

ONESECONDDELAY, TIMER_AUTORELOAD_OFF, NULL, initSensors);

  /* create timer task to read and print the sensor data every second*/
readSensordataTimerHandle = xTimerCreate((const int8_t *) "readSensors",

ONESECONDDELAY,TIMER_AUTORELOAD_ON, NULL, readSensors);


/*start the timer for the initialization*/
 xTimerStart(sensorInitTimerHandle_gdt, TIMERBLOCKTIME);
}

 

Finally, you have to include the following function call to the appInitSystem function.

 

applicationInit();

 

This should make the code working again.

Kind regards,
Franjo

+1 (1 Vote)