Ejemplo n.º 1
0
BOOL vmultib_update_keyboard(pvmultib_client vmultib, BYTE shiftKeyFlags, BYTE keyCodes[KBD_KEY_CODES])
{
    vmultibControlReportHeader* pReport = NULL;
    vmultibKeyboardReport* pKeyboardReport = NULL;

    if (CONTROL_REPORT_SIZE <= sizeof(vmultibControlReportHeader) + sizeof(vmultibKeyboardReport))
    {
        return FALSE;
    }

    //
    // Set the report header
    //

    pReport = (vmultibControlReportHeader*)vmultib->controlReport;
    pReport->ReportID = REPORTID_CONTROL;
    pReport->ReportLength = sizeof(vmultibKeyboardReport);

    //
    // Set the input report
    //

    pKeyboardReport = (vmultibKeyboardReport*)(vmultib->controlReport + sizeof(vmultibControlReportHeader));
    pKeyboardReport->ReportID = REPORTID_KEYBOARD;
    pKeyboardReport->ShiftKeyFlags = shiftKeyFlags;
    memcpy(pKeyboardReport->KeyCodes, keyCodes, KBD_KEY_CODES);

    // Send the report
    return HidOutput(FALSE, vmultib->hControl, (PCHAR)vmultib->controlReport, CONTROL_REPORT_SIZE);
}
Ejemplo n.º 2
0
BOOL vmultib_update_joystick(pvmultib_client vmultib, USHORT buttons, BYTE hat, BYTE x, BYTE y, BYTE rx, BYTE ry, BYTE throttle)
{
    vmultibControlReportHeader* pReport = NULL;
    vmultibJoystickReport* pJoystickReport = NULL;

    if (CONTROL_REPORT_SIZE <= sizeof(vmultibControlReportHeader) + sizeof(vmultibJoystickReport))
    {
        return FALSE;
    }

    //
    // Set the report header
    //

    pReport = (vmultibControlReportHeader*)vmultib->controlReport;
    pReport->ReportID = REPORTID_CONTROL;
    pReport->ReportLength = sizeof(vmultibJoystickReport);

    //
    // Set the input report
    //

    pJoystickReport = (vmultibJoystickReport*)(vmultib->controlReport + sizeof(vmultibControlReportHeader));
    pJoystickReport->ReportID = REPORTID_JOYSTICK;
    pJoystickReport->Buttons = buttons;
    pJoystickReport->Hat = hat;
    pJoystickReport->XValue = x;
    pJoystickReport->YValue = y;
    pJoystickReport->RXValue = rx;
    pJoystickReport->RYValue = ry;
    pJoystickReport->Throttle = throttle;

    // Send the report
    return HidOutput(FALSE, vmultib->hControl, (PCHAR)vmultib->controlReport, CONTROL_REPORT_SIZE);
}
Ejemplo n.º 3
0
BOOL vmultib_update_digi(pvmultib_client vmultib, BYTE status, USHORT x, USHORT y)
{
    vmultibControlReportHeader* pReport = NULL;
    vmultibDigiReport* pDigiReport = NULL;

    if (CONTROL_REPORT_SIZE <= sizeof(vmultibControlReportHeader) + sizeof(vmultibDigiReport))
    {
        return FALSE;
    }

    //
    // Set the report header
    //

    pReport = (vmultibControlReportHeader*)vmultib->controlReport;
    pReport->ReportID = REPORTID_CONTROL;
    pReport->ReportLength = sizeof(vmultibDigiReport);

    //
    // Set the input report
    //

    pDigiReport = (vmultibDigiReport*)(vmultib->controlReport + sizeof(vmultibControlReportHeader));
    pDigiReport->ReportID = REPORTID_DIGI;
    pDigiReport->Status = status;
    pDigiReport->XValue = x;
    pDigiReport->YValue = y;

    // Send the report
    return HidOutput(FALSE, vmultib->hControl, (PCHAR)vmultib->controlReport, CONTROL_REPORT_SIZE);
}
Ejemplo n.º 4
0
BOOL vmultib_update_relative_mouse(pvmultib_client vmultib, BYTE button,
BYTE x, BYTE y, BYTE wheelPosition)
{
    vmultibControlReportHeader* pReport = NULL;
    vmultibRelativeMouseReport* pMouseReport = NULL;

    if (CONTROL_REPORT_SIZE <= sizeof(vmultibControlReportHeader) + sizeof(vmultibRelativeMouseReport))
    {
        return FALSE;
    }

    //
    // Set the report header
    //

    pReport = (vmultibControlReportHeader*)vmultib->controlReport;
    pReport->ReportID = REPORTID_CONTROL;
    pReport->ReportLength = sizeof(vmultibRelativeMouseReport);

    //
    // Set the input report
    //

    pMouseReport = (vmultibRelativeMouseReport*)(vmultib->controlReport + sizeof(vmultibControlReportHeader));
    pMouseReport->ReportID = REPORTID_RELATIVE_MOUSE;
    pMouseReport->Button = button;
    pMouseReport->XValue = x;
    pMouseReport->YValue = y;
    pMouseReport->WheelPosition = wheelPosition;

    // Send the report
    return HidOutput(FALSE, vmultib->hControl, (PCHAR)vmultib->controlReport, CONTROL_REPORT_SIZE);
}
Ejemplo n.º 5
0
BOOL vmulti_update_mouse(pvmulti_client vmulti, BYTE button, USHORT x, USHORT y, BYTE wheelPosition)
{
    VMultiControlReportHeader* pReport = NULL;
    VMultiMouseReport* pMouseReport = NULL;

    if (CONTROL_REPORT_SIZE <= sizeof(VMultiControlReportHeader) + sizeof(VMultiMouseReport))
    {
        return FALSE;
    }

    //
    // Set the report header
    //

    pReport = (VMultiControlReportHeader*)vmulti->controlReport;
    pReport->ReportID = REPORTID_CONTROL;
    pReport->ReportLength = sizeof(VMultiMouseReport);

    //
    // Set the input report
    //

    pMouseReport = (VMultiMouseReport*)(vmulti->controlReport + sizeof(VMultiControlReportHeader));
    pMouseReport->ReportID = REPORTID_MOUSE;
    pMouseReport->Button = button;
    pMouseReport->XValue = x;
    pMouseReport->YValue = y;
    pMouseReport->WheelPosition = wheelPosition;

    // Send the report
    return HidOutput(FALSE, vmulti->hControl, (PCHAR)vmulti->controlReport, CONTROL_REPORT_SIZE);
}
Ejemplo n.º 6
0
BOOL vmultib_update_multitouch(pvmultib_client vmultib, PTOUCH pTouch, BYTE actualCount)
{
    vmultibControlReportHeader* pReport = NULL;
    vmultibMultiTouchReport* pMultiReport = NULL;
    int numberOfTouchesSent = 0;

    if (CONTROL_REPORT_SIZE <= sizeof(vmultibControlReportHeader) + sizeof(vmultibMultiTouchReport))
        return FALSE;

    //
    // Set the report header
    //

    pReport = (vmultibControlReportHeader*)vmultib->controlReport;
    pReport->ReportID = REPORTID_CONTROL;
    pReport->ReportLength = sizeof(vmultibMultiTouchReport);

    while (numberOfTouchesSent < actualCount)
    {

        //
        // Set the input report
        //

        pMultiReport = (vmultibMultiTouchReport*)(vmultib->controlReport + sizeof(vmultibControlReportHeader));
        pMultiReport->ReportID = REPORTID_MTOUCH;
        memcpy(pMultiReport->Touch, pTouch + numberOfTouchesSent, sizeof(TOUCH));
        if (numberOfTouchesSent <= actualCount - 2)
            memcpy(pMultiReport->Touch + 1, pTouch + numberOfTouchesSent + 1, sizeof(TOUCH));
        else
            memset(pMultiReport->Touch + 1, 0, sizeof(TOUCH));
        if (numberOfTouchesSent == 0)
            pMultiReport->ActualCount = actualCount;
        else
            pMultiReport->ActualCount = 0;

        // Send the report
        if (!HidOutput(TRUE, vmultib->hControl, (PCHAR)vmultib->controlReport, CONTROL_REPORT_SIZE))
            return FALSE;

        numberOfTouchesSent += 2;
    }

    return TRUE;
}