OpenECHO
 All Classes Namespaces Files Functions Variables
DefaultPowerDistributionBoardMetering.java
Go to the documentation of this file.
1 package com.sonycsl.echo.processing.defaults;
2 import java.io.IOException;
3 
5 
6 
8 
9  byte[] mStatus = {0x30};
10  byte[] mLocation = {0x00};
11  byte[] mFaultStatus = {0x42};
12  byte[] mManufacturerCode = {0,0,0};
13 
14  byte[] mNormalDirectionValue = {0,0,0,0};
15  byte[] mReverseDirectionValue = {0,0,0,0};
16  byte[] mUnit = {0x03};
17 
18  @Override
19  protected byte[] getOperationStatus() { return mStatus; }
20 
21  public void changeOperationStatus(boolean status) {
22  byte b = (status?(byte)0x30:0x31) ;
23 
24  if(mStatus[0] == b) return ;
25  mStatus[0] = b;
26  try {
27  inform().reqInformOperationStatus().send();
28  } catch (IOException e) {e.printStackTrace();}
29  }
30 
31  @Override
32  protected boolean setInstallationLocation(byte[] edt) {
34  return true;
35  }
36 
37  @Override
38  protected byte[] getInstallationLocation() {return mLocation;}
39 
40  public void changeInstallationLocation(byte location) {
41  if(mLocation[0] == location) return ;
42  mLocation[0] = location;
43  try {
44  inform().reqInformInstallationLocation().send();
45  } catch (IOException e) {e.printStackTrace();}
46  }
47 
48  @Override
49  protected byte[] getFaultStatus() {return mFaultStatus;}
50 
51  public void changeFaultStatus(boolean status) {
52  byte b = (status?(byte)0x41:(byte)0x42) ;
53 
54  if(mFaultStatus[0] == b) return ;
55  mFaultStatus[0] = b;
56  try {
57  inform().reqInformFaultStatus().send();
58  } catch (IOException e) {e.printStackTrace();}
59  }
60 
61  @Override
62  protected byte[] getManufacturerCode() {return mManufacturerCode;}
63 
64  @Override
66  return mNormalDirectionValue;
67  }
68 
69  public void setNormalDirectionValue(long value) {
70  mNormalDirectionValue[0] = (byte)((value >> 24) & 0xFF);
71  mNormalDirectionValue[1] = (byte)((value >> 16) & 0xFF);
72  mNormalDirectionValue[2] = (byte)((value >> 8) & 0xFF);
73  mNormalDirectionValue[3] = (byte)(value & 0xFF);
74  }
75 
76  @Override
78  return mReverseDirectionValue;
79  }
80 
81  public void setReverseDirectionValue(long value) {
82  mReverseDirectionValue[0] = (byte)((value >> 24) & 0xFF);
83  mReverseDirectionValue[1] = (byte)((value >> 16) & 0xFF);
84  mReverseDirectionValue[2] = (byte)((value >> 8) & 0xFF);
85  mReverseDirectionValue[3] = (byte)(value & 0xFF);
86  }
87 
88  @Override
89  protected byte[] getUnitForCumulativeAmountsOfElectricEnergy() {return mUnit;}
90 }