WeatherManager.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * WeatherManager.h
  3. *
  4. * Created on: 2021年10月30日
  5. * Author: Administrator
  6. */
  7. #ifndef JNI_MANAGER_WEATHERMANAGER_H_
  8. #define JNI_MANAGER_WEATHERMANAGER_H_
  9. #include <string>
  10. #include <system/Thread.h>
  11. class WeatherManager : public Thread{
  12. private:
  13. //城市
  14. std::string m_city;
  15. //温度
  16. std::string m_temperature;
  17. //天气
  18. std::string m_weather;
  19. //天气图标
  20. std::string m_weaIcon;
  21. bool bforceSync;
  22. private:
  23. WeatherManager();
  24. virtual ~WeatherManager();
  25. public:
  26. /*
  27. * @brife 获取单例实例化对象
  28. * @return 类实例对象
  29. * */
  30. static WeatherManager* getInstance(void);
  31. /*
  32. * @brife 设置城市名称
  33. * @param city 城市名
  34. * */
  35. void setCityName(const std::string city);
  36. /*
  37. * @brife 获取城市名称
  38. * @return 城市名
  39. * */
  40. const std::string getCityName(void);
  41. /*
  42. * @brife 设置温度值
  43. * @param temperature 温度值
  44. * */
  45. void setTemperature(const std::string temperature);
  46. /*
  47. * @brife 获取温度值
  48. * @return 温度值
  49. * */
  50. const std::string getTemperature(void);
  51. /*
  52. * @brife 设置天气
  53. * @param weather 天气
  54. * */
  55. void setWeather(const std::string weather);
  56. /*
  57. * @brife 获取天气
  58. * @return 天气
  59. * */
  60. const std::string getWeather(void);
  61. /*
  62. * @brife 设置天气图标编号
  63. * @param weaIcon 图标编号
  64. * */
  65. void setWeaIcon(const std::string weaIcon);
  66. /*
  67. * @brife 获取天气图标编号
  68. * @return 图标编号
  69. * */
  70. const std::string getWeaIcon(void);
  71. /*
  72. * @brife 同步天气
  73. * */
  74. const int syncWeather(void);
  75. /**
  76. * @brife线程循环函数
  77. *
  78. * @return true 继续线程循环
  79. * false 推出线程
  80. */
  81. bool threadLoop();
  82. /*
  83. * @brife 天气同步UI刷新回调函数
  84. * */
  85. void (* updateUiCb)(void* args);
  86. void reqSyncWeather(){bforceSync = 1;}
  87. };
  88. #define WEATHERMANAGER WeatherManager::getInstance()
  89. #endif /* JNI_MANAGER_WEATHERMANAGER_H_ */