void DeviceEditWidget::UpdateVisibilities() { const DeviceConfig::PortType type = GetPortType(GetDataField(Port)); const bool maybe_bluetooth = DeviceConfig::MaybeBluetooth(type, GetDataField(Port).GetAsString()); const bool k6bt = maybe_bluetooth && GetValueBoolean(K6Bt); const bool uses_speed = DeviceConfig::UsesSpeed(type) || k6bt; SetRowAvailable(BaudRate, uses_speed); SetRowAvailable(BulkBaudRate, uses_speed && DeviceConfig::UsesDriver(type)); SetRowVisible(BulkBaudRate, uses_speed && DeviceConfig::UsesDriver(type) && SupportsBulkBaudRate(GetDataField(Driver))); SetRowAvailable(IP_ADDRESS, DeviceConfig::UsesIPAddress(type)); SetRowAvailable(TCPPort, DeviceConfig::UsesTCPPort(type)); SetRowAvailable(I2CBus, DeviceConfig::UsesI2C(type)); SetRowAvailable(I2CAddr, DeviceConfig::UsesI2C(type) && type != DeviceConfig::PortType::NUNCHUCK); SetRowAvailable(PressureUsage, DeviceConfig::IsPressureSensor(type)); SetRowVisible(Driver, DeviceConfig::UsesDriver(type)); SetRowVisible(SyncFromDevice, DeviceConfig::UsesDriver(type) && CanReceiveSettings(GetDataField(Driver))); SetRowVisible(SyncToDevice, DeviceConfig::UsesDriver(type) && CanSendSettings(GetDataField(Driver))); SetRowAvailable(K6Bt, maybe_bluetooth); }
/*++ Routine Description: SerialPortPropPageProvider Entry-point for adding additional device manager property sheet pages. Registry specifies this routine under Control\Class\PortNode::EnumPropPage32="msports.dll,thisproc" entry. This entry-point gets called only when the Device Manager asks for additional property pages. Arguments: Info - points to PROPSHEETPAGE_REQUEST, see setupapi.h AddFunc - function ptr to call to add sheet. Lparam - add sheet functions private data handle. Return Value: BOOL: FALSE if pages could not be added, TRUE on success --*/ BOOL CALLBACK SerialPortPropPageProvider(LPVOID Info, LPFNADDPROPSHEETPAGE AddFunc, LPARAM Lparam ) { PSP_PROPSHEETPAGE_REQUEST pprPropPageRequest; PROPSHEETPAGE psp; HPROPSHEETPAGE hpsp; PPORT_PARAMS params = NULL; pprPropPageRequest = (PSP_PROPSHEETPAGE_REQUEST) Info; if (PortTypeSerial != GetPortType(pprPropPageRequest->DeviceInfoSet, pprPropPageRequest->DeviceInfoData, FALSE)) { return FALSE; } // // Allocate and zero out memory for the struct that will contain // page specific data // params = (PPORT_PARAMS) LocalAlloc(LPTR, sizeof(PORT_PARAMS)); if (!params) { ErrMemDlg(GetFocus()); return FALSE; } if (pprPropPageRequest->PageRequested == SPPSR_ENUM_ADV_DEVICE_PROPERTIES) { InitPortParams(params, pprPropPageRequest->DeviceInfoSet, pprPropPageRequest->DeviceInfoData); hpsp = InitSettingsPage(&psp, params); if (!hpsp) { LocalFree(params); return FALSE; } if (!(*AddFunc)(hpsp, Lparam)) { DestroyPropertySheetPage(hpsp); return FALSE; } } else { LocalFree(params); } return TRUE; } /* SerialPortPropPageProvider */
void DeviceEditWidget::UpdateVisibilities() { const DeviceConfig::PortType type = GetPortType(GetDataField(Port)); GetControl(BaudRate).set_visible(DeviceConfig::UsesSpeed(type)); GetControl(BulkBaudRate).set_visible(DeviceConfig::UsesSpeed(type) && DeviceConfig::UsesDriver(type) && SupportsBulkBaudRate(GetDataField(Driver))); GetControl(TCPPort).set_visible(DeviceConfig::UsesTCPPort(type)); GetControl(Driver).set_visible(DeviceConfig::UsesDriver(type)); }
void GPortRef::EncodeToStream(cppostream * pOutStream) { // We use a single XML tag to encode the port ref to the stream. // The tag is self-terminating; all fields are attributes. // Note that the DECODE method does not require all fields to be // present and does not care about their order. // REVISIT - use GXMLUtils to just build an element an write it. if (pOutStream != NULL) { *pOutStream << GSTD_S("<") << k_sPortRefCode << GSTD_S(" "); *pOutStream << k_sPortTypeCode << GSTD_S("=\"") << GetPortType() << GSTD_S("\" "); *pOutStream << k_sLocationCode << GSTD_S("=\"") << GetLocation() << GSTD_S("\" "); *pOutStream << k_sDisplayNameCode << GSTD_S("=\"") << GetDisplayName() << GSTD_S("\" "); *pOutStream << "/>"; } }
void DeviceEditWidget::UpdateVisibilities() { const DeviceConfig::PortType type = GetPortType(GetDataField(Port)); SetRowAvailable(BaudRate, DeviceConfig::UsesSpeed(type)); SetRowAvailable(BulkBaudRate, DeviceConfig::UsesSpeed(type) && DeviceConfig::UsesDriver(type)); SetRowVisible(BulkBaudRate, DeviceConfig::UsesSpeed(type) && DeviceConfig::UsesDriver(type) && SupportsBulkBaudRate(GetDataField(Driver))); SetRowAvailable(TCPPort, DeviceConfig::UsesTCPPort(type)); SetRowVisible(Driver, DeviceConfig::UsesDriver(type)); SetRowVisible(SyncFromDevice, DeviceConfig::UsesDriver(type) && CanReceiveSettings(GetDataField(Driver))); SetRowVisible(SyncToDevice, DeviceConfig::UsesDriver(type) && CanSendSettings(GetDataField(Driver))); SetRowVisible(IgnoreCheckSum, DeviceConfig::UsesDriver(type)); }
static DWORD InstallPort(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData) { PORT_TYPE PortType; InstallDeviceData(DeviceInfoSet, DeviceInfoData); PortType = GetPortType(DeviceInfoSet, DeviceInfoData); switch (PortType) { case ParallelPort: return InstallParallelPort(DeviceInfoSet, DeviceInfoData); case SerialPort: return InstallSerialPort(DeviceInfoSet, DeviceInfoData); default: return ERROR_DI_DO_DEFAULT; } }
void CMonoFlowNode::ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo) { m_pActInfo = pActInfo; if(m_pHookedGraph && m_pScript != nullptr) { m_pHookedGraph->UnregisterHook(this); m_pHookedGraph = nullptr; } switch(event) { case eFE_Activate: { IFlowNodeData *pNodeData = pActInfo->pGraph->GetNodeData(pActInfo->myID); if(!pNodeData) return; int numInputPorts = pNodeData->GetNumInputPorts(); if(m_flags & EFLN_TARGET_ENTITY) numInputPorts--; // last input is the entity port. for(int i = 0; i < numInputPorts; i++) { if(IsPortActive(i)) { switch(GetPortType(pActInfo, i)) { case eFDT_Void: m_pScript->CallMethod("OnPortActivated", i); break; case eFDT_Int: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortInt(pActInfo, i)); break; case eFDT_Float: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortFloat(pActInfo, i)); break; case eFDT_EntityId: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortEntityId(pActInfo, i)); break; case eFDT_Vec3: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortVec3(pActInfo, i)); break; case eFDT_String: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortString(pActInfo, i)); break; case eFDT_Bool: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortBool(pActInfo, i)); break; default: break; } } } } break; case eFE_Initialize: m_pScript->CallMethod("OnInit"); break; case eFE_SetEntityId: { if(pActInfo->pEntity) { IMonoArray *pParams = CreateMonoArray(2); pParams->InsertNativePointer(pActInfo->pEntity); pParams->Insert(pActInfo->pEntity->GetId()); m_pScript->GetClass()->GetMethod("InternalSetTargetEntity", 2)->InvokeArray(m_pScript->GetManagedObject(), pParams); pParams->Release(); } } break; case eFE_Update: m_pScript->CallMethod("OnNodeUpdate"); break; } }
void JackPort::MixBuffers(void** src_buffers, int src_count, jack_nframes_t buffer_size) { const JackPortType* type = GetPortType(fTypeId); (type->mixdown)(GetBuffer(), src_buffers, src_count, buffer_size); }
void JackPort::ClearBuffer(jack_nframes_t frames) { const JackPortType* type = GetPortType(fTypeId); (type->init)(GetBuffer(), frames * sizeof(jack_default_audio_sample_t), frames); }
const char* JackPort::GetType() const { const JackPortType* type = GetPortType(fTypeId); return type->fName; }
void CFlowNode::ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo) { m_pActInfo = pActInfo; if(m_pHookedGraph && m_pScript != nullptr) { m_pHookedGraph->UnregisterHook(this); m_pHookedGraph = nullptr; } switch(event) { case eFE_Activate: { IFlowNodeData *pNodeData = pActInfo->pGraph->GetNodeData(pActInfo->myID); if(!pNodeData) return; for(int i = 0; i < pNodeData->GetNumInputPorts(); i++) { if(IsPortActive(i)) { switch(GetPortType(pActInfo, i)) { case eFDT_Void: m_pScript->CallMethod("OnPortActivated", i); break; case eFDT_Int: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortInt(pActInfo, i)); break; case eFDT_Float: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortFloat(pActInfo, i)); break; case eFDT_EntityId: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortEntityId(pActInfo, i)); break; case eFDT_Vec3: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortVec3(pActInfo, i)); break; case eFDT_String: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortString(pActInfo, i)); break; case eFDT_Bool: m_pScript->CallMethod("OnPortActivated", i, CFlowBaseNodeInternal::GetPortBool(pActInfo, i)); break; default: break; } } } } break; case eFE_Initialize: m_pScript->CallMethod("OnInit"); break; /*case eFE_SetEntityId: { if(m_pNodeType->IsEntityNode()) { IMonoScript *pEntityScript = nullptr; EntityId entId = pActInfo->pGraph->GetEntityId(pActInfo->myID); if(pActInfo && entId) { if(IGameObject *pGameObject = gEnv->pGameFramework->GetGameObject(entId)) { if(CEntity *pEntity = static_cast<CEntity *>(pGameObject->QueryExtension("MonoEntity"))) { SAFE_RELEASE(m_pScript); m_pScript = pEntity->GetScript(); } } } } } break;*/ } }
static DWORD RemovePort(IN HDEVINFO DeviceInfoSet, IN PSP_DEVINFO_DATA DeviceInfoData) { PORT_TYPE PortType; HCOMDB hComDB = HCOMDB_INVALID_HANDLE_VALUE; HKEY hKey; LONG lError; DWORD dwPortNumber; DWORD dwPortNameSize; WCHAR szPortName[8]; /* If we are removing a serial port ... */ PortType = GetPortType(DeviceInfoSet, DeviceInfoData); if (PortType == SerialPort) { /* Open the port database */ if (ComDBOpen(&hComDB) == ERROR_SUCCESS) { /* Open the device key */ hKey = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); if (hKey != INVALID_HANDLE_VALUE) { /* Query the port name */ dwPortNameSize = sizeof(szPortName); lError = RegQueryValueEx(hKey, L"PortName", NULL, NULL, (PBYTE)szPortName, &dwPortNameSize); /* Close the device key */ RegCloseKey(hKey); /* If we got a valid port name ...*/ if (lError == ERROR_SUCCESS) { /* Get the port number */ dwPortNumber = _wtoi(szPortName + wcslen(pszCom)); /* Release the port */ ComDBReleasePort(hComDB, dwPortNumber); } } /* Close the port database */ ComDBClose(hComDB); } } /* Remove the device */ if (!SetupDiRemoveDevice(DeviceInfoSet, DeviceInfoData)) return GetLastError(); return ERROR_SUCCESS; }