示例#1
0
SingularityBuilder::SingularityBuilder(int left, int right, int top, int bottom, LayoutManager* layoutManagerPtr)
{
  //streaming clustering. still reliant on a tick input, but should be near realtime
  SetEventParameters(14,16,4);
  
  //inData.reserve(1000);   //32k
  //outData.reserve(64);

  layoutManager = layoutManagerPtr;

  //these must be determined by some outer class with UI-access
  activeRegion_Left = left;
  activeRegion_Right = right;
  activeRegion_Top = top;
  activeRegion_Bottom = bottom;
}
示例#2
0
SingularityBuilder::SingularityBuilder()
{
  //streaming clustering. still reliant on a tick input, but should be near realtime
  SetEventParameters(14,16,4);

  //inData.reserve(1000);   //32k
  //outData.reserve(64);

  cout << "ERROR SingularityBuilder default ctor called, with no layout params. Expect failure" << endl;

  //these must be determined by some outer class with UI-access
  activeRegion_Left = 0;
  activeRegion_Right = 1670;
  activeRegion_Top = 0;
  activeRegion_Bottom = 460;
}
示例#3
0
HRESULT FakeContactsService::GetEventAttributes(
    REFGUID                Event,
    __out   IPortableDeviceValues* pAttributes)
{
    HRESULT hr = S_OK;
    CComPtr<IPortableDeviceValues> pEventOptions;
    CComPtr<IPortableDeviceKeyCollection> pEventParameters;

    if (pAttributes == NULL)
    {
        hr = E_POINTER;
        CHECK_HR(hr, "Cannot have NULL parameter");
        return hr;
    }

    // CoCreate a collection to store the event options.
    hr = CoCreateInstance(CLSID_PortableDeviceValues,
                          NULL,
                          CLSCTX_INPROC_SERVER,
                          IID_IPortableDeviceValues,
                          (VOID**) &pEventOptions);
    CHECK_HR(hr, "Failed to CoCreate CLSID_PortableDeviceValues");
    if (hr == S_OK)
    {
        hr = pEventOptions->SetBoolValue(WPD_EVENT_OPTION_IS_BROADCAST_EVENT, TRUE);
        CHECK_HR(hr, "Failed to set WPD_EVENT_OPTION_IS_BROADCAST_EVENT");
    }

    // Loop through the supported events for this service to find a match
    hr = HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
    for (DWORD i=0; i<ARRAYSIZE(g_SupportedServiceEvents); i++)
    {
        if (Event == *g_SupportedServiceEvents[i])
        {
            // Set the event options.
            hr = pAttributes->SetIPortableDeviceValuesValue(WPD_EVENT_ATTRIBUTE_OPTIONS, pEventOptions);
            CHECK_HR(hr, "Failed to set WPD_EVENT_ATTRIBUTE_OPTIONS");

            // Set the event parameters.
            if (hr == S_OK)
            {
                hr = CoCreateInstance(CLSID_PortableDeviceKeyCollection,
                                      NULL,
                                      CLSCTX_INPROC_SERVER,
                                      IID_IPortableDeviceKeyCollection,
                                      (VOID**) &pEventParameters);
                CHECK_HR(hr, "Failed to CoCreate CLSID_PortableDeviceValues");
            }

            if (hr == S_OK)
            {
                hr = SetEventParameters(Event, &g_ServiceEventParameters[0], ARRAYSIZE(g_ServiceEventParameters), pEventParameters);
                CHECK_HR(hr, "Failed to set event parameters");

                if (hr == S_OK)
                {
                    hr = pAttributes->SetIPortableDeviceKeyCollectionValue(WPD_EVENT_ATTRIBUTE_PARAMETERS, pEventParameters);
                    CHECK_HR(hr, "Failed to set WPD_METHOD_ATTRIBUTE_PARAMETERS");
                }
            }

            // Set a name for the custom event
            if (hr == S_OK)
            {
                if (Event == MyCustomEvent)
                {
                    hr = pAttributes->SetStringValue(WPD_EVENT_ATTRIBUTE_NAME , L"MyCustomEvent");
                    CHECK_HR(hr, "Failed to set WPD_EVENT_ATTRIBUTE_NAME");
                }
            }
            break;
        }
    }

    return hr;
}