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

Functions

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

Variables

kpc9612p_handle handle
 
char device [35] ="/dev/ttyUSB0"
 
char source [15]
 
char destination [15]
 
uint8_t message [300]
 
size_t count = 2000
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)
40 {
41  int32_t iretn;
42 
43  switch (argc)
44  {
45  case 3:
46  count = atol(argv[2]);
47  case 2:
48  strcpy(device,argv[1]);
49  case 1:
50  break;
51  default:
52  printf("Usage: kpc9612p_send [device [count]]\n");
53  exit(-1);
54  break;
55  }
56 
57  if ((iretn=kpc9612p_connect(device, &handle, 0x00)) < 0)
58  {
59  printf("Failed to open KPC9612P on %s, error %d\n",device,iretn);
60  exit (-1);
61  }
62 
63 // lmjd = currentmjd(0.);
64  handle.frame.size = 255;
65  for (uint16_t i=0; i<count; ++i)
66  {
67 
68  for (uint16_t j=1; j<=handle.frame.size; ++j)
69  {
70  message[j] = i%256;
71  }
72  message[0] = 0x10;
73  if ((iretn=cssl_putslip(handle.serial, message, handle.frame.size+1)) < 0)
74  {
75  printf("Failed to send frame, error %d\r",iretn);
76  }
77  else
78  {
79  printf("[%u] Sent %d bytes\n",i,handle.frame.size);
80  }
81  COSMOS_USLEEP(2000000);
82 // lmjd = currentmjd(0.);
83  }
84 
85 // kpc9612p_exitkiss(&handle);
86 }
int32_t kpc9612p_connect(char *dev, kpc9612p_handle *handle, uint8_t flag)
Definition: kpc9612p_lib.cpp:78
size_t count
Definition: kpc9612p_send.cpp:37
int i
Definition: rw_test.cpp:37
int iretn
Definition: rw_test.cpp:37
kpc9612p_frame frame
Definition: kpc9612p_lib.h:91
uint8_t message[300]
Definition: kpc9612p_send.cpp:36
cssl_t * serial
Definition: kpc9612p_lib.h:90
char device[35]
Definition: kpc9612p_send.cpp:34
uint16_t size
Definition: kpc9612p_lib.h:85
int32_t cssl_putslip(cssl_t *serial, uint8_t *buf, size_t size)
Definition: cssl_lib.cpp:586
kpc9612p_handle handle
Definition: kpc9612p_send.cpp:33

Variable Documentation

char device[35] ="/dev/ttyUSB0"
char source[15]
char destination[15]
uint8_t message[300]
size_t count = 2000