restore old UA_Job API and mark as deprecated

This commit is contained in:
Julius Pfrommer
2017-06-29 12:12:05 +02:00
committed by Julius Pfrommer
parent 454c6ed8a3
commit 96e87cedfa
4 changed files with 72 additions and 0 deletions
+1
View File
@@ -238,6 +238,7 @@ set(exported_headers ${PROJECT_BINARY_DIR}/src_generated/ua_config.h
${PROJECT_SOURCE_DIR}/include/ua_plugin_log.h
${PROJECT_SOURCE_DIR}/include/ua_plugin_access_control.h
${PROJECT_SOURCE_DIR}/include/ua_server.h
${PROJECT_SOURCE_DIR}/include/ua_server_deprecated.h
${PROJECT_SOURCE_DIR}/include/ua_client.h
${PROJECT_SOURCE_DIR}/include/ua_client_highlevel.h
${PROJECT_SOURCE_DIR}/plugins/ua_network_tcp.h
+8
View File
@@ -172,6 +172,14 @@ typedef uint8_t bool;
# define UA_FUNC_ATTR_WARN_UNUSED_RESULT
#endif
#ifdef __GNUC__
# define UA_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
# define UA_DEPRECATED __declspec(deprecated)
#else
# define UA_DEPRECATED
#endif
/**
* String Manipulation
* -------------------
+3
View File
@@ -962,4 +962,7 @@ UA_UInt16 UA_EXPORT UA_Server_addNamespace(UA_Server *server, const char* name);
}
#endif
/* Old interfaces kept for API compatibility */
#include "ua_server_deprecated.h"
#endif /* UA_SERVER_H_ */
+60
View File
@@ -0,0 +1,60 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef UA_SERVER_DEPRECATED_H_
#define UA_SERVER_DEPRECATED_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "ua_server.h"
/**
* Deprecated API
* ==============
* This file contains outdated API definitions that are kept for backwards
* compatibility. Please switch to the new API, as the following definitions
* will be removed eventually. */
/**
* UA_Job API
* ----------
* UA_Job was replaced since it unneccessarily exposed server internals to the
* end-user. Please use plain UA_ServerCallbacks instead. The following UA_Job
* definition contains just the fraction of the original struct that was useful
* to end-users. */
typedef enum {
UA_JOBTYPE_METHODCALL
} UA_JobType;
typedef struct {
UA_JobType type;
union {
struct {
void *data;
UA_ServerCallback method;
} methodCall;
} job;
} UA_Job;
UA_DEPRECATED static UA_INLINE UA_StatusCode
UA_Server_addRepeatedJob(UA_Server *server, UA_Job job,
UA_UInt32 interval, UA_Guid *jobId) {
return UA_Server_addRepeatedCallback(server, job.job.methodCall.method,
job.job.methodCall.data, interval,
(UA_UInt64*)jobId);
}
UA_DEPRECATED static UA_INLINE UA_StatusCode
UA_Server_removeRepeatedJob(UA_Server *server, UA_Guid jobId) {
return UA_Server_removeRepeatedCallback(server, *(UA_UInt64*)&jobId);
}
#ifdef __cplusplus
}
#endif
#endif /* UA_SERVER_DEPRECATED_H_ */