You are using MindConnect Libary (MCLib) to connect your machine or asset to the MindSphere cloud. The tokens used to securely manage this connection need to be refreshed at specific intervals.
Solution
There are two functions that an MCLib agent must call at some specific periods to be able to send data for long periods.
If the agent does not call these functions it will fail to send data after some time.
Here is an example code:
// If everything is successful so far, exchange the store which contains timeseries. if (MCL_OK == code) {printf("Uploading timeseries: "); code = mcl_communication_exchange(communication, store, NULL); // If exchange returns unauthorized, then get new access token. if (MCL_UNAUTHORIZED == code) {printf("Getting new access token: "); code = mcl_communication_get_access_token(communication); // If getting new access token is successful, then try exchange again. if (MCL_OK == code) { printf("Retrying exchange: "); code = mcl_communication_exchange(communication, store, NULL); } else if (MCL_BAD_REQUEST == code) { // If get access token call returns bad request error then rotate key and try exchanging again. printf("Calling rotate key: "); code = mcl_communication_rotate_key(communication); // If key rotation is successful, then retry exchange. if (MCL_OK == code) { printf("Retrying exchange: "); code = mcl_communication_exchange(communication, store, NULL); }}}}Notes