//This function is called when a new capture is started
//"block" holds an object representing the current script block on the flowchart
//Type "block." for a list of available functions for use in the script
void OnStartCapture(ScriptBlock block)
{
    block.ClearOutputText(); //Clear this script's output window
    block.PrintOutputText("Binary file write started\n", false, false, false, false); //Print to the output window
 
    //Open the firmware image file
    int ret = handle.open(FIRMWARE_FILE_NAME, "rb");
    if (ret != 0) {
        block.PrintOutputText("Failed to open firmware image: \"" + FIRMWARE_FILE_NAME + "\"\n", true, false, false, true);
        bFileOpen = false;  //mark file as not open
    } else {
        block.PrintOutputText("Sending contents of \"" + FIRMWARE_FILE_NAME + "\" onto the CAN bus\n", false, false, false, true);       
        bFileOpen = true; //mark file as open
    }
}
Example #2
0
 random_generator ()
 { file_.open ("/dev/urandom", std::ios_base::binary | std::ios_base::in); }