/* * Copyright (C) 2013 Tobias Lorenz. * Contact: tobias.lorenz@gmx.net * * This file is part of Tobias Lorenz's Toolkit. * * Commercial License Usage * Licensees holding valid commercial licenses may use this file in * accordance with the commercial license agreement provided with the * Software or, alternatively, in accordance with the terms contained in * a written agreement between you and Tobias Lorenz. * * GNU General Public License 3.0 Usage * Alternatively, this file may be used under the terms of the GNU * General Public License version 3.0 as published by the Free Software * Foundation and appearing in the file LICENSE.GPL included in the * packaging of this file. Please review the following information to * ensure the GNU General Public License version 3.0 requirements will be * met: http://www.gnu.org/copyleft/gpl.html. */ #include #include #include #include #include #include #include #include int n; static void u64_to_can_msg(const uint64_t u, std::array &m) { m[7] = u >> 56; m[6] = u >> 48; m[5] = u >> 40; m[4] = u >> 32; m[3] = u >> 24; m[2] = u >> 16; m[1] = u >> 8; m[0] = u >> 0; } int main(int argc, char * argv[]) { if (argc != 2) { std::cout << argv[0] << " " << std::endl; return -1; } /* open file for writing */ Vector::BLF::File file; file.open(argv[1], std::ios_base::out); if (!file.is_open()) { std::cout << "Unable to open file" << std::endl; return -1; } Vector::BLF::FileStatistics * obj = &file.fileStatistics; obj->measurementStartTime.year = 2020; obj->measurementStartTime.month = 8; obj->measurementStartTime.day = 29; obj->measurementStartTime.dayOfWeek = 5; obj->measurementStartTime.hour = 10; obj->measurementStartTime.minute = 30; obj->measurementStartTime.second = 2; obj->measurementStartTime.milliseconds = 1; for(n = 0; n<5000000; n++) { Vector::BLF::CanMessage * canMessage = new Vector::BLF::CanMessage; canMessage->channel = 1; canMessage->flags = 1; // TX canMessage->dlc = 8; canMessage->id = 0x33; uint64_t nummer = static_cast (n); u64_to_can_msg(nummer, canMessage->data); //canMessage->data[0] = 0x44; //canMessage->data[1] = 0x55; //canMessage->data[2] = 0x66; //canMessage->data[3] = 0x77; //canMessage->data[4] = 0x88; //canMessage->data[5] = 0x99; //canMessage->data[6] = 0xAA; //canMessage->data[7] = 0xBB; canMessage->objectTimeStamp = (nummer * 1000); file.write(canMessage); } /* close file */ file.close(); return 0; }