tool/CommandPhyWrite.cpp
author Florian Pose <fp@igh-essen.com>
Tue, 07 Apr 2009 09:00:20 +0000
changeset 1379 cbceb0e2f2a0
parent 1363 11c0b2caa253
child 1383 0c88c50c31e3
permissions -rw-r--r--
Reading more base information (incl. whether DC supported).
1200
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/*****************************************************************************
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
     3
 *  $Id$
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
     4
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
     5
 *  Copyright (C) 2006-2009  Florian Pose, Ingenieurgemeinschaft IgH
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
     6
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
     8
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    11
 *  published by the Free Software Foundation.
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    12
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    16
 *  Public License for more details.
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    17
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    21
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    22
 *  ---
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    23
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1254
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
1200
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 ****************************************************************************/
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
#include <iostream>
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
#include <iomanip>
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
#include <fstream>
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
using namespace std;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
#include "CommandPhyWrite.h"
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
#include "sii_crc.h"
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
/*****************************************************************************/
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
CommandPhyWrite::CommandPhyWrite():
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
    Command("phy_write", "Write data to a slave's physical memory.")
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
{
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
}
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
/*****************************************************************************/
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
string CommandPhyWrite::helpString() const
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
{
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
    stringstream str;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
    str << getName() << " [OPTIONS] <OFFSET> <FILENAME>" << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
        << endl 
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
        << getBriefDescription() << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
        << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
        << "This command requires a single slave to be selected." << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
    	<< endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
        << "Arguments:" << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
        << "  OFFSET   must be the physical memory offset to start." << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
        << "  FILENAME must be a path to a file with data to write." << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
        << "           If it is '-', data are read from stdin." << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
        << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
        << "Command-specific options:" << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
        << "  --alias    -a <alias>" << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
        << "  --position -p <pos>    Slave selection. See the help of" << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
        << "                         the 'slaves' command." << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
        << endl
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
        << numericInfo();
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
    return str.str();
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
}
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
/****************************************************************************/
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
void CommandPhyWrite::execute(MasterDevice &m, const StringVector &args)
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
{
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
    stringstream strOffset, err;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
    ec_ioctl_slave_phy_t data;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
    ifstream file;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
    SlaveList slaves;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
    if (args.size() != 2) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    82
        err << "'" << getName() << "' takes exactly one argument!";
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
        throwInvalidUsageException(err);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
    
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
    strOffset << args[0];
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    87
    strOffset
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
        >> resetiosflags(ios::basefield) // guess base from prefix
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    89
        >> data.offset;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
    if (strOffset.fail()) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
        err << "Invalid offset '" << args[0] << "'!";
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
        throwInvalidUsageException(err);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
    if (args[1] == "-") {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
        loadPhyData(&data, cin);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
    } else {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    98
        file.open(args[1].c_str(), ifstream::in | ifstream::binary);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
        if (file.fail()) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   100
            err << "Failed to open '" << args[0] << "'!";
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
            throwCommandException(err);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   102
        }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   103
        loadPhyData(&data, file);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   104
        file.close();
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   105
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   107
    if ((uint32_t) data.offset + data.length > 0xffff) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
        err << "Offset and length exceeding 64k!";
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   109
        delete [] data.data;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   110
        throwInvalidUsageException(err);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   111
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   112
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   113
    try {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   114
        m.open(MasterDevice::ReadWrite);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   115
    } catch (MasterDeviceException &e) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   116
        delete [] data.data;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   117
        throw e;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   118
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   119
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   120
    slaves = selectedSlaves(m);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   121
    if (slaves.size() != 1) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   122
        delete [] data.data;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   123
        throwSingleSlaveRequired(slaves.size());
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   124
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   125
    data.slave_position = slaves.front().position;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   126
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   127
    // send data to master
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   128
    try {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   129
        m.writePhy(&data);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   130
    } catch (MasterDeviceException &e) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   131
        delete [] data.data;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   132
        throw e;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   133
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
    if (getVerbosity() == Verbose) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
        cerr << "Physical memory writing finished." << endl;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   137
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   139
    delete [] data.data;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   140
}
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   142
/*****************************************************************************/
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   143
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
void CommandPhyWrite::loadPhyData(
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
        ec_ioctl_slave_phy_t *data,
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   146
        const istream &in
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   147
        )
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
{
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
    stringstream err;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   150
    ostringstream tmp;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   151
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   152
    tmp << in.rdbuf();
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   153
    string const &contents = tmp.str();
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   154
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
    if (getVerbosity() == Verbose) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
        cerr << "Read " << contents.size() << " bytes of data." << endl;
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   157
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   158
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   159
    if (contents.size() > 0xffff) {
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
        err << "Invalid data size " << contents.size() << "!";
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
        throwInvalidUsageException(err);
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
    }
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   163
    data->length = contents.size();
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   165
    // allocate buffer and read file into buffer
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
    data->data = new uint8_t[data->length];
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
    contents.copy((char *) data->data, contents.size());
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
}
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   169
ce1a65f06efc Added phy commands.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
/*****************************************************************************/