COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
kiss_send.cpp File Reference
Include dependency graph for kiss_send.cpp:

Functions

int main (int argc, char *argv[])
 

Variables

static KissHandle handle ("DESTIN","SOURCE")
 
static Serialshandle
 
static string device ="/dev/tty_tnc"
 
static string source
 
static string destination
 
static vector< uint8_t > message
 
size_t count = 254
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)
43 {
44  int32_t iretn;
45 
46  switch (argc)
47  {
48  case 3:
49  count = atol(argv[2]);
50  case 2:
51  device = argv[1];
52  case 1:
53  break;
54  default:
55  printf("Usage: kiss_send [device [count]]\n");
56  exit(-1);
57  break;
58  }
59 
60  shandle = new Serial(device, 19200);
61  if (!shandle->get_open())
62  {
63  printf("Failed to open Serial Channel on %s, error %d\n", device.c_str(), shandle->get_error());
64  exit (-1);
65  }
66 // handle = new KissHandle("DESTIN", "SOURCE");
67 
68  if (count > 254)
69  {
70  count = 254;
71  }
72  for (uint16_t i=0; i<count; ++i)
73  {
74  message.clear();
75  message.push_back(0x10);
76  for (uint16_t j=1; j<=count; ++j)
77  {
78  message.push_back(i%256);
79  }
82  if ((iretn=shandle->put_data(handle.get_slip_packet())) < 0)
83  {
84  printf("Failed to send frame, error %d\r",iretn);
85  }
86  else
87  {
88  printf("[%u] Sent %ld bytes\n", i, handle.get_slip_packet().size());
89  }
90  COSMOS_USLEEP(2000000);
91  }
92 
93 }
static KissHandle handle("DESTIN","SOURCE")
size_t count
Definition: kiss_send.cpp:40
int32_t put_data(vector< uint8_t > data)
Definition: serialclass.cpp:707
int i
Definition: rw_test.cpp:37
Definition: serialclass.h:43
int iretn
Definition: rw_test.cpp:37
vector< uint8_t > get_slip_packet()
Definition: kisslib.cpp:311
static vector< uint8_t > message
Definition: kiss_send.cpp:39
static string device
Definition: kiss_send.cpp:36
bool get_open()
Definition: serialclass.cpp:158
int32_t set_data(vector< uint8_t > input)
Definition: kisslib.cpp:258
static Serial * shandle
Definition: kiss_send.cpp:35
int32_t get_error()
Definition: serialclass.cpp:170
int32_t load_packet()
Definition: kisslib.cpp:281

Variable Documentation

KissHandle handle("DESTIN","SOURCE")
static
Serial* shandle
static
string device ="/dev/tty_tnc"
static
string source
static
string destination
static
vector<uint8_t> message
static
size_t count = 254