diff options
Diffstat (limited to 'SD-VBS/benchmarks/localization/src/c/readSensorData.c')
-rw-r--r-- | SD-VBS/benchmarks/localization/src/c/readSensorData.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/localization/src/c/readSensorData.c b/SD-VBS/benchmarks/localization/src/c/readSensorData.c new file mode 100644 index 0000000..12c0dc0 --- /dev/null +++ b/SD-VBS/benchmarks/localization/src/c/readSensorData.c | |||
@@ -0,0 +1,63 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #include <stdio.h> | ||
6 | #include <stdlib.h> | ||
7 | #include "localization.h" | ||
8 | |||
9 | F2D* readSensorData(I2D* index, F2D* fid, I2D* type, I2D* eof) | ||
10 | { | ||
11 | F2D *retData; | ||
12 | int rows, i, j, k; | ||
13 | int atype=-1, aindex; | ||
14 | |||
15 | aindex = asubsref(index, 0); | ||
16 | |||
17 | asubsref(index,0) = asubsref(index,0) + 1; | ||
18 | rows = fid->height; | ||
19 | asubsref(type,0) = 0; | ||
20 | retData = fSetArray(1, 8, 0); | ||
21 | |||
22 | if( asubsref(index,0) > (rows-1) ) | ||
23 | asubsref(eof,0) = 1; | ||
24 | else | ||
25 | { | ||
26 | if( asubsref(index,0) == rows) | ||
27 | asubsref(eof,0) = 1; | ||
28 | else | ||
29 | asubsref(eof,0) = 0; | ||
30 | |||
31 | k = asubsref(index,0); | ||
32 | atype = subsref(fid, k, 1); | ||
33 | if( (atype == 1) || (atype == 2) || (atype == 3) ) | ||
34 | { | ||
35 | for(i=0; i<3; i++) | ||
36 | { | ||
37 | asubsref(retData,i) = subsref(fid,k,(i+2)); | ||
38 | } | ||
39 | } | ||
40 | if( atype == 4 ) | ||
41 | { | ||
42 | for(i=0; i<3; i++) | ||
43 | { | ||
44 | asubsref(retData,i) = subsref(fid,k,(i+2)); | ||
45 | } | ||
46 | for(i=3; i<8; i++) | ||
47 | { | ||
48 | asubsref(retData,i) = subsref(fid,k+1,(i-3)); | ||
49 | } | ||
50 | aindex = aindex + 1; | ||
51 | } | ||
52 | aindex = aindex + 1; | ||
53 | } | ||
54 | |||
55 | asubsref(index,0) = aindex; | ||
56 | asubsref(type, 0) = atype; | ||
57 | |||
58 | return retData; | ||
59 | } | ||
60 | |||
61 | |||
62 | |||
63 | |||