ConnecCore Cloud Services daemon connects to Remote Manager and listens for CCCS applications to route data to/from Remote Manager.

A CCCS-enabled application must ensure the deamon is ready to be able to send and receive data. To do so, use cccs_is_daemon_ready() function.

bool cccs_is_daemon_ready(long timeout);

This function returns true if the CCCS daemon is ready to send and receive data, and false otherwise.

timeout is the number of seconds to wait for daemon readiness:

  • CCCSD_WAIT_FOREVER blocks until the daemon is ready.

  • CCCSD_NO_WAIT to check the daemon status and return immediately.

  • Any other value blocks until either the daemon is ready or the time is up.

Check CCCS daemon status
int main (void)
{
	/* [...] */

	if (!cccs_is_daemon_ready(CCCSD_NO_WAIT)) {
		log_error("%s: CCCS daemon not ready... exiting", __func__);

		return EXIT_FAILURE;
	}

	 /* [...] */
}

Make sure your device is registered within your Remote Manager account before attempting to connect. For more information on registering your device in Remote Manager see Connect to Remote Manager.

Log messages

The library uses syslog for logging.

You can establish the logging level of the library by calling init_logger() and stop logging using deinit_logger().

Function Description

int init_logger(int level, int options, char *name)

Initialize the API logger with one of the log levels defined in syslog.h:

  • level: Log level

    • LOG_EMERG: System is unusable

    • LOG_ALERT: Action must be taken immediately

    • LOG_CRIT: Critical conditions

    • LOG_ERR: Error conditions

    • LOG_WARNING: Warning conditions

    • LOG_NOTICE: Normal but significant condition

    • LOG_INFO: Informational

    • LOG_DEBUG: Debug-level messages

  • options: Flags to open log

    • LOG_CONS: Write directly to system console if there is an error while sending to system logger

    • LOG_NDELAY: Open the connection immediately (normally, the connection is opened when the first message is logged)

    • LOG_ODELAY: The converse of LOG_NDELAY; opening of the connection is delayed until syslog() is called. (This is the default, and need not be specified.)

    • LOG_PERROR: Print to stderr as well

    • LOG_PID: Include PID with each message

  • name: Name to prepend every log message. If NULL, 'CCCSD' is used.

void deinit_logger(void)

Close the logger

CCCS also allow to easily log a message with one of the following options:

Function Description

log_error(format, ...)

Log the given message as error

log_warning(format, ...)

Log the given message as warning

log_info(format, ...)

Log the given message as information

log_debug(format, ...)

Log the given message as debug