00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "C_GetExternalDataAction.hpp"
00021 #include "GeneratorTrace.hpp"
00022 #include "GeneratorError.h"
00023
00024
00025 C_GetExternalDataAction::C_GetExternalDataAction(T_CmdAction P_cmdAction,
00026 T_pControllers P_controllers)
00027 : C_CommandAction (P_cmdAction, P_controllers) {
00028 }
00029
00030 C_GetExternalDataAction::~C_GetExternalDataAction() {
00031 }
00032
00033
00034 T_exeCode C_GetExternalDataAction::execute(T_pCmd_scenario P_pCmd,
00035 T_pCallContext P_callCtxt,
00036 C_MessageFrame *P_msg,
00037 C_MessageFrame *P_ref) {
00038
00039 T_exeCode L_exeCode = E_EXE_NOERROR ;
00040 T_pValueData L_value ;
00041 int L_size ;
00042
00043 L_value = m_controllers.m_external_data->get_value(P_callCtxt->m_selected_line,
00044 m_field_data_num);
00045
00046 if (L_value != NULL) {
00047 L_size = m_size ;
00048
00049 if (L_size != -1) {
00050
00051 T_ValueData L_val ;
00052 L_val.m_type = E_TYPE_NUMBER ;
00053
00054 if (L_size > (int)L_value->m_value.m_val_binary.m_size) {
00055 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00056 action_name_table[m_type]
00057 << ": the size desired ["
00058 << L_size << "] exceed the length of buffer ["
00059 << L_value->m_value.m_val_binary.m_size << "]");
00060 L_size = L_value->m_value.m_val_binary.m_size ;
00061 }
00062
00063 if (P_msg -> get_field_value(m_id,
00064 m_instance_id,
00065 m_sub_id,
00066 &L_val) == true) {
00067
00068 copyBinaryVal(L_val, m_begin, L_size,
00069 *L_value);
00070
00071 if (P_msg -> set_field_value(&L_val,
00072 m_id,
00073 m_instance_id,
00074 m_sub_id) == false ) {
00075
00076 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00077 action_name_table[m_type]
00078 << ": problem when set field value");
00079
00080 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00081 "error on call with session-id ["
00082 << P_callCtxt->m_id_table[P_pCmd->m_channel_id] << "]");
00083
00084 L_exeCode = E_EXE_ERROR;
00085 }
00086 resetMemory(L_val);
00087
00088 } else {
00089 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00090 action_name_table[m_type]
00091 << ": the value of the field asked is incorrect or not found");
00092
00093 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00094 "error on call with session-id ["
00095 << P_callCtxt->m_id_table[P_pCmd->m_channel_id] << "]");
00096 L_exeCode = E_EXE_ERROR;
00097 }
00098 } else {
00099 if (P_msg -> set_field_value(L_value,
00100 m_id,
00101 m_instance_id,
00102 m_sub_id) == false) {
00103
00104 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00105 action_name_table[m_type]
00106 << ": problem when set field value");
00107
00108 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00109 "error on call with session-id ["
00110 << P_callCtxt->m_id_table[P_pCmd->m_channel_id] << "]");
00111
00112 L_exeCode = E_EXE_ERROR;
00113 }
00114 }
00115 } else {
00116 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00117 action_name_table[m_type]
00118 << ": the value of the field asked is incorrect or not found");
00119
00120 GEN_LOG_EVENT(LOG_LEVEL_TRAFFIC_ERR,
00121 "error on call with session-id ["
00122 << P_callCtxt->m_id_table[P_pCmd->m_channel_id] << "]");
00123 L_exeCode = E_EXE_ERROR;
00124 }
00125
00126 return (L_exeCode);
00127 }
00128
00129
00130
00131
00132