/******************************************************************************* * Copyright (c) 2017 fortiss GmbH. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v20.html * * Contributors: * Florian Hoelzl - initial API and implementation *******************************************************************************/ #ifndef INC_AF3_H_ #define INC_AF3_H_ #include <canthread.h> #include <stdbool.h> #include <stdint.h> // Make sure "data_dictionary.h" is included before "autofocus3_layer.h" for generated code #ifndef __HEADER_data_dictionary_h typedef bool GEN_TYPE_boolean; typedef int GEN_TYPE_int; typedef double GEN_TYPE_double; #endif /** Sets the unit identifier of this execution unit (mostly used when communicating with the control center. */ void af3_set_execution_unit_identifier(char* identifier); /** Create a message containing a boolean value for this id. */ struct can_thread_message* af3_create_message_bool(uint8_t id, GEN_TYPE_boolean value); /** Create a message containing an integer value for this id. */ struct can_thread_message* af3_create_message_int(uint8_t id, GEN_TYPE_int value); /** Create a message containing a double value for this id. */ struct can_thread_message* af3_create_message_double(uint8_t id, GEN_TYPE_double value); /** Returns whether the message represents a NoVal value. */ GEN_TYPE_boolean af3_is_noval(can_thread_message_t* message); /** Returns the boolean value contained in the message. */ GEN_TYPE_boolean af3_get_boolean(can_thread_message_t* message); /** Returns the integer value contained in the message. */ GEN_TYPE_int af3_get_int(can_thread_message_t* message); /** Returns the double value contained in the message. */ GEN_TYPE_double af3_get_double(can_thread_message_t* message); /** Activates the control center connection. */ void af3_cc_activate(char* server_ip_address, uint16_t server_port); /** Sends a NoVal signal with the given name to the control center. */ void af3_cc_send_noval(char* signal, uint64_t timestamp); /** Sends a boolean signal with the given name to the control center. */ void af3_cc_send_boolean(char* signal, GEN_TYPE_boolean value, uint64_t timestamp); /** Sends an int signal with the given name to the control center. */ void af3_cc_send_int(char* signal, GEN_TYPE_int value, uint64_t timestamp); /** Sends a double signal with the given name to the control center. */ void af3_cc_send_double(char* signal, GEN_TYPE_double value, uint64_t timestamp); /** Deactivates the control center connection. */ void af3_cc_deactivate(); #endif /* INC_AF3_H_ */