first use of libmbus
This commit is contained in:
		@@ -71,38 +71,29 @@ static void parseAndPrintFrame(t_longframe *frame) {
 | 
			
		||||
    reply.type = MBUS_FRAME_TYPE_LONG;
 | 
			
		||||
    reply.data_size = frame->length1 - 3;
 | 
			
		||||
 | 
			
		||||
    int r = mbus_frame_verify(&reply);
 | 
			
		||||
    logMsg("papf verify: %d", r);
 | 
			
		||||
 | 
			
		||||
    mbus_frame_data frame_data;
 | 
			
		||||
    memset(&frame_data, 0, sizeof(frame_data));
 | 
			
		||||
 | 
			
		||||
    r = mbus_frame_data_parse(&reply, &frame_data);
 | 
			
		||||
    logMsg("papf parse: %d, t:%d", r, frame_data.type);
 | 
			
		||||
 | 
			
		||||
    mbus_data_record *record;
 | 
			
		||||
    int i;
 | 
			
		||||
    for (record = frame_data.data_var.record, i = 0;
 | 
			
		||||
         record;
 | 
			
		||||
         record = record->next, i++) {
 | 
			
		||||
        logMsg("papf len: %d, dif: %02x, difel: %02x, vif: %02x, vifel: %02x", 
 | 
			
		||||
               record->data_len,
 | 
			
		||||
               record->drh.dib.dif,
 | 
			
		||||
               record->drh.dib.ndife,
 | 
			
		||||
               record->drh.vib.vif,
 | 
			
		||||
               record->drh.vib.nvife);
 | 
			
		||||
        logMsg("papf txt: F:%s U:%s V:%s", 
 | 
			
		||||
               mbus_data_record_function(record),
 | 
			
		||||
               mbus_data_record_unit(record),
 | 
			
		||||
               mbus_data_record_value(record));
 | 
			
		||||
    int r = mbus_frame_data_parse(&reply, &frame_data);
 | 
			
		||||
    if (r == 0) {
 | 
			
		||||
        mbus_data_record *record;
 | 
			
		||||
        int i;
 | 
			
		||||
        for (record = frame_data.data_var.record, i = 0;
 | 
			
		||||
             record;
 | 
			
		||||
             record = record->next, i++) {
 | 
			
		||||
            logMsg("papf txt: U:%s V:%s", 
 | 
			
		||||
                   mbus_data_record_unit(record),
 | 
			
		||||
                   mbus_data_record_value(record));
 | 
			
		||||
        }
 | 
			
		||||
        mbus_data_record_free(frame_data.data_var.record);
 | 
			
		||||
    } else {
 | 
			
		||||
        logMsg("papf err: unable to parse frame");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    mbus_data_record_free(frame_data.data_var.record);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void printFrame(t_longframe *frame) {
 | 
			
		||||
    parseAndPrintFrame(frame);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
    logMsg("frame: %02x %02x %02x %02x",
 | 
			
		||||
           frame->start1, frame->length1, frame->length2, frame->start2);
 | 
			
		||||
    logMsg("frame: C:%02x A:%02x CI:%02x",
 | 
			
		||||
@@ -110,6 +101,7 @@ static void printFrame(t_longframe *frame) {
 | 
			
		||||
    logMsg("frame: userdata ...");
 | 
			
		||||
    logMsg("frame: CHKSUM:%02x", frame->chksum);
 | 
			
		||||
    logMsg("frame: %02x", frame->stop);
 | 
			
		||||
    */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void handleRequestEngine(void *handle);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user