testGetData.c
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*=============================================================
* testGetData.c
* Test data collection for a a given parameter (hard coded)
* Oct 2019, V.1.0, Renard
*=============================================================*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <DD.h>
#include <time.h>
#include <string.h>
#include <sys/time.h>
#define DATA_VI "mes:mag:orb\0"
#define DATA_STARTTIME "2012000000000000\0"
#define DATA_TIMEINT "0000010000000000\0"
#define DATA_TIMENAME "Time\0"
#define DATA_PARAMNAME "B_MSO\0"
/*
* Main
*/
int main()
{
char ViName[100];
char StartTime[17];
char TimeInt[17];
char ParamName[100];
char TimeName[100];
strcpy(ViName,DATA_VI);
strcpy(StartTime, DATA_STARTTIME);
strcpy(TimeInt, DATA_TIMEINT);
strcpy(ParamName, DATA_PARAMNAME);
strcpy(TimeName, DATA_TIMENAME);
char* ParNames[2] = {TimeName, ParamName};
int ID, error;
double RealTime;
DD_data_t *data;
ID = DD_SetVariable(ViName);
if(ID < 0)
{
error = DD_Close(99);
printf("[ERROR]\n");
return 0;
}
error = DD_SetTimeInfo(ID, StartTime, &RealTime);
if(error < 0)
{
error = DD_Close(ID);
printf("[ERROR]\n");
return 0;
}
do
{
error = DD_GetMultiData(ID, 2, ParNames, TimeInt, &data, 1);
if(error < 0)
{
error = DD_Close(ID);
printf("[ERROR]\n");
return 0;
}
if(error == MOREDELAY)
{
error = MOREDATA;
}
}
while(error == MOREDATA);
error = DD_Close(ID);
printf("[SUCESS]\n");
return 1;
}