Hi, i'm trying to make dlms server. i have a piece of code below for adding Instanttaneous Profile Generic:
void addCaptureObject(gxProfileGeneric *pg, gxObject *obj, unsigned char attrIndex)
{
gxTarget *capture;
capture = (gxTarget *)malloc(sizeof(gxTarget));
capture->attributeIndex = attrIndex;
capture->dataIndex = 0;
arr_push(&pg->captureObjects, key_init(obj, capture));
}
///////////////////////////////////////////////////////////////////////
// Add profile generic - instant profile object.
///////////////////////////////////////////////////////////////////////
int addInstantProfileProfileGeneric(dlmsSettings *settings)
{
int ret;
const unsigned char ln[6] = {1, 96, 98, 128, 0, 255};
if ((ret = INIT_OBJECT(instantProfile, DLMS_OBJECT_TYPE_PROFILE_GENERIC, ln)) == 0)
{
instantProfile.sortMethod = DLMS_SORT_METHOD_FIFO;
gxTarget *capture;
addCaptureObject(&instantProfile, BASE(clock1), 2);
addCaptureObject(&instantProfile, BASE(ecuId), 2);
addCaptureObject(&instantProfile, BASE(reg_volt_R_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_volt_S_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_volt_T_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_curr_R_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_curr_S_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_curr_T_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_curr_N_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_pf_R_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_pf_S_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_pf_T_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_pf_all_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_ang_uu_RR_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_ang_uu_SR_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_ang_uu_TR_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_ang_iu_RR_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_ang_iu_SS_LN), 2);
addCaptureObject(&instantProfile, BASE(reg_ang_iu_TT_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_ang_iu_NR_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_act_power_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_act_power_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_act_power_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_act_power_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_act_power_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_act_power_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_act_power_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_act_power_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_react_power_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_react_power_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_react_power_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_react_power_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_react_power_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_react_power_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_react_power_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_react_power_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_app_power_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_app_power_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_app_power_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_app_power_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_app_power_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_app_power_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_app_power_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_app_power_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_act_energy_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_act_energy_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_act_energy_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_act_energy_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_act_energy_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_act_energy_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_act_energy_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_act_energy_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_react_energy_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_react_energy_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_react_energy_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_exp_react_energy_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_react_energy_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_react_energy_S_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_react_energy_T_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_imp_react_energy_all_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_freq_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_curr_thd_R_LN), 2);
// addCaptureObject(&instantProfile, BASE(reg_curr_tdd_R_LN), 2);
printf("instant profile object count : %u\n", (unsigned int)instantProfile.captureObjects.size);
instantProfile.sortObject = BASE(clock1);
instantProfile.sortObjectAttributeIndex = 2;
setProfileGenericEntries(&instantProfile, INSTANT_PROFILE_MAX_ENTRIES);
instantProfile.capturePeriod = 0;
}
return 0;
}I use GuruxDLMSServerExample as base, then extending it to my needs. as you can see there are many objects that are commented for this profile. if i uncomment it, the capture object failed to load and show nothing when i refresh the profile. how to work around this?
And also, how to set maximum entries allowed for some profile? some profile need to contains thousands of data, e.g Load Profile, while some profiles like alarm and event only need to store max 100 entries.
Thank you
jack