/app/src/main/java/com/eveningoutpost/dexdrip/Services/LibreWifiData.java

https://github.com/NightscoutFoundation/xDrip · Java · 121 lines · 79 code · 35 blank · 7 comment · 0 complexity · 1ef34de0966cd679db7e9f2b9dcbb91b MD5 · raw file

  1. package com.eveningoutpost.dexdrip.Services;
  2. import java.util.Arrays;
  3. import com.google.gson.annotations.Expose;
  4. import com.mongodb.BasicDBObject;
  5. // This class contains data that is received for all house coverage.
  6. // The must fields are the raw data read from the sensor, and timestamp (and relative time).
  7. public class LibreWifiData {
  8. LibreWifiData(){
  9. }
  10. @Expose
  11. String BlockBytes; // The base 64 encoded FARM
  12. @Expose
  13. Long CaptureDateTime;
  14. @Expose
  15. public long RelativeTime;
  16. @Expose
  17. int ChecksumOk ;
  18. @Expose
  19. String DebugInfo;
  20. @Expose
  21. int TomatoBatteryLife;
  22. @Expose
  23. int UploaderBatteryLife;
  24. @Expose
  25. int Uploaded;
  26. @Expose
  27. String HwVersion;
  28. @Expose
  29. String FwVersion;
  30. @Expose
  31. String SensorId;
  32. @Expose
  33. String patchUid; // The base 64 encoded patchUid
  34. @Expose
  35. String patchInfo; // The base 64 encoded patchInfo
  36. public Long getCaptureDateTime() {
  37. return CaptureDateTime;
  38. }
  39. public LibreWifiData(BasicDBObject src) {
  40. BlockBytes = src.getString("BlockBytes");
  41. CaptureDateTime = src.getLong("CaptureDateTime");
  42. ChecksumOk = src.getInt("ChecksumOk");
  43. DebugInfo = src.getString("DebugInfo");
  44. TomatoBatteryLife = src.getInt("TomatoBatteryLife");
  45. UploaderBatteryLife = src.getInt("UploaderBatteryLife");
  46. Uploaded = src.getInt("Uploaded");
  47. HwVersion = src.getString("HwVersion");
  48. FwVersion = src.getString("FwVersion");
  49. SensorId = src.getString("SensorId");
  50. patchUid = src.getString("patchUid");
  51. patchInfo = src.getString("patchInfo");
  52. }
  53. @Override
  54. public String toString() {
  55. return "LibreWifiData [BlockBytes=" + BlockBytes + ", CaptureDateTime=" + CaptureDateTime + ", RelativeTime="
  56. + RelativeTime + ", ChecksumOk=" + ChecksumOk + ", DebugInfo=" + DebugInfo + ", TomatoBatteryLife="
  57. + TomatoBatteryLife + ", UploaderBatteryLife=" + UploaderBatteryLife + ", Uploaded=" + Uploaded
  58. + ", HwVersion=" + HwVersion + ", FwVersion=" + FwVersion + ", SensorId=" + SensorId
  59. + ", patchUid=" + patchUid + ", patchInfo=" + patchInfo +"]";
  60. }
  61. }
  62. class LibreWifiHeader {
  63. // Version of the reply
  64. @Expose
  65. int reply_version;
  66. // Maximum version of protocol supported by this version
  67. @Expose
  68. int max_protocol_version;
  69. // Time of last reading from libre (can be no sensor for example
  70. @Expose
  71. long last_reading;
  72. // Any debug message that wants to be displayed.
  73. @Expose
  74. String debug_message;
  75. @Expose
  76. String device_type;
  77. // The actual data
  78. @Expose
  79. LibreWifiData [] libre_wifi_data;
  80. @Override
  81. public String toString() {
  82. return "LibreWifiHeader [reply_version=" + reply_version + ", max_protocol_version=" + max_protocol_version
  83. + ", last_reading=" + last_reading + ", debug_message=" + debug_message + ", device_type=" + device_type
  84. + ", libre_wifi_data=" + Arrays.toString(libre_wifi_data) + "]";
  85. }
  86. }