automotive-dlt
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <pthread.h>
#include "dlt_protocol.h"
#include "dlt_client.h"
#include "dlt-control-common.h"
#include "dlt_daemon_connection_types.h"
Go to the source code of this file.
Data Structures | |
struct | PassiveNodeOptions |
Macros | |
#define | MAX_RESPONSE_LENGTH 32 |
#define | DLT_NODE_CONNECT 1 |
#define | DLT_NODE_DISCONNECT 0 |
#define | DLT_NODE_CONNECT_UNDEF 999 |
#define | DLT_GATEWAY_CONNECTED 2 |
#define | DLT_NODE_CONNECTED_STR "Connected" |
#define | DLT_NODE_DISCONNECTED_STR "Disconnected" |
#define | UNDEFINED 999 |
Functions | |
unsigned int | get_command (void) |
void | set_command (unsigned int c) |
unsigned int | get_connection_state (void) |
void | set_connection_state (unsigned int s) |
void | set_node_id (char *id) |
char * | get_node_id () |
static void | dlt_print_passive_node_status (DltServicePassiveNodeConnectionInfo *info) |
Print passive node status information. More... | |
static int | dlt_passive_node_analyze_response (char *answer, void *payload, int len) |
Analyze received DLT Daemon response. More... | |
DltControlMsgBody * | dlt_passive_node_prepare_message_body () |
Prepare message body to be send to DLT Daemon. More... | |
void | dlt_passive_node_destroy_message_body (DltControlMsgBody *msg_body) |
Destroy message body. More... | |
static int | dlt_passive_node_ctrl_single_request () |
Send a single command to DLT daemon and wait for response. More... | |
static void | usage () |
static int | parse_args (int argc, char *argv[]) |
Parse application arguments. More... | |
int | main (int argc, char *argv[]) |
Entry point. More... | |
Variables | |
static struct PassiveNodeOptions | g_options |
app begin@ Copyright (C) 2015 Advanced Driver Information Technology. This code is developed by Advanced Driver Information Technology. Copyright of Advanced Driver Information Technology, Bosch and DENSO.
This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
For further information see http://www.genivi.org/. end@
Definition in file dlt-passive-node-ctrl.c.
#define DLT_GATEWAY_CONNECTED 2 |
Definition at line 67 of file dlt-passive-node-ctrl.c.
Referenced by dlt_print_passive_node_status().
#define DLT_NODE_CONNECT 1 |
Definition at line 63 of file dlt-passive-node-ctrl.c.
Referenced by parse_args(), and set_connection_state().
#define DLT_NODE_CONNECT_UNDEF 999 |
Definition at line 65 of file dlt-passive-node-ctrl.c.
Referenced by main().
#define DLT_NODE_CONNECTED_STR "Connected" |
Definition at line 68 of file dlt-passive-node-ctrl.c.
Referenced by dlt_print_passive_node_status().
#define DLT_NODE_DISCONNECT 0 |
Definition at line 64 of file dlt-passive-node-ctrl.c.
Referenced by parse_args(), and set_connection_state().
#define DLT_NODE_DISCONNECTED_STR "Disconnected" |
Definition at line 69 of file dlt-passive-node-ctrl.c.
Referenced by dlt_print_passive_node_status().
#define MAX_RESPONSE_LENGTH 32 |
Definition at line 61 of file dlt-passive-node-ctrl.c.
Referenced by dlt_passive_node_analyze_response().
#define UNDEFINED 999 |
Definition at line 71 of file dlt-passive-node-ctrl.c.
Referenced by main().
|
static |
Analyze received DLT Daemon response.
This function checks the received message. In particular, it checks the answer string 'service(<ID>, {ok, error, perm_denied})'. In any case the g_callback_return variable will be set as well which is evaluated in the main function after the communication thread returned.
message | Received DLT Message |
Definition at line 177 of file dlt-passive-node-ctrl.c.
References dlt_print_passive_node_status(), DLT_SERVICE_ID_PASSIVE_NODE_CONNECTION_STATUS, get_command(), MAX_RESPONSE_LENGTH, NULL, pr_error, and pr_verbose.
Referenced by dlt_passive_node_ctrl_single_request().
|
static |
Send a single command to DLT daemon and wait for response.
Definition at line 299 of file dlt-passive-node-ctrl.c.
References dlt_control_deinit(), dlt_control_init(), dlt_control_send_message(), dlt_passive_node_analyze_response(), dlt_passive_node_destroy_message_body(), dlt_passive_node_prepare_message_body(), get_ecuid(), get_timeout(), get_verbosity(), NULL, and pr_error.
Referenced by main().
void dlt_passive_node_destroy_message_body | ( | DltControlMsgBody * | msg_body | ) |
Destroy message body.
Definition at line 280 of file dlt-passive-node-ctrl.c.
References DltControlMsgBody::data, and NULL.
Referenced by dlt_passive_node_ctrl_single_request().
DltControlMsgBody* dlt_passive_node_prepare_message_body | ( | ) |
Prepare message body to be send to DLT Daemon.
Definition at line 234 of file dlt-passive-node-ctrl.c.
References DltControlMsgBody::data, DLT_ID_SIZE, DLT_SERVICE_ID_PASSIVE_NODE_CONNECT, DLT_SERVICE_ID_PASSIVE_NODE_CONNECTION_STATUS, get_command(), get_connection_state(), get_node_id(), NULL, and DltControlMsgBody::size.
Referenced by dlt_passive_node_ctrl_single_request().
|
static |
Print passive node status information.
info | DltServicePassiveNodeConnectionInfo |
Definition at line 136 of file dlt-passive-node-ctrl.c.
References DLT_GATEWAY_CONNECTED, DLT_ID_SIZE, DLT_NODE_CONNECTED_STR, DLT_NODE_DISCONNECTED_STR, and NULL.
Referenced by dlt_passive_node_analyze_response().
unsigned int get_command | ( | void | ) |
Definition at line 84 of file dlt-passive-node-ctrl.c.
References PassiveNodeOptions::command, and g_options.
Referenced by dlt_passive_node_analyze_response(), dlt_passive_node_prepare_message_body(), and main().
unsigned int get_connection_state | ( | void | ) |
Definition at line 94 of file dlt-passive-node-ctrl.c.
References PassiveNodeOptions::connection_state, and g_options.
Referenced by dlt_passive_node_prepare_message_body().
char* get_node_id | ( | ) |
Definition at line 126 of file dlt-passive-node-ctrl.c.
References g_options, and PassiveNodeOptions::node_id.
Referenced by dlt_passive_node_prepare_message_body().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Entry point.
Execute the argument parser and call the main feature accordingly
argc | amount of arguments |
argv | argument table |
Definition at line 426 of file dlt-passive-node-ctrl.c.
References PassiveNodeOptions::connection_state, DLT_CTRL_TIMEOUT, DLT_NODE_CONNECT_UNDEF, dlt_passive_node_ctrl_single_request(), DLT_SERVICE_ID_PASSIVE_NODE_CONNECT, g_options, get_command(), PassiveNodeOptions::node_id, NULL, parse_args(), pr_error, pr_verbose, set_ecuid(), set_timeout(), UNDEFINED, and usage().
|
static |
Parse application arguments.
The arguments are parsed and saved in static structure for future use.
argc | amount of arguments |
argv | argument table |
Definition at line 356 of file dlt-passive-node-ctrl.c.
References DLT_NODE_CONNECT, DLT_NODE_DISCONNECT, DLT_SERVICE_ID_PASSIVE_NODE_CONNECT, DLT_SERVICE_ID_PASSIVE_NODE_CONNECTION_STATUS, NULL, pr_error, pr_verbose, set_command(), set_connection_state(), set_node_id(), set_timeout(), set_verbosity(), and usage().
Referenced by main().
void set_command | ( | unsigned int | c | ) |
Definition at line 89 of file dlt-passive-node-ctrl.c.
References PassiveNodeOptions::command, and g_options.
Referenced by parse_args(), and set_connection_state().
void set_connection_state | ( | unsigned int | s | ) |
Definition at line 99 of file dlt-passive-node-ctrl.c.
References PassiveNodeOptions::connection_state, DLT_NODE_CONNECT, DLT_NODE_DISCONNECT, DLT_SERVICE_ID_PASSIVE_NODE_CONNECT, g_options, pr_error, and set_command().
Referenced by parse_args().
void set_node_id | ( | char * | id | ) |
Definition at line 113 of file dlt-passive-node-ctrl.c.
References DLT_ID_SIZE, g_options, PassiveNodeOptions::node_id, and pr_error.
Referenced by parse_args().
|
static |
Definition at line 331 of file dlt-passive-node-ctrl.c.
References DLT_CTRL_TIMEOUT, and get_verbosity().
Referenced by main(), and parse_args().
|
static |
Referenced by get_command(), get_connection_state(), get_node_id(), main(), set_command(), set_connection_state(), and set_node_id().