iot_demo_def.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2021 Huawei Device Co., Ltd.
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #ifndef __IOT_DEMO_DEF_H__
  16. #define __IOT_DEMO_DEF_H__
  17. #define CN_BOARD_SWITCH_ON 1
  18. #define CN_BOARD_SWITCH_OFF 0
  19. #define CN_HOURS_IN_DAY 24
  20. #define CN_MINUTES_IN_HOUR 60
  21. #define CN_SECONDS_IN_MINUTE 60
  22. #define CN_SECONDS_IN_HOUR (CN_MINUTES_IN_HOUR * CN_SECONDS_IN_MINUTE)
  23. #define CN_MINISECONDS_IN_SECOND 1000
  24. #define CN_MINUTES_IN_DAY (CN_HOURS_IN_DAY * CN_MINUTES_IN_HOUR)
  25. #define CN_SECONS_IN_DAY (CN_SECONDS_IN_MINUTE * CN_MINUTES_IN_DAY)
  26. #define BASE_YEAR_OF_TIME_CALC 1900
  27. #define AFTER_NETCFG_ACTION 2
  28. #define BUFF_SIZE 256
  29. typedef enum {
  30. LOG_LEVEL_INFO = 0,
  31. LOG_LEVEL_DEBUG,
  32. LOG_LEVEL_WARN,
  33. LOG_LEVEL_ERR,
  34. LOG_LEVEL_EXCEPTION,
  35. LOG_LEVEL_EXIT,
  36. }LogLevelType;
  37. //we defines a log arise function
  38. #define RAISE_LOG 1
  39. #define DISABLE_LEVEL LOG_LEVEL_INFO
  40. #ifdef RAISE_LOG
  41. #define RaiseLog(level,fmt, ...) \
  42. do \
  43. { \
  44. if(level < DISABLE_LEVEL) break;\
  45. printf("[%s][%u][%d] " fmt "\r\n", \
  46. __FUNCTION__,__LINE__,level, ##__VA_ARGS__); \
  47. } while (0)
  48. #else
  49. #define RaiseLog(level,fmt, ...)
  50. #endif
  51. #endif /* __IOT_DEMO_DEF_H__ */