Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
Beam Positoning Monitor - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Beam Positoning Monitor - Software
Commits
0ec3b03c
Commit
0ec3b03c
authored
Jun 10, 2015
by
Lucas Russo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src/libs/libbpmclient/*: adhere to CLASS RFC
CLASS RFC locate in
http://rfc.zeromq.org/spec:21
parent
0e98ccaf
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
35 deletions
+46
-35
bpm_client.c
src/libs/libbpmclient/bpm_client.c
+16
-0
bpm_client.h
src/libs/libbpmclient/bpm_client.h
+15
-27
bpm_client_rw_param.c
src/libs/libbpmclient/bpm_client_rw_param.c
+11
-2
bpm_client_rw_param.h
src/libs/libbpmclient/bpm_client_rw_param.h
+4
-6
No files found.
src/libs/libbpmclient/bpm_client.c
View file @
0ec3b03c
...
...
@@ -41,6 +41,13 @@
#define BPMCLIENT_DFLT_LOG_MODE "w"
#define BPMCLIENT_MLM_CONNECT_TIMEOUT 1000
/* in ms */
/* Our structure */
struct
_bpm_client_t
{
zuuid_t
*
uuid
;
/* Client UUID */
mlm_client_t
*
mlm_client
;
/* Malamute client instance */
const
acq_chan_t
*
acq_chan
;
/* Acquisition buffer table */
};
static
bpm_client_t
*
_bpm_client_new
(
char
*
broker_endp
,
int
verbose
,
const
char
*
log_file_name
,
const
char
*
log_mode
);
...
...
@@ -272,6 +279,15 @@ bpm_client_err_e bpm_func_trans_exec (bpm_client_t *self, char *name, char *serv
bpm_client_err_e
err
=
bpm_func_exec
(
self
,
func
,
service
,
input
,
output
);
return
err
;
}
/********************** Accessor Methods **********************/
mlm_client_t
*
bpm_get_mlm_client
(
bpm_client_t
*
self
)
{
assert
(
self
);
return
self
->
mlm_client
;
}
/**************** FMC130M SMIO Functions ****************/
bpm_client_err_e
bpm_blink_leds
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
leds
)
{
...
...
src/libs/libbpmclient/bpm_client.h
View file @
0ec3b03c
...
...
@@ -15,15 +15,6 @@
#include "bpm_client_err.h"
#include "acq_chan.h"
/* SMIO acq channel definition */
struct
_acq_chan_t
;
/* Our structure */
struct
_bpm_client_t
{
zuuid_t
*
uuid
;
/* Client UUID */
mlm_client_t
*
mlm_client
;
/* Malamute client instance */
const
struct
_acq_chan_t
*
acq_chan
;
/* Acquisition buffer table */
};
typedef
struct
_bpm_client_t
bpm_client_t
;
/********************************************************/
...
...
@@ -57,8 +48,14 @@ const disp_op_t* bpm_func_translate (char *name);
/* Wrapper to bpm_func_exec which translates the function name to
* its exp_ops structure */
bpm_client_err_e
bpm_func_trans_exec
(
bpm_client_t
*
self
,
char
*
name
,
bpm_client_err_e
bpm_func_trans_exec
(
bpm_client_t
*
self
,
char
*
name
,
char
*
service
,
uint32_t
*
input
,
uint32_t
*
output
);
/********************** Accessor Methods **********************/
/* Get MLM client handler from client */
mlm_client_t
*
bpm_get_mlm_client
(
bpm_client_t
*
self
);
/******************** FMC130M SMIO Functions ******************/
/* Blink the FMC Leds. This is only used for debug and for demostration
...
...
@@ -345,39 +342,31 @@ bpm_client_err_e bpm_set_si571_defaults (bpm_client_t *self, char *service,
/********************** ACQ SMIO Functions ********************/
/* Acquistion request */
struct
_acq_req_
t
{
typedef
struc
t
{
uint32_t
num_samples
;
/* Number of samples */
uint32_t
chan
;
/* Acquisition channel number */
};
typedef
struct
_acq_req_t
acq_req_t
;
}
acq_req_t
;
/* Acquistion data block */
struct
_acq_block_
t
{
typedef
struc
t
{
uint32_t
idx
;
/* Block index */
uint32_t
*
data
;
/* Block or complete curve read */
uint32_t
data_size
;
/* data_out buffer size */
uint32_t
bytes_read
;
/* Number of bytes effectively read */
};
typedef
struct
_acq_block_t
acq_block_t
;
}
acq_block_t
;
/* Acquistion transaction */
struct
_acq_trans_
t
{
typedef
struc
t
{
acq_req_t
req
;
/* Request */
acq_block_t
block
;
/* Block or whole curve read */
};
typedef
struct
_acq_trans_t
acq_trans_t
;
}
acq_trans_t
;
/* Acquisition channel definitions */
struct
_acq_chan_
t
{
typedef
struc
t
{
uint32_t
chan
;
uint32_t
sample_size
;
};
typedef
struct
_acq_chan_t
acq_chan_t
;
}
acq_chan_t
;
/* Acquisition channel definitions */
extern
acq_chan_t
acq_chan
[
END_CHAN_ID
];
...
...
@@ -768,6 +757,5 @@ bpm_client_err_e bpm_get_afc_diag_build_user_email (bpm_client_t *self, char *se
bpm_client_err_e
func_polling
(
bpm_client_t
*
self
,
char
*
name
,
char
*
service
,
uint32_t
*
input
,
uint32_t
*
output
,
int
timeout
);
#endif
src/libs/libbpmclient/bpm_client_rw_param.c
View file @
0ec3b03c
...
...
@@ -42,15 +42,20 @@ bpm_client_err_e param_client_send_gen_rw (bpm_client_t *self, char *service,
ASSERT_TEST
(
param
!=
NULL
,
"param_client_send_gen_rw (): parameter cannot be NULL"
,
err_param_null
,
BPM_CLIENT_ERR_INV_PARAM
);
mlm_client_t
*
client
=
bpm_get_mlm_client
(
self
);
ASSERT_TEST
(
client
!=
NULL
,
"Could not get BPM client handler"
,
err_get_handler
,
BPM_CLIENT_ERR_SERVER
);
zmsg_t
*
request
=
zmsg_new
();
ASSERT_ALLOC
(
request
,
err_send_msg_alloc
,
BPM_CLIENT_ERR_ALLOC
);
zmsg_addmem
(
request
,
&
operation
,
sizeof
(
operation
));
zmsg_addmem
(
request
,
&
rw
,
sizeof
(
rw
));
zmsg_addmem
(
request
,
param
,
size
);
mlm_client_sendto
(
self
->
mlm_
client
,
service
,
NULL
,
NULL
,
0
,
&
request
);
mlm_client_sendto
(
client
,
service
,
NULL
,
NULL
,
0
,
&
request
);
err_send_msg_alloc:
err_get_handler:
err_param_null:
return
err
;
}
...
...
@@ -64,11 +69,15 @@ bpm_client_err_e param_client_recv_rw (bpm_client_t *self, char *service,
bpm_client_err_e
err
=
BPM_CLIENT_SUCCESS
;
/* Receive report */
*
report
=
mlm_client_recv
(
self
->
mlm_client
);
mlm_client_t
*
client
=
bpm_get_mlm_client
(
self
);
ASSERT_TEST
(
client
!=
NULL
,
"Could not get BPM client handler"
,
err_get_handler
,
BPM_CLIENT_ERR_SERVER
);
*
report
=
mlm_client_recv
(
client
);
ASSERT_TEST
(
*
report
!=
NULL
,
"Could not receive message"
,
err_null_msg
,
BPM_CLIENT_ERR_SERVER
);
err_null_msg:
err_get_handler:
return
err
;
}
...
...
src/libs/libbpmclient/bpm_client_rw_param.h
View file @
0ec3b03c
...
...
@@ -63,18 +63,16 @@
bpm_client_err_e PARAM_FUNC_CLIENT_NAME_READ(param) (bpm_client_t *self, \
char *service, void *param, size_t size)
struct
_bpm_client_t
;
/* Low-level protocol functions */
bpm_client_err_e
param_client_send_gen_rw
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
operation
,
uint32_t
rw
,
void
*
param
,
size_t
size
);
bpm_client_err_e
param_client_recv_rw
(
struct
_
bpm_client_t
*
self
,
char
*
service
,
bpm_client_err_e
param_client_recv_rw
(
bpm_client_t
*
self
,
char
*
service
,
zmsg_t
**
report
);
/* Write functions */
bpm_client_err_e
param_client_write_raw
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
operation
,
uint32_t
param1
,
uint32_t
param2
);
bpm_client_err_e
param_client_write
(
struct
_
bpm_client_t
*
self
,
char
*
service
,
bpm_client_err_e
param_client_write
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
operation
,
uint32_t
param
);
bpm_client_err_e
param_client_write_double
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
operation
,
double
param
);
...
...
@@ -82,11 +80,11 @@ bpm_client_err_e param_client_write_gen (bpm_client_t *self, char *service,
uint32_t
operation
,
uint32_t
param1
,
void
*
param2
,
size_t
size
);
/* Read functions */
bpm_client_err_e
param_client_read
(
struct
_
bpm_client_t
*
self
,
char
*
service
,
bpm_client_err_e
param_client_read
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
operation
,
uint32_t
*
param_out
);
bpm_client_err_e
param_client_read_gen
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
operation
,
uint32_t
param1
,
void
*
param_out
,
size_t
size
);
bpm_client_err_e
param_client_read_double
(
struct
_
bpm_client_t
*
self
,
char
*
service
,
bpm_client_err_e
param_client_read_double
(
bpm_client_t
*
self
,
char
*
service
,
uint32_t
operation
,
double
*
param_out
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment