Go to the documentation of this file.
39 #ifndef STATE_MACHINE_H_
40 #define STATE_MACHINE_H_
43 #define MONIT_TIMESTAMPS_TO_RETURN OpcUa_TimestampsToReturn_Both
44 #define MONIT_QSIZE 10
54 #define SKIP_S2OPC_DEFINITIONS
136 const char* szPolicyId,
137 const char* szUsername,
138 const char* szPassword,
142 double fPublishInterval,
143 uint32_t iCntMaxKeepAlive,
144 uint32_t iCntLifetime,
145 uint32_t iTokenTarget,
148 uintptr_t userContext,
210 uintptr_t userAppContext);
221 double* revisedPublishingInterval,
222 uint32_t* revisedLifetimeCount,
223 uint32_t* revisedMaxKeepAliveCount);
268 char const*
const* lszNodeId,
269 const uint32_t* liAttrId,
294 uint32_t nbNotifElts,
295 const void* notification,
296 uintptr_t* monitoredItemCtxArray);
326 const uintptr_t* userAppCtxArray,
void SOPC_StaMac_SetUserContext(SOPC_StaMac_Machine *pSM, uintptr_t userContext)
Overwrite the user content in the given state machine.
Definition: sopc_types.h:5868
SOPC_StaMac_RequestType requestType
Definition: state_machine.h:100
uintptr_t SOPC_StaMac_GetUserContext(SOPC_StaMac_Machine *pSM)
Returns the user context provided to SOPC_StaMac_Create or modified through SOPC_StaMac_SetUserContex...
uint32_t SOPC_StatusCode
Definition: libs2opc_client.h:60
SOPC_ReturnStatus SOPC_StaMac_NewCreateSubscription(SOPC_StaMac_Machine *pSM, OpcUa_CreateSubscriptionRequest *req, uintptr_t userAppContext)
OpcUa_CreateMonitoredItemsResponse * Results
Definition: state_machine.h:241
@ stActivated
Definition: state_machine.h:64
void SOPC_LibSub_EventCbk(SOPC_LibSub_ConnectionId c_id, SOPC_LibSub_ApplicativeEvent event, SOPC_StatusCode status, const void *response, uintptr_t responseContext)
Callback for generic responses to a call to SOPC_LibSub_AsyncSendRequestOnSession().
Definition: libs2opc_client.h:272
SOPC_ReturnStatus SOPC_StaMac_Create(uint32_t iscConfig, SOPC_ReverseEndpointConfigIdx reverseConfigIdx, uint32_t iCliId, const char *szPolicyId, const char *szUsername, const char *szPassword, const SOPC_SerializedCertificate *pUserCertX509, const SOPC_SerializedAsymmetricKey *pUserKey, SOPC_LibSub_DataChangeCbk *cbkLibSubDataChanged, double fPublishInterval, uint32_t iCntMaxKeepAlive, uint32_t iCntLifetime, uint32_t iTokenTarget, int64_t iTimeoutMs, SOPC_LibSub_EventCbk *cbkGenericEvent, uintptr_t userContext, SOPC_StaMac_Machine **ppSM)
Creates a new state machine, initialized in state stInit.
@ SOPC_REQUEST_TYPE_GET_ENDPOINTS
Definition: state_machine.h:79
@ stError
Definition: state_machine.h:61
@ SOPC_REQUEST_TYPE_UNKNOWN
Definition: state_machine.h:75
Definition: sopc_types.h:5818
void SOPC_ClientHelper_DataChangeCbk(const int32_t connectionId, const char *nodeId, const SOPC_DataValue *value)
Callback type for data change event (related to a subscription)
Definition: libs2opc_client_cmds.h:59
SOPC_StaMac_State
Definition: state_machine.h:60
bool SOPC_StaMac_IsError(SOPC_StaMac_Machine *pSM)
Returns a bool whether the machine is in stError or not.
OpcUa_DeleteMonitoredItemsResponse * Results
Definition: state_machine.h:334
bool SOPC_StaMac_PopDeleteMonItByAppCtx(SOPC_StaMac_Machine *pSM, SOPC_DeleteMonitoredItems_Ctx *pAppCtx)
Returns whether the machine has deleted the MonitoredItems with the given appCtx or not....
Interface of a library supporting the subscription management, read/write operation and browse.
@ stClosing
Definition: state_machine.h:69
@ SOPC_REQUEST_TYPE_SUBSCRIPTION
Definition: state_machine.h:78
uintptr_t appCtx
Definition: state_machine.h:98
SOPC_ReturnStatus SOPC_StaMac_NewDeleteMonitoredItems(SOPC_StaMac_Machine *pSM, OpcUa_DeleteMonitoredItemsRequest *req, SOPC_DeleteMonitoredItems_Ctx *outAppCtx)
Deletes created monitored items for the state machine subscription using the request (new API)
SOPC_SecretBuffer SOPC_SerializedAsymmetricKey
A serialized representation of an asymmetric key.
Definition: sopc_crypto_decl.h:70
void SOPC_StaMac_Delete(SOPC_StaMac_Machine **ppSM)
Deletes and deallocate the machine.
bool SOPC_StaMac_EventDispatcher(SOPC_StaMac_Machine *pSM, uintptr_t *pAppCtx, SOPC_App_Com_Event event, uint32_t arg, void *pParam, uintptr_t appCtx)
Handles the events from the Toolkit and changes the state machine state.
void SOPC_LibSub_DataChangeCbk(const SOPC_LibSub_ConnectionId c_id, const SOPC_LibSub_DataId d_id, const SOPC_LibSub_Value *value)
Callback type for data change event (related to a subscription)
Definition: libs2opc_client.h:247
@ stDeletingSubscr
Definition: state_machine.h:68
Bytes buffer structure.
Definition: sopc_buffer.h:38
SOPC_StaMac_Machine * pSM
Definition: state_machine.h:97
uintptr_t outCtxId
Definition: state_machine.h:336
SOPC_ReturnStatus SOPC_StaMac_SetSubscriptionNbTokens(SOPC_StaMac_Machine *pSM, uint32_t nbTokens)
SOPC_ReturnStatus SOPC_StaMac_NewCreateMonitoredItems(SOPC_StaMac_Machine *pSM, OpcUa_CreateMonitoredItemsRequest *req, const uintptr_t *userAppCtxArray, SOPC_CreateMonitoredItems_Ctx *pAppCtx)
Creates new monitored items for the state machine subscription using the request (new API)
@ stDeletingMonIt
Definition: state_machine.h:67
SOPC_ReturnStatus SOPC_StaMac_ConfigureDataChangeCallback(SOPC_StaMac_Machine *pSM, SOPC_ClientHelper_DataChangeCbk *pCbkClientHelper)
@ stActivating
Definition: state_machine.h:63
Context structure to be provided when using SOPC_StaMac_NewDeleteMonitoredItems.
Definition: state_machine.h:333
void SOPC_StaMacNotification_Fct(uintptr_t subscriptionAppCtx, SOPC_StatusCode status, SOPC_EncodeableType *notificationType, uint32_t nbNotifElts, const void *notification, uintptr_t *monitoredItemCtxArray)
Type of callback called on Subscription Notification.
Definition: state_machine.h:291
Provide circular logging.
uintptr_t SOPC_StaMac_GetSubscriptionCtx(SOPC_StaMac_Machine *pSM)
return the context provided in SOPC_StaMac_NewCreateSubscription
void SOPC_StaMac_SetError(SOPC_StaMac_Machine *pSM)
Put the state machine in error state (without closing). This avoids additional notifications.
int64_t SOPC_StaMac_GetTimeout(SOPC_StaMac_Machine *pSM)
Returns the timeout of the machine, used for the synchronous calls.
OpcUa_CreateMonitoredItemsRequest * req
Definition: state_machine.h:246
SOPC_StaMac_RequestScope
Definition: state_machine.h:84
SOPC_StaMac_RequestType
Definition: state_machine.h:74
Definition: state_machine.h:96
bool SOPC_StaMac_IsConnectable(SOPC_StaMac_Machine *pSM)
Returns a bool whether the machine is configured and ready for a new SecureChannel.
SOPC_StaMac_RequestScope requestScope
Definition: state_machine.h:99
SOPC_ReturnStatus SOPC_StaMac_CreateSubscription(SOPC_StaMac_Machine *pSM)
Context structure to be provided when using SOPC_StaMac_CreateMonitoredItem or SOPC_StaMac_NewCreateM...
Definition: state_machine.h:240
@ SOPC_REQUEST_SCOPE_DISCOVERY
Definition: state_machine.h:88
SOPC_ReturnStatus SOPC_StaMac_SendRequest(SOPC_StaMac_Machine *pSM, void *requestStruct, uintptr_t appCtx, SOPC_StaMac_RequestScope requestScope, SOPC_StaMac_RequestType requestType)
Sends a request, wraps SOPC_ToolkitClient_AsyncSendRequestOnSession().
Definition: sopc_types.h:5841
uintptr_t outCtxId
Definition: state_machine.h:243
SOPC_ReturnStatus SOPC_StaMac_StopSession(SOPC_StaMac_Machine *pSM)
Closes the session.
@ SOPC_REQUEST_SCOPE_STATE_MACHINE
Definition: state_machine.h:85
@ SOPC_REQUEST_SCOPE_APPLICATION
Definition: state_machine.h:86
Contains the types to be used by the user application to use the Toolkit.
SOPC_App_Com_Event
Client and Server communication events to be managed by applicative code.
Definition: sopc_user_app_itf.h:381
SOPC_ReturnStatus SOPC_StaMac_GetSubscriptionRevisedParams(SOPC_StaMac_Machine *pSM, double *revisedPublishingInterval, uint32_t *revisedLifetimeCount, uint32_t *revisedMaxKeepAliveCount)
bool SOPC_StaMac_HasSubscription(SOPC_StaMac_Machine *pSM)
Returns a bool whether the machine has an active subscription or not.
@ stInit
Definition: state_machine.h:62
SOPC_ReturnStatus SOPC_StaMac_CreateMonitoredItem(SOPC_StaMac_Machine *pSM, char const *const *lszNodeId, const uint32_t *liAttrId, int32_t nElems, SOPC_CreateMonitoredItems_Ctx *pAppCtx, uint32_t *lCliHndl)
Creates a MonitoredItem asynchronously.
struct SOPC_CreateMonitoredItems_Ctx SOPC_CreateMonitoredItems_Ctx
Context structure to be provided when using SOPC_StaMac_CreateMonitoredItem or SOPC_StaMac_NewCreateM...
Definition: sopc_types.h:5562
struct SOPC_DeleteMonitoredItems_Ctx SOPC_DeleteMonitoredItems_Ctx
Context structure to be provided when using SOPC_StaMac_NewDeleteMonitoredItems.
Definition: sopc_types.h:5586
bool SOPC_StaMac_IsConnected(SOPC_StaMac_Machine *pSM)
Returns a bool whether the machine is in a connected state or not.
@ SOPC_REQUEST_TYPE_PUBLISH
Definition: state_machine.h:77
Interface of an example client library supporting the subscription management.
@ stCreatingMonIt
Definition: state_machine.h:66
@ stCreatingSubscr
Definition: state_machine.h:65
bool SOPC_StaMac_PopMonItByAppCtx(SOPC_StaMac_Machine *pSM, SOPC_CreateMonitoredItems_Ctx *pAppCtx)
Returns whether the machine has created the MonitoredItems with the given appCtx or not....
SOPC_ReturnStatus SOPC_StaMac_NewConfigureNotificationCallback(SOPC_StaMac_Machine *pSM, SOPC_StaMacNotification_Fct *pNotificationCb)
Encodeable object type structure definition. It provides all the services functions associated with t...
Definition: sopc_encodeabletype.h:161
Defines the cryptographic profiles: constants and struct.
SOPC_ReturnStatus SOPC_StaMac_StartSession(SOPC_StaMac_Machine *pSM)
Creates a session asynchronously.
uint32_t SOPC_StaMac_HasSubscriptionId(SOPC_StaMac_Machine *pSM)
Returns subscription Id whether the machine has an active subscription or not (id = 0).
OpcUa_DeleteMonitoredItemsRequest * req
Definition: state_machine.h:338
SOPC_ReturnStatus SOPC_StaMac_DeleteSubscription(SOPC_StaMac_Machine *pSM)
Delete subscription associated to the given state machine.
@ SOPC_REQUEST_TYPE_USER
Definition: state_machine.h:76
struct SOPC_StaMac_Machine SOPC_StaMac_Machine
Definition: state_machine.h:93
SOPC_ReturnStatus
Definition: libs2opc_client.h:64