| 13 | #include <Vector/BLF.h> |
| 14 | |
| 15 | int main(int argc, char * argv[]) { |
| 16 | if (argc != 2) { |
| 17 | std::cout << "Write-Example <filename.blf>" << std::endl; |
| 18 | return -1; |
| 19 | } |
| 20 | |
| 21 | /* open file for writing */ |
| 22 | Vector::BLF::File file; |
| 23 | file.open(argv[1], std::ios_base::out); |
| 24 | if (!file.is_open()) { |
| 25 | std::cout << "Unable to open file" << std::endl; |
| 26 | return -1; |
| 27 | } |
| 28 | |
| 29 | /* write a CanMessage */ |
| 30 | auto * canMessage = new Vector::BLF::CanMessage; |
| 31 | canMessage->channel = 1; |
| 32 | canMessage->flags = 1; // TX |
| 33 | canMessage->dlc = 2; |
| 34 | canMessage->id = 0x33; |
| 35 | canMessage->data[0] = 0x44; |
| 36 | canMessage->data[1] = 0x55; |
| 37 | file.write(canMessage); |
| 38 | |
| 39 | /* close file */ |
| 40 | file.close(); |
| 41 | |
| 42 | return 0; |
| 43 | } |