COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
kisstnc_lib.h
Go to the documentation of this file.
1 /********************************************************************
2 * Copyright (C) 2015 by Interstel Technologies, Inc.
3 * and Hawaii Space Flight Laboratory.
4 *
5 * This file is part of the COSMOS/core that is the central
6 * module for COSMOS. For more information on COSMOS go to
7 * <http://cosmos-project.com>
8 *
9 * The COSMOS/core software is licenced under the
10 * GNU Lesser General Public License (LGPL) version 3 licence.
11 *
12 * You should have received a copy of the
13 * GNU Lesser General Public License
14 * If not, go to <http://www.gnu.org/licenses/>
15 *
16 * COSMOS/core is free software: you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public License
18 * as published by the Free Software Foundation, either version 3 of
19 * the License, or (at your option) any later version.
20 *
21 * COSMOS/core is distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
25 *
26 * Refer to the "licences" folder for further information on the
27 * condititons and terms to use this software.
28 ********************************************************************/
29 
37 #ifndef _KISSTNCLIB_H
38 #define _KISSTNCLIB_H 1
39 
40 
41 #include "support/configCosmos.h"
42 
43 #include <stdio.h>
44 #include <errno.h>
45 
47 #include "support/cosmos-errno.h"
48 
49 #define KISSTNC_MTU 254
50 #define KISSTNC_PAYLOAD_SIZE KISSTNC_MTU
51 
52 //#define KISSTNC_PAYLOAD_SIZE 255
53 #define KISSTNC_FULL_SIZE (KISSTNC_PAYLOAD_SIZE+19)
54 #define AX25_FLAG 0x7E
55 #define AX25_NOLAYER3 0xF0
56 
57 #define KISSTNC_ID 1
58 #define KISSTNC_BAUD 19200
59 #define KISSTNC_BITS 8
60 #define KISSTNC_PARITY 0
61 #define KISSTNC_STOPBITS 1
62 
63 typedef struct
64 {
65  union
66  {
67  struct
68  {
69  union
70  {
71  struct
72  {
73  uint8_t flag;
74  char destination_address[7];
75  char source_address[7];
76  uint8_t control;
77  uint8_t protocol_id;
78  } header;
79  uint8_t preamble[17];
80  };
81  uint8_t payload[KISSTNC_PAYLOAD_SIZE+2];
82  } part;
83  uint8_t full[KISSTNC_FULL_SIZE];
84  };
85  uint16_t size;
87 
88 typedef struct
89 {
92  uint8_t flag;
94 
95 int32_t kisstnc_connect(char *dev, kisstnc_handle *handle, uint8_t flag);
99 int32_t kisstnc_loadframe(kisstnc_handle *handle, uint8_t *data, uint16_t size);
100 int32_t kisstnc_loadframe(kisstnc_handle *handle, vector<uint8_t> data);
101 int32_t kisstnc_unloadframe(kisstnc_handle *handle, uint8_t *data, uint16_t size);
102 int32_t kisstnc_unloadframe(kisstnc_handle *handle, vector<uint8_t> &data);
103 uint16_t kisstnc_calc_fcs(uint8_t *data, uint16_t length);
106 
107 
108 #endif
vector< string > part
Definition: cubesat2obj.cpp:5
uint16_t kisstnc_calc_fcs(uint8_t *data, uint16_t length)
Definition: kisstnc_lib.cpp:67
int32_t kisstnc_connect(char *dev, kisstnc_handle *handle, uint8_t flag)
Definition: kisstnc_lib.cpp:78
int32_t kisstnc_unloadframe(kisstnc_handle *handle, uint8_t *data, uint16_t size)
Definition: kisstnc_lib.cpp:177
int32_t kisstnc_sendframe(kisstnc_handle *handle)
Definition: kisstnc_lib.cpp:117
Definition: kisstnc_lib.h:88
Simple Serial library header file.
int32_t kisstnc_enterkiss(kisstnc_handle *handle)
Definition: kisstnc_lib.cpp:213
Definition: kisstnc_lib.h:63
int32_t kisstnc_recvframe(kisstnc_handle *handle)
Definition: kisstnc_lib.cpp:98
uint16_t size
Definition: kisstnc_lib.h:85
Headers and definitions common to all COSMOS.
COSMOS Error Codes.
uint8_t protocol_id
Definition: kisstnc_lib.h:77
#define KISSTNC_PAYLOAD_SIZE
Definition: kisstnc_lib.h:50
gige_handle * handle
Definition: kpc9612p_recv.cpp:33
uint8_t flag
Definition: kisstnc_lib.h:92
uint8_t control
Definition: kisstnc_lib.h:76
kisstnc_frame frame
Definition: kisstnc_lib.h:91
int32_t kisstnc_exitkiss(kisstnc_handle *handle)
Definition: kisstnc_lib.cpp:205
png_uint_32 length
Definition: png.c:2173
uint8_t flag
Definition: kisstnc_lib.h:73
#define KISSTNC_FULL_SIZE
Definition: kisstnc_lib.h:53
int32_t kisstnc_loadframe(kisstnc_handle *handle, uint8_t *data, uint16_t size)
Definition: kisstnc_lib.cpp:127
cssl_t * serial
Definition: kisstnc_lib.h:90
int32_t kisstnc_disconnect(kisstnc_handle *handle)
Definition: kisstnc_lib.cpp:90
Definition: cssl_lib.h:34