int parse_can_frame(int can_identifier, array can_data){ shifted_id = can_identifier >> 8; pgn = shifted_id & pgn_mask; // FMS Standard 3.0: // PGN 0x00FEF1 --> Cruise Control / Vehicle Speed: CCVS if(pgn == 0x00FEF1){ /* Get Wheel based speed (DATA BYTES 2 &3) from Cruise Control/Vehicle Speed: CCVS SPN: 84 */ speed = ((can_data[2] << 8) + can_data[1])/256; /* Log the parsed message */ now = localtime(time()); timestamp = strftime("%Y-%m-%d %H:%M:%S", now); fwrite(fp, sprintf("%s -- Wheel based speed: %f\n",timestamp, speed)); return 0; } else{ return -1; } }