ua_server_deprecated.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifndef UA_SERVER_DEPRECATED_H_
  5. #define UA_SERVER_DEPRECATED_H_
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include "ua_server.h"
  10. /**
  11. * Deprecated API
  12. * ==============
  13. * This file contains outdated API definitions that are kept for backwards
  14. * compatibility. Please switch to the new API, as the following definitions
  15. * will be removed eventually. */
  16. /**
  17. * UA_Job API
  18. * ----------
  19. * UA_Job was replaced since it unneccessarily exposed server internals to the
  20. * end-user. Please use plain UA_ServerCallbacks instead. The following UA_Job
  21. * definition contains just the fraction of the original struct that was useful
  22. * to end-users. */
  23. typedef enum {
  24. UA_JOBTYPE_METHODCALL
  25. } UA_JobType;
  26. typedef struct {
  27. UA_JobType type;
  28. union {
  29. struct {
  30. void *data;
  31. UA_ServerCallback method;
  32. } methodCall;
  33. } job;
  34. } UA_Job;
  35. UA_DEPRECATED static UA_INLINE UA_StatusCode
  36. UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
  37. UA_UInt32 interval, UA_Guid *jobId) {
  38. return UA_Server_addRepeatedCallback(server, job.job.methodCall.method,
  39. job.job.methodCall.data, interval,
  40. (UA_UInt64*)jobId);
  41. }
  42. UA_DEPRECATED static UA_INLINE UA_StatusCode
  43. UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId) {
  44. return UA_Server_removeRepeatedCallback(server, *(UA_UInt64*)&jobId);
  45. }
  46. #ifdef __cplusplus
  47. }
  48. #endif
  49. #endif /* UA_SERVER_DEPRECATED_H_ */