| Remote Access Control | |||||
Copyright (c) 2006, Atmel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. The name of ATMEL may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file createrxhex.cpp.
#include "hexfile.h"
#include <sstream>
#include <iomanip>
#include <string>
#include <stdexcept>
#include <vector>
#include <fstream>
Include dependency graph for createrxhex.cpp:

Go to the source code of this file.
Data Structures | |
| class | ParameterParser |
| Class to parse and store command line parameters for this application. More... | |
Functions | |
| void | CreateHEXFile (const ParameterParser &parser) |
| int | main (size_t argc, const char **argv) |
| void CreateHEXFile | ( | const ParameterParser & | parser | ) |
This function creates a HEX file from parameters stored in a parameter parser object.
Definition at line 211 of file createrxhex.cpp.
References ParameterParser::GetCounterSize(), ParameterParser::GetFilename(), ParameterParser::GetKeySize(), ParameterParser::GetMaxTransmitters(), ParameterParser::GetSerialNoSize(), and ParameterParser::GetSharedKey().
Referenced by main().
00212 { 00213 HEXFile hexData; 00214 std::ofstream outFile( parser.GetFilename().c_str() ); 00215 00216 // Prepare shared key bytes. 00217 HEXRecord sharedKey; 00218 sharedKey << parser.GetSharedKey(); 00219 00220 // Prepare transmitter count byte. 00221 HEXRecord transmitterCount; 00222 transmitterCount << ((byte) 0x00); 00223 00224 // Prepare empty transmitter table entry. 00225 HEXRecord transmitterTableEntry; 00226 const size_t entrySize = 00227 (parser.GetKeySize() / 8) + 00228 parser.GetSerialNoSize() + 00229 parser.GetCounterSize(); 00230 for( size_t idx = 0; idx < entrySize; ++idx ) { 00231 transmitterTableEntry << ((byte) 0xff); // Erased EEPROM cells. 00232 } 00233 00234 // Add records to HEX file. 00235 hexData << sharedKey << transmitterCount; 00236 for( size_t idx = 0; idx < parser.GetMaxTransmitters(); ++idx ) { 00237 hexData << transmitterTableEntry; 00238 } 00239 00240 // Write to disk. 00241 outFile << hexData; 00242 }
Here is the call graph for this function:

| int main | ( | size_t | argc, | |
| const char ** | argv | |||
| ) |
Definition at line 246 of file createrxhex.cpp.
References CreateHEXFile(), ParameterParser::GetCounterSize(), ParameterParser::GetFilename(), ParameterParser::GetKeySize(), ParameterParser::GetMaxTransmitters(), ParameterParser::GetSerialNoSize(), and ParameterParser::GetSharedKeyString().
00247 { 00248 try { 00249 ParameterParser parser( argc, argv ); 00250 std::cout << "Filename : " << parser.GetFilename() << std::endl 00251 << "Key size : " << parser.GetKeySize() << std::endl 00252 << "Serial no size : " << parser.GetSerialNoSize() << std::endl 00253 << "Counter size : " << parser.GetCounterSize() << std::endl 00254 << "Shared key : " << parser.GetSharedKeyString() << std::endl 00255 << "Max transmitters: " << parser.GetMaxTransmitters() << std::endl; 00256 00257 CreateHEXFile( parser ); 00258 std::cout << std::endl << parser.GetFilename() << " created!" << std::endl; 00259 00260 } catch( const std::exception & e ) { 00261 std::cout << "Error: " << e.what() << std::endl; 00262 } catch(...) { 00263 std::cout << "Unknown error" << std::endl; 00264 } 00265 }
Here is the call graph for this function:

Generated on Fri Aug 8 11:02:24 2008 for AVR411 Secure Rolling Code Algorithm (PC Tools - createrxhex) by 1.4.7
|