‪Black Box
Static Public Member Functions | Static Private Member Functions | Static Private Attributes
BBThermostatDataEncryptor.BBThermostatDataRequest Class Reference

Static Public Member Functions

static void BBThermosataCheck ()
 ‪Get thermostat data and encrypt More...
 

Static Private Member Functions

static void GetBBThermostatAllData ()
 ‪This method request and parse the thermostat stat data More...
 
static void GetBBThermostatHumidtyData ()
 ‪This method request and parse the thermostat humidity data More...
 
static string TempConvertor (float value)
 ‪This method converts the temperature from imperial to metric More...
 

Static Private Attributes

static string BBThermostatData
 
static string BBThermostatAllStat
 
static string BBThermostatHumidity
 

Detailed Description

Definition at line 16 of file BBThermostatDataRequest.cs.

Member Function Documentation

◆ BBThermosataCheck()

static void BBThermostatDataEncryptor.BBThermostatDataRequest.BBThermosataCheck ( )
static

‪Get thermostat data and encrypt

Definition at line 164 of file BBThermostatDataRequest.cs.

165  {
166  try
167  {
170  BBThermostatDataEncryption.EncryptData(‪BBThermostatData);
171  Console.WriteLine(‪BBThermostatData);
172  Console.WriteLine(Environment.NewLine);
173  ‪BBThermostatData = "";
174  }
175  catch (Exception ex)
176  {
177  // Set operation status to false
179  ‪BBSensorErrorLog.‪SaveErrorData(ex.Message.ToString());
180  }
181  }
‪static void SaveErrorData(string error)
‪Log all the error that occurs in the program
‪static void GetBBThermostatAllData()
‪This method request and parse the thermostat stat data
‪static void GetBBThermostatHumidtyData()
‪This method request and parse the thermostat humidity data

Referenced by BBThermostatSensor.Program.Tick().

◆ GetBBThermostatAllData()

static void BBThermostatDataEncryptor.BBThermostatDataRequest.GetBBThermostatAllData ( )
staticprivate

‪This method request and parse the thermostat stat data

Definition at line 25 of file BBThermostatDataRequest.cs.

26  {
29 
30  // Current temperature
31  ‪BBThermostatData += ‪TempConvertor(buffer.temp) + ",";
32 
33  // Temporary target heat set point
34  ‪BBThermostatData += ‪TempConvertor(buffer.t_heat) + ",";
35 
36  // Temporary target cool set point
37  ‪BBThermostatData += ‪TempConvertor(buffer.t_cool) + ",";
38 
39  //Thermostat operation mode
40  if (buffer.tmode.ToString() == "0")
41  {
42  ‪BBThermostatData += "OFF,";
43  }
44  if (buffer.tmode.ToString() == "1")
45  {
46  ‪BBThermostatData += "HEAT,";
47  }
48  if (buffer.tmode.ToString() == "2")
49  {
50  ‪BBThermostatData += "COOL,";
51  }
52  if (buffer.tmode.ToString() == "3")
53  {
54  ‪BBThermostatData += "AUTO,";
55  }
56 
57  //Thermostat fan operation mode
58  if (buffer.fmode.ToString() == "0")
59  {
60  ‪BBThermostatData += "AUTO,";
61  }
62  if (buffer.fmode.ToString() == "1")
63  {
64  ‪BBThermostatData += "AUTO/CIRCULATE,";
65  }
66  if (buffer.fmode.ToString() == "2")
67  {
68  ‪BBThermostatData += "ON,";
69  }
70 
71  //Thermostat target temperature hold status
72  if (buffer.hold.ToString() == "0")
73  {
74  ‪BBThermostatData += "DISABLE,";
75  }
76  if (buffer.hold.ToString() == "1")
77  {
78  ‪BBThermostatData += "ENABLE,";
79  }
80 
81  //Thermostat HVAC Operation state
82  if (buffer.tstate.ToString() == "0")
83  {
84  ‪BBThermostatData += "OFF,";
85  }
86  if (buffer.tstate.ToString() == "1")
87  {
88  ‪BBThermostatData += "HEAT,";
89  }
90  if (buffer.tstate.ToString() == "2")
91  {
92  ‪BBThermostatData += "COOL,";
93  }
94 
95  //Thermostat current Operation target
96  if (buffer.ttarget.ToString() == "0")
97  {
98  ‪BBThermostatData += "OFF,";
99  }
100  if (buffer.ttarget.ToString() == "1")
101  {
102  ‪BBThermostatData += "HEAT,";
103  }
104  if (buffer.ttarget.ToString() == "2")
105  {
106  ‪BBThermostatData += "COOL,";
107  }
108 
109  //Thermostat operation mode
110  if (buffer.program_mode.ToString() == "0")
111  {
112  ‪BBThermostatData += "Program A,";
113  }
114  if (buffer.program_mode.ToString() == "1")
115  {
116  ‪BBThermostatData += "Program B,";
117  }
118  if (buffer.program_mode.ToString() == "2")
119  {
120  ‪BBThermostatData += "Vacation,";
121  }
122  if (buffer.program_mode.ToString() == "3")
123  {
124  ‪BBThermostatData += "Holiday,";
125  }
126 
127  //Thermostat fan operation status
128  if (buffer.fstate.ToString() == "0")
129  {
130  ‪BBThermostatData += "OFF,";
131  }
132  if (buffer.fstate.ToString() == "1")
133  {
134  ‪BBThermostatData += "ON,";
135  }
136 
137  // Current date and time the data was recorded
138  ‪BBThermostatData += DateTime.Now.ToString("HH:mm:ss") + "," + DateTime.Now.ToString("yyyy-MM-dd");
139  }
‪static string BBThermostatRequestA()
‪this method retrieve the full status of the thermostat
‪static string TempConvertor(float value)
‪This method converts the temperature from imperial to metric

Referenced by BBThermostatDataEncryptor.BBThermostatDataRequest.BBThermosataCheck().

◆ GetBBThermostatHumidtyData()

static void BBThermostatDataEncryptor.BBThermostatDataRequest.GetBBThermostatHumidtyData ( )
staticprivate

◆ TempConvertor()

static string BBThermostatDataEncryptor.BBThermostatDataRequest.TempConvertor ( float  value)
staticprivate

‪This method converts the temperature from imperial to metric

Parameters
value
Returns

Definition at line 156 of file BBThermostatDataRequest.cs.

157  {
158  return Convert.ToString(((int)value - 32) * 5 / 9);
159  }

Referenced by BBThermostatDataEncryptor.BBThermostatDataRequest.GetBBThermostatAllData().

Field Documentation

◆ BBThermostatAllStat

string BBThermostatDataEncryptor.BBThermostatDataRequest.BBThermostatAllStat
staticprivate

◆ BBThermostatData

string BBThermostatDataEncryptor.BBThermostatDataRequest.BBThermostatData
staticprivate

◆ BBThermostatHumidity

string BBThermostatDataEncryptor.BBThermostatDataRequest.BBThermostatHumidity
staticprivate

The documentation for this class was generated from the following file: