telemetry.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Kubos Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
24 #ifndef TELEMETRY_H
25 #define TELEMETRY_H
26 
27 #include "ipc/pubsub.h"
28 #include "telemetry/config.h"
29 #include "telemetry/types.h"
30 #include <csp/arch/csp_thread.h>
31 #include <stdbool.h>
32 
36 CSP_DEFINE_TASK(telemetry_rx_task);
37 
42 void telemetry_init(void);
43 
47 void telemetry_cleanup(void);
48 
53 pubsub_conn * telemetry_connect(void);
54 
59 pubsub_conn * kprv_telemetry_connect(void);
60 
67 bool telemetry_subscribe(const pubsub_conn * conn, uint16_t topic_id);
68 
74 bool telemetry_disconnect(pubsub_conn * conn);
75 
82 bool telemetry_unsubscribe(const pubsub_conn * conn, uint16_t topic_id);
83 
90 bool telemetry_read(const pubsub_conn * conn, telemetry_packet * packet);
91 
99 
103 int telemetry_num_subscribers(void);
104 
111 bool telemetry_is_subscribed(const pubsub_conn * client_conn, uint16_t topic_id);
112 
113 #endif
114 
115 /* @} */
Basic telemetry packet structure - encapsulating routing information and data.
Definition: types.h:70
void telemetry_init(void)
Performs basic telemetry connection and thread initialization.
pubsub_conn * telemetry_connect(void)
Connects to the telemetry system - thread safe version.
bool telemetry_unsubscribe(const pubsub_conn *conn, uint16_t topic_id)
Unsubscribes a connection from a specific topic.
void telemetry_cleanup(void)
Performs cleanup on telemetry resources & threads.
CSP_DEFINE_TASK(telemetry_rx_task)
Task used to receive incoming data from telemetry publishers.
bool telemetry_subscribe(const pubsub_conn *conn, uint16_t topic_id)
Subscribes the pubsub_conn to the specified topic.
int telemetry_num_subscribers(void)
bool telemetry_disconnect(pubsub_conn *conn)
Disconnects from the telemetry system.
bool telemetry_is_subscribed(const pubsub_conn *client_conn, uint16_t topic_id)
Checks if a telemetry client is subscribed to a topic.
pubsub_conn * kprv_telemetry_connect(void)
Internal connect function - not thread safe.
bool telemetry_read(const pubsub_conn *conn, telemetry_packet *packet)
Reads a telemetry packet from the telemetry server.
bool telemetry_publish(telemetry_packet packet)
Public facing telemetry input interface.