Esempio n. 1
0
static DevicesPtr get_devices() {
    int size;
    auto ptr = ibv_get_device_list(&size);
    if(!ptr) {
        throw std::runtime_error("cannot get devices");
    }
    return DevicesPtr(ptr, ibv_free_device_list);
}
Esempio n. 2
0
// Commands send from PC to computer
#define ACKNOWLEDGE 0x0A // Acknowledge received data
#define NUMBER_OF_TRAINING_REQUESTS 0x06 // Request the number of trainings
#define TRAINING_DETAIL_REQUEST 0x09 // Request details of a training
#define ERASE_ALL_RECORDS 0x0B // Erase all records on computer

// Commands send from computer to PC
#define NUMBER_OF_TRAININGS 0x86 // Packet with the trainings count
#define TRAINING_DETAIL 0x89 // Packet with details about a specific training
#define ERASE_DONE 0x8B //  Packet which acknowledges that all data is erased in computer

#define LAST_PAGE 0xFA0A // LastPage number

static bool macroRegistered =
    Devices::addType("O-Synce Macro PC-Link", DevicesPtr(new MacroDevices()) );

QString
MacroDevices::downloadInstructions() const
{
    return (tr("Make sure the Macro unit is turned\n"
            "on and that its display says, \"PC Link\""));
}

DevicePtr
MacroDevices::newDevice( CommPortPtr dev )
{
    return DevicePtr( new MacroDevice( dev ));
}

static QString
Esempio n. 3
0
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "SrmDevice.h"
#include "SrmRideFile.h"
#include <srmio.h>
#include <QMessageBox>
#include <errno.h>

static bool srm5Registered =
    Devices::addType("SRM PCV", DevicesPtr(new SrmDevices( 5 )) );
static bool srm7Registered =
    Devices::addType("SRM PCVI/7", DevicesPtr(new SrmDevices( 7 )));

DevicePtr
SrmDevices::newDevice( CommPortPtr dev )
{
    return DevicePtr( new SrmDevice( dev, protoVersion));
}

bool
SrmDevices::supportsPort( CommPortPtr dev )
{
#if defined(SRMIO_HAVE_TERMIOS) || defined(SRMIO_HAVE_WINCOM)
    // we could check device name starts with "com" or "/dev"
    // but we wouldn't have got here unless it was a supported
Esempio n. 4
0
// Start pattern
#define START_1            0x10
#define START_2            0x02

// Commands send from PC to Joule
#define READ_UNIT_VERSION  0x2000
#define GET_FREE_SPACE     0x2002
#define READ_SYSTEM_INFO   0x2003
#define READ_RIDE_SUMMARY  0x2020
#define READ_RIDE_DETAIL   0x2021
#define PAGE_RIDE_DETAIL   0x2022
#define ERASE_RIDE_DETAIL  0x2024

static bool jouleRegistered =
    Devices::addType("Joule 1.0, GPS or GPS+", DevicesPtr(new JouleDevices()) );

QString
JouleDevices::downloadInstructions() const
{
    return (tr("Make sure the Joule (1.0, GPS or GPS+) unit is turned ON"));
}

DevicePtr
JouleDevices::newDevice( CommPortPtr dev )
{
    return DevicePtr( new JouleDevice( dev ));
}

static QString
cEscape(char *buf, int len)
Esempio n. 5
0
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "PowerTapDevice.h"
#include "PowerTapUtil.h"
#include <cmath>
#include "assert.h"

#define PT_DEBUG false

static bool powerTapRegistered =
    Devices::addType("PowerTap", DevicesPtr(new PowerTapDevices()) );

DevicePtr
PowerTapDevices::newDevice( CommPortPtr dev )
{
    return DevicePtr( new PowerTapDevice( dev ));
}

QString
PowerTapDevices::downloadInstructions() const
{
    return (tr("Make sure the PowerTap unit is turned\n"
            "on and that its display says, \"Host\""));
}

static bool