HardwareDataBuffer.java
2.12 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
83
84
85
86
package com.example.mina.base;
public class HardwareDataBuffer {
protected int maxRow;
protected int maxCol;
protected int maxOffset;
protected int maxAtten;
protected Entry[][] matrix_data;
protected Entry[] offset_data;
public HardwareDataBuffer() {}
public HardwareDataBuffer(int row, int col, int offset, int maxAtten){
this.maxRow = row;
this.maxCol = col;
this.maxOffset = offset;
this.maxAtten = maxAtten;
}
/**
* Set cross point attenuation value. Actually that is not correct.
* In case of LTE device, this is a ON/OFF status (0,1)
*
* @param row the row index. *** starts from 1 ***
* @param col the col index. *** starts from 1 ***
* @param val the attenuation value
*/
public synchronized void setAttenuation(int row, int col, int val){
if(val != -1 && (row < 1 || row > maxRow || col < 1 || col > maxCol)) {
//Logger.atError().log("HardwareDataBuffer: setAttenuation(int row, int col, int val) " + row + "/" + col + "/" + val);
return;
}
if(val == -1) val = maxAtten;
matrix_data[row - 1][col -1 ] = new Entry(row -1 , col -1 , "rr", val, false);;
}
public int getAttenuation(int row, int col){
return matrix_data[row - 1][col -1 ].getValue();
}
public synchronized void setOffset(int row,int val){
if(row < 1 || row > maxOffset){
//rfmazeLogger.atError().log("HardwareDataBuffer: setOffset(int row, int val) " + row + "/" + val);
return;
}
offset_data[row - 1] = new Entry(row -1 , 0 , "rr", val, false);;
}
public int getOffset(int row){
return offset_data[row - 1].getValue();
}
public Entry[] getOffset_data() {
return offset_data;
}
public Entry[][] getMatrix_data() {
return matrix_data;
}
public int getMaxRow(){
return maxRow;
}
public int getMaxCol(){
return maxCol;
}
public int getMaxOffset() {
return maxOffset;
}
public int getMaxAtten() {
return maxAtten;
}
}