HIPC  0.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
client_rt.c
Go to the documentation of this file.
1 #include <unistd.h>
2 
3 #include <stdio.h>
4 
6 #include <hipc/session.h>
7 
8 #include "CFGrt.h"
9 #include "CFGrt_ccfg.h"
10 
11 int main(void)
12 {
13  hipc_session sess;
14  struct STRUprm prm;
15  int fdr = STDIN_FILENO;
16  int fdw = STDOUT_FILENO;
17 
18  hipcOpen(&sess, &HIPCUD_CFGrt_CCFG,
19  hipcPosixReadMsg, &fdr, hipcPosixWriteMsg, &fdw);
20  HIPC_ERRCHECK(&sess);
21 
22  prm.led = 1;
23  hipcPut(&sess, "STRUprm.led", &prm);
24  HIPC_ERRCHECK(&sess);
25 
26  prm.led = 0;
27  hipcPut(&sess, "STRUprm.led", &prm);
28  HIPC_ERRCHECK(&sess);
29 
30  hipcClose(&sess);
31  HIPC_ERRCHECK(&sess);
32  fprintf(stderr, "end\n");
33 
34  return 0;
35 }
int main(void)
Definition: client_rt.c:11
enum HIPC_errno hipcPut(hipc_session *const sess_p, char const *const str, void *const cimg)
Puts data specified by str from a HIPC server.
Definition: session.c:361
enum HIPC_errno hipcOpen(hipc_session *const sess_p, struct HIPC_client const *const clbase_p, enum HIPC_errno(*rfnc_p)(void *, hipc_msg), void *rarg, enum HIPC_errno(*wfnc_p)(void *, const hipc_msg), void *warg)
Open a session to a HIPC server.
Definition: session.c:217
enum HIPC_errno hipcPosixReadMsg(void *arg, hipc_msg msg)
Read a HIPC message from fd.
enum HIPC_errno hipcClose(hipc_session *const sess_p)
Closes a session.
Definition: session.c:276
enum HIPC_errno hipcPosixWriteMsg(void *arg, const hipc_msg msg)
Write a HIPC message to fd.
#define HIPC_ERRCHECK(sess_p)
Checks whether an error has occurred.
Definition: session.h:72