CBTAccessRequester::CBTAccessRequester(CPhysicalLink& aConnection,
									   const TBTServiceSecurity& aServiceSecurity,
									   const TBTServiceSecurityPerDevice* const aOverride,
									   MAccessRequestResponseHandler& aRequester,
									   TAccessType aAccessType,
									   TBool aNoSecurityRequired,
									   CBTSecMan& aParent)
	: iRequester(aRequester)
	, iSecMan(aParent)
	, iBaseband(&aConnection)
	, iDevAddr(aConnection.BDAddr())
	, iServiceRequirements(aServiceSecurity)
	, iOverride(aOverride)
	, iIsSubscribedToConnection(EFalse)
	, iDeviceRetrievedFromRegistry(EFalse)
	, iQueLink(this)
	, iPrefetchQueueLink(this)
	, iAuthenticationInProgress(EFalse)
	, iAccessType(aAccessType)
	, iRemoteIndicatedNoBonding(EFalse)
	, iCurrentState(EBTUninitialised)
	, iNoSecurityRequired(aNoSecurityRequired)
	{
	LOG_FUNC
	// try to get name for UI dialogs
	SetDeviceName();
	}
示例#2
0
// Build the menu items for this class
void CMenuJoystickAxisBase::Build(CClientDE *pClientDE, CMenuBase *pDestMenu)
{		
	if (!pDestMenu)
	{
		return;
	}

	// Get the main menus pointer
	CMainMenus *pMainMenus=pDestMenu->GetMainMenus();
	if (!pMainMenus)
	{
		return;
	}

	// figure out the name of the joystick device
	SetDeviceName(pClientDE);

	// create the array of possible axis
	CreateAxisArray(pClientDE);

	// just a test BLB TEMP!!!
//	FindMouseControls(pClientDE);

	// The axis option
	m_pAxisCtrl=BuildAxisOption(pClientDE, pDestMenu, m_nAxisID, &m_nAxis);

	// The invert axis control
	m_pInvertAxisCtrl=pDestMenu->AddOnOffOption(m_nInvertAxisID, pMainMenus->GetSmallFont(), MENUJOYSTICK_ONOFFOFFSET,
												&m_bInvertAxis);

	// The dead zone control
	m_pDeadZoneCtrl=pDestMenu->AddSliderOption(m_nDeadZoneID, pMainMenus->GetSmallFont(), MENUJOYSTICK_SLIDEROFFSET,
											   pMainMenus->GetSurfaceSliderBar(), pMainMenus->GetSurfaceSliderTab(),
											   &m_nDeadZone);
	if (m_pDeadZoneCtrl)
	{
		m_pDeadZoneCtrl->SetSliderRange(DEADZONESLIDERLOW, DEADZONESLIDERHIGH);
		m_pDeadZoneCtrl->SetSliderIncrement(1);
	}

	// Analog on/off
	m_pAnalogCtrl=pDestMenu->AddOnOffOption(m_nAnalogID, pMainMenus->GetSmallFont(), MENUJOYSTICK_ONOFFOFFSET, &m_bAnalog);

	// The sensitivity control
	m_pSensitivityCtrl=pDestMenu->AddSliderOption(m_nSensitivityID, pMainMenus->GetSmallFont(), MENUJOYSTICK_SLIDEROFFSET,
												  pMainMenus->GetSurfaceSliderBar(), pMainMenus->GetSurfaceSliderTab(),
												  &m_nSensitivity);
	if (m_pSensitivityCtrl)
	{
		m_pSensitivityCtrl->SetSliderRange(SENSITIVITYSLIDERLOW, SENSITIVITYSLIDERHIGH);
		m_pSensitivityCtrl->SetSliderIncrement(1);
	}
	

	// The center offset axis control
	m_pCenterOffsetCtrl=pDestMenu->AddOnOffOption(m_nCenterOffsetID, pMainMenus->GetSmallFont(), MENUJOYSTICK_ONOFFOFFSET,
												  &m_bCenterOffset);	
}
// Build the  items for this class
void CJoystickAxisBase::Build(ILTClient *pClientDE, CBaseFolder *pDestFolder)
{
	if (!pDestFolder)
	{
		return;
	}

	if (g_pLayoutMgr->HasCustomValue(FOLDER_ID_JOYSTICK,"ColumnWidth"))
		kGap = g_pLayoutMgr->GetFolderCustomInt(FOLDER_ID_JOYSTICK,"ColumnWidth");
	if (g_pLayoutMgr->HasCustomValue(FOLDER_ID_JOYSTICK,"SliderWidth"))
		kWidth = g_pLayoutMgr->GetFolderCustomInt(FOLDER_ID_JOYSTICK,"SliderWidth");

	// figure out the name of the joystick device
	SetDeviceName(pClientDE);

	// create the array of possible axis
	CreateAxisArray(pClientDE);

	// The axis option
	m_pAxisCtrl=BuildAxisOption(pClientDE, pDestFolder, m_nAxisID, &m_nAxis);

	// The invert axis control
	m_pInvertAxisCtrl=pDestFolder->AddToggle(m_nInvertAxisID, IDS_HELP_INVERTAXIS,  kGap,
												&m_bInvertAxis, LTFALSE, g_pInterfaceResMgr->GetSmallFont());

	m_pInvertAxisCtrl->SetOnString(IDS_ON);
	m_pInvertAxisCtrl->SetOffString(IDS_OFF);

	// The dead zone control
	m_pDeadZoneCtrl=pDestFolder->AddSlider(m_nDeadZoneID, IDS_HELP_DEADZONE, kGap, kWidth,
											   &m_nDeadZone, LTFALSE, g_pInterfaceResMgr->GetSmallFont());
	if (m_pDeadZoneCtrl)
	{
		m_pDeadZoneCtrl->SetSliderRange(DEADZONESLIDERLOW, DEADZONESLIDERHIGH);
		m_pDeadZoneCtrl->SetSliderIncrement(1);
	}

	// Analog on/off
	m_pAnalogCtrl=pDestFolder->AddToggle(m_nAnalogID, IDS_HELP_ANALOG, kGap, &m_bAnalog, LTFALSE,  g_pInterfaceResMgr->GetSmallFont());
	m_pAnalogCtrl->SetOnString(IDS_ON);
	m_pAnalogCtrl->SetOffString(IDS_OFF);

	// The sensitivity control
	m_pSensitivityCtrl=pDestFolder->AddSlider(m_nSensitivityID, IDS_HELP_JOY_SENSE, kGap, kWidth,
												  &m_nSensitivity, LTFALSE,  g_pInterfaceResMgr->GetSmallFont());
	if (m_pSensitivityCtrl)
	{
		m_pSensitivityCtrl->SetSliderRange(SENSITIVITYSLIDERLOW, SENSITIVITYSLIDERHIGH);
		m_pSensitivityCtrl->SetSliderIncrement(1);
	}


	// The center offset axis control
	m_pCenterOffsetCtrl=pDestFolder->AddToggle(m_nCenterOffsetID, IDS_HELP_JOY_CENTER, kGap,
												  &m_bCenterOffset, LTFALSE, g_pInterfaceResMgr->GetSmallFont());
	m_pCenterOffsetCtrl->SetOnString(IDS_ON);
	m_pCenterOffsetCtrl->SetOffString(IDS_OFF);
}
示例#4
0
    void InitWebResources() {
        AddWebLicenses(licenses);

        SetDeviceName("Conlog");

        if (!IsExternalWebconfig()) {
        	SetHomePageUrl("cgibin?Abs_App=Abstract_Default");
        	SetSignaturePageUrl("sign.htm");
        	SetRefreshTimeout(1000);
        	SetPropPortNumber((unsigned int) 80);

        }
    }
nsDeviceContextSpecWin::~nsDeviceContextSpecWin()
{
  SetDeviceName(nsnull);
  SetDriverName(nsnull);
  SetDevMode(NULL);

  nsCOMPtr<nsIPrintSettingsWin> psWin(do_QueryInterface(mPrintSettings));
  if (psWin) {
    psWin->SetDeviceName(nsnull);
    psWin->SetDriverName(nsnull);
    psWin->SetDevMode(NULL);
  }

  // Free them, we won't need them for a while
  GlobalPrinters::GetInstance()->FreeGlobalPrinters();
}
//----------------------------------------------------------------------------------
NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, 
                                           nsIPrintSettings* aPrintSettings,
                                           PRBool aIsPrintPreview)
{
  mPrintSettings = aPrintSettings;

  nsresult rv = aIsPrintPreview ? NS_ERROR_GFX_PRINTER_PRINTPREVIEW : 
                                  NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
  if (aPrintSettings) {
    nsCOMPtr<nsIPrintSettingsWin> psWin(do_QueryInterface(aPrintSettings));
    if (psWin) {
      PRUnichar* deviceName;
      PRUnichar* driverName;
      psWin->GetDeviceName(&deviceName); // creates new memory (makes a copy)
      psWin->GetDriverName(&driverName); // creates new memory (makes a copy)

      LPDEVMODEW devMode;
      psWin->GetDevMode(&devMode);       // creates new memory (makes a copy)

      if (deviceName && driverName && devMode) {
        // Scaling is special, it is one of the few
        // devMode items that we control in layout
        if (devMode->dmFields & DM_SCALE) {
          double scale = double(devMode->dmScale) / 100.0f;
          if (scale != 1.0) {
            aPrintSettings->SetScaling(scale);
            devMode->dmScale = 100;
          }
        }

        SetDeviceName(deviceName);
        SetDriverName(driverName);
        SetDevMode(devMode);

        if (!aIsPrintPreview) {
          rv = CheckForPrintToFile(mPrintSettings, deviceName, nsnull);
          if (NS_FAILED(rv)) {
            nsCRT::free(deviceName);
            nsCRT::free(driverName);
            return NS_ERROR_FAILURE;
          }
        }

        // clean up
        nsCRT::free(deviceName);
        nsCRT::free(driverName);

        return NS_OK;
      } else {
        PR_PL(("***** nsDeviceContextSpecWin::Init - deviceName/driverName/devMode was NULL!\n"));
        if (deviceName) nsCRT::free(deviceName);
        if (driverName) nsCRT::free(driverName);
        if (devMode) ::HeapFree(::GetProcessHeap(), 0, devMode);
      }
    }
  } else {
    PR_PL(("***** nsDeviceContextSpecWin::Init - aPrintSettingswas NULL!\n"));
  }

  // Get the Print Name to be used
  PRUnichar * printerName = nsnull;
  if (mPrintSettings) {
    mPrintSettings->GetPrinterName(&printerName);
  }

  // If there is no name then use the default printer
  if (!printerName || (printerName && !*printerName)) {
    printerName = GetDefaultPrinterNameFromGlobalPrinters();
  }

  NS_ASSERTION(printerName, "We have to have a printer name");
  if (!printerName || !*printerName) return rv;

  if (!aIsPrintPreview) {
    CheckForPrintToFile(mPrintSettings, nsnull, printerName);
  }
 
  return GetDataFromPrinter(printerName, mPrintSettings);
}
示例#7
0
        LFXE_API size_t DeviceManager::InitializeDevices() {
            LOG_DEBUG(L"Initializing devices");
            size_t i = 0;

            auto config = this->GetLightFXExtender()->GetConfigManager()->GetMainConfig();
            this->updateDevicesInterval = config->TimelineUpdateInterval;

            auto lightpack = make_shared<DeviceLightpack>(config->LightpackHost, config->LightpackPort, config->LightpackKey);
            this->AddChild(L"Lightpack", lightpack);
            if (lightpack->Initialize()) {
                ++i;
            }


            auto logitech = make_shared<DeviceLogitech>();
            logitech->SetRange(config->LogitechColorRangeOutMin, config->LogitechColorRangeOutMax, config->LogitechColorRangeInMin, config->LogitechColorRangeInMax);
            this->AddChild(L"Logitech", logitech);
            logitech->SetRestoreLightsOnNullEnabled(config->LogitechRestoreLightsOnNullEnabled);
            logitech->SetG110WorkaroundEnabled(config->LogitechG110WorkaroundEnabled);
            if (logitech->Initialize()) {
                ++i;
            }

            
            auto corsair = make_shared<DeviceCorsair>();
            this->AddChild(L"Corsair", corsair);
            if (corsair->Initialize()) {
                ++i;
            }
            
            auto razer = make_shared<DeviceRazer>();
            razer->SetHardware(config->RazerUseWithKeyboard, config->RazerUseWithMouse, config->RazerUseWithHeadset, config->RazerUseWithMousepad, config->RazerUseWithKeypad);
            this->AddChild(L"Razer", razer);
            if (razer->Initialize()) {
                ++i;
            }

            // Load native LightFX devices
            this->lightFXLibrary = unique_ptr<LightFX2Proxy>(new LightFX2Proxy(config->AlienwareDllName, config->AlienwareBackupDllName));
            if (this->lightFXLibrary->Load()) {
                LOG_DEBUG(L"Alienware LightFX library found");
                LFX_RESULT result;

                result = this->lightFXLibrary->LFX_Initialize();
                if (result == LFX_SUCCESS) {
                    unsigned int numDevices = 0;
                    result = this->lightFXLibrary->LFX_GetNumDevices(&numDevices);
                    if (result == LFX_SUCCESS) {
                        LOG_DEBUG(to_wstring(numDevices) + L" LightFX devices found");

                        for (unsigned int j = 0; j < numDevices; ++j) {
                            auto lightFX = make_shared<DeviceLightFX>();
                            lightFX->SetDeviceIndex(j);

                            // Get device name first so we can properly add it to the list of devices
                            char* devDesc = new char[LFX_MAX_STRING_SIZE];
                            unsigned char devType = 0;
                            if (this->lightFXLibrary->LFX_GetDeviceDescription(j, devDesc, LFX_MAX_STRING_SIZE, &devType) == LFX_SUCCESS) {
                                wstring deviceName = string_to_wstring(devDesc);
                                if (deviceName == L"") {
                                    deviceName = L"LightFX " + to_wstring(j);
                                }
                                this->AddChild(deviceName, lightFX);                                
                                if (lightFX->Initialize()) {
                                    ++i;
                                }
                                lightFX->SetDeviceName(deviceName);
                            } else {
                                LOG_ERROR(L"Failed to get the device name of LightFX device " + to_wstring(j));
                            }
                            LFX_SAFE_DELETE_ARRAY(devDesc);
                        }

                        //TODO: Periodically check for changes (e.g. when a device gets connected or disconnected)
                    } else {
                        LOG_ERROR(L"Failed to check the number of LightFX devices: " + this->lightFXLibrary->LfxResultToString(result));
                    }
                } else {
                    LOG_ERROR(L"Failed to initialize LightFX: " + this->lightFXLibrary->LfxResultToString(result));
                }
            } else {
                LOG_DEBUG(L"Alienware LightFX library not found");
            }

            LOG_INFO(L"Successfully initialized " + to_wstring(i) + L" devices");

            // Enable devices where needed
            if (config->AutoDeviceDetection)
            {
                for (size_t i = 0; i < this->GetChildrenCount(); ++i) {
                    auto device = this->GetChildByIndex(i);

                    if (device == nullptr) {
                        LOG_WARNING(L"Device " + device->GetDeviceName() + L" is configured in settings, but was not found in the system");
                        continue;
                    }
                    if (!device->IsInitialized()) {
                        LOG_WARNING(L"Device " + device->GetDeviceName() + L" cannot be enabled, because was not initialized");
                        continue;
                    }

                    bool auto_result = device->Enable();
                    LOG_WARNING(L"Device " + device->GetDeviceName() + L" was automatically set to " + (auto_result ? L"ON" : L"OFF"));
                }
            }
            else
            {
                for (pair<wstring, bool> device : config->EnabledDevices) {
                    if (device.second) {
                        auto dev = this->GetChild(device.first);
                        if (dev == nullptr) {
                            LOG_WARNING(L"Device " + device.first + L" is configured in settings, but was not found in the system");
                            continue;
                        }
                        if (!dev->IsInitialized()) {
                            LOG_WARNING(L"Device " + device.first + L" cannot be enabled, because was not initialized");
                            continue;
                        }
                        dev->Enable();
                    }
                }
            }
            return i;
        }