jiot_common.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*******************************************************************************
  2. * Copyright (c) 2014 IBM Corp.
  3. *
  4. * All rights reserved. This program and the accompanying materials
  5. * are made available under the terms of the Eclipse Public License v1.0
  6. * and Eclipse Distribution License v1.0 which accompany this distribution.
  7. *
  8. * The Eclipse Public License is available at
  9. * http://www.eclipse.org/legal/epl-v10.html
  10. * and the Eclipse Distribution License is available at
  11. * http://www.eclipse.org/org/documents/edl-v10.php.
  12. *
  13. * Contributors:
  14. * Allan Stockdill-Mander - initial API and implementation and/or initial documentation
  15. *******************************************************************************/
  16. #ifndef JIOT_COMMON_H_
  17. #define JIOT_COMMON_H_
  18. #include "jiot_timer.h"
  19. #include "jiot_network_define.h"
  20. typedef struct Timer
  21. {
  22. S_JIOT_TIME_TYPE time;
  23. }Timer;
  24. int jiot_mqtt_network_init(Network *pNetwork, char *addr, char *port,char *ca_crt);
  25. int jiot_http_network_init(Network *pNetwork, char *addr, char *port,char *ca_crt);
  26. void jiot_set_network_param(Network *pNetwork, char *addr, char *port, char *ca_crt);
  27. char expired(Timer* timer);
  28. void countdown_ms(Timer*, unsigned int);
  29. void countdown(Timer*, unsigned int);
  30. long long left_ms(Timer* timer);
  31. long long spend_ms(Timer* timer);
  32. void InitTimer(Timer* timer);
  33. void NowTimer(Timer* timer);
  34. #endif