schedule_store.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 __SCHEDULE_STORE_H__
  16. #define __SCHEDULE_STORE_H__
  17. #define SCHEDULE_ID_LENGTH 40
  18. typedef struct {
  19. unsigned char cmd;
  20. unsigned int value;
  21. }ScheduleCommand;
  22. typedef struct {
  23. unsigned char week;
  24. unsigned int starttime;
  25. unsigned int duration;
  26. unsigned char id[SCHEDULE_ID_LENGTH];
  27. ScheduleCommand scheduleCmd;
  28. } ScheduleInfo;
  29. typedef enum {
  30. SCHEDULE_OPTION_ADD = 0,
  31. SCHEDULE_OPTION_UPDATE,
  32. SCHEDULE_OPTION_DELETE
  33. } SCHEDULE_OPTION;
  34. int ScheduleStoreUpdate(ScheduleInfo *info, SCHEDULE_OPTION option);
  35. int ScheduleStoreGetTotal(void);
  36. int ScheduleStoreGetInfo(ScheduleInfo *info, int idx);
  37. void ScheduleStoreDelete(void);
  38. #endif /* __SCHEDULE_STORE_H__ */