//--------------------------------------------------------------------------- void __fastcall TfrmHeartMonitor::GetServiceAndCharacteristics(void) { TBluetoothGattCharacteristicList * CharList = NULL; TBluetoothGattDescriptorList * Descriptor = NULL; for(int i = 0; i < FBLEDevice->Services->Count; i++) { CharList = FBLEDevice->Services->Items[i]->Characteristics; Memo1->Lines->Add(FBLEDevice->Services->Items[i]->UUIDName + " : " + GUIDToString(FBLEDevice->Services->Items[i]->UUID)); for(int j = 0; j < CharList->Count; j++) { Memo1->Lines->Add("--> " + CharList->Items[j]->UUIDName + " : " + GUIDToString(CharList->Items[j]->UUID)); Descriptor = CharList->Items[j]->Descriptors; for(int k = 0; k < Descriptor->Count; k ++) { Memo1->Lines->Add("--> " + Descriptor->Items[k]->UUIDName + " : " + GUIDToString(Descriptor->Items[k]->UUID)); } } } FHRGattService = NULL; FHRMeasurementGattCharact = NULL; FBodySensorLocationGattCharact = NULL; FHRGattService = FBLEDevice->GetService(HRSERVICE); if(FHRGattService != NULL) { Memo1->Lines->Add("Service found"); FHRMeasurementGattCharact = FHRGattService->GetCharacteristic(HRMEASUREMENT_CHARACTERISTIC); FBodySensorLocationGattCharact = FHRGattService->GetCharacteristic(BODY_SENSOR_LOCATION_CHARACTERISTIC); } else { Memo1->Lines->Add("Service not found"); lblBPM->Font.Size := 26; lblBPM->Text = "Service not found"; } EnableHRMMonitorize(true); ReadBodySensorLocation(); }
void __fastcall TForm1::BeaconProximity(System::TObject* const Sender, const _di_IBeacon ABeacon, TBeaconProximity Proximity) { String LProximityText; TListViewItem *LNewitem; Integer I; switch (Proximity) { case TBeaconProximity::Inmediate: LProximityText = "Inmediate"; case TBeaconProximity::Near: LProximityText = "Near2"; case TBeaconProximity::Far: LProximityText = "Far"; case TBeaconProximity::Away: LProximityText = "Away"; }; LNewitem = LvProximity->Items->Add(); LNewitem->Text = GUIDToString(ABeacon->GUID); LNewitem->Detail = " Ma:" + IntToStr(ABeacon->Major) + " Mi:" + IntToStr(ABeacon->Minor) + " Dist:" + FloatToStr(ABeacon->Distance) + "Proximity: " + LProximityText + " time " + TimeToStr(Now()); for( I = 0; I < FList.Length; I++) { if ( FList[I].FName == (GUIDToString(ABeacon->GUID) + ";" + IntToStr(ABeacon->Major)+ ";" + IntToStr(ABeacon->Minor))) { switch (Proximity) { case TBeaconProximity::Inmediate: FList[I].FOriginalColor = TAlphaColorRec::Green; break; case TBeaconProximity::Near: FList[I].FOriginalColor = TAlphaColorRec::Yellow; break; case TBeaconProximity::Far: FList[I].FOriginalColor = TAlphaColorRec::Red; break; case TBeaconProximity::Away: FList[I].FOriginalColor = TAlphaColorRec::Black; break; }; break; }; }; };
static HRESULT write_types(HKEY hkey, LPCWSTR name, const DMO_PARTIAL_MEDIATYPE* types, DWORD count) { HRESULT hres = S_OK; if (MSDMO_MAJOR_VERSION > 5) { hres = RegSetValueExW(hkey, name, 0, REG_BINARY, (const BYTE*) types, count* sizeof(DMO_PARTIAL_MEDIATYPE)); } else { HKEY skey1,skey2,skey3; DWORD index = 0; WCHAR szGuidKey[64]; hres = RegCreateKeyExW(hkey, name, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &skey1, NULL); while (index < count) { GUIDToString(szGuidKey,&types[index].type); hres = RegCreateKeyExW(skey1, szGuidKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &skey2, NULL); GUIDToString(szGuidKey,&types[index].subtype); hres = RegCreateKeyExW(skey2, szGuidKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &skey3, NULL); RegCloseKey(skey3); RegCloseKey(skey2); index ++; } RegCloseKey(skey1); } return hres; }
void __fastcall TfrmProximityForm::GetServiceAndCharacteristics() { int I, J, K; for (I = 0; I <= FBLEDevice->Services->Count - 1; I++) { AddTextToMemo(FBLEDevice->Services->Items[I]->UUIDName + " : " + GUIDToString(FBLEDevice->Services->Items[I]->UUID)); for (J = 0; J <= FBLEDevice->Services->Items[I]->Characteristics->Count - 1; J++) { AddTextToMemo("--> " + FBLEDevice->Services->Items[I]->Characteristics->Items[J]->UUIDName + " : " + GUIDToString(FBLEDevice->Services->Items[I]->Characteristics->Items[J]->UUID)); for (K = 0; K <= FBLEDevice->Services->Items[I]->Characteristics->Items[J]->Descriptors->Count - 1; K++) { AddTextToMemo("----> " + FBLEDevice->Services->Items[I]->Characteristics->Items[J]->Descriptors->Items[K]->UUIDName + " : " + GUIDToString(FBLEDevice->Services->Items[I]->Characteristics->Items[J]->Descriptors->Items[K]->UUID)); } } } FLinkLossService = NULL; FTXPowerService = NULL; FImmediateAlertService = NULL; FTXPowerLevelCharact = NULL; FImmediateAlertLevelCharact = NULL; FLinkLossAlertLevelCharact = NULL; FLinkLossService = FBLEDevice->GetService(LINK_LOSS_SERVICE); if (FLinkLossService != NULL) { AddTextToMemo("Service found"); FLinkLossAlertLevelCharact = FLinkLossService->GetCharacteristic(ALERT_LEVEL_CHARACTERISTIC); FBLEDevice->ReadCharacteristic(FLinkLossAlertLevelCharact); } FImmediateAlertService = FBLEDevice->GetService(IMMEDIATE_ALERT_SERVICE); if (FImmediateAlertService != NULL) { AddTextToMemo("Service found"); FImmediateAlertLevelCharact = FImmediateAlertService->GetCharacteristic(ALERT_LEVEL_CHARACTERISTIC); FBLEDevice->ReadCharacteristic(FImmediateAlertLevelCharact); } FTXPowerService = FBLEDevice->GetService(TX_POWER_SERVICE); if (FTXPowerService != NULL) { AddTextToMemo("Service found"); FTXPowerLevelCharact = FTXPowerService->GetCharacteristic(TX_POWER_LEVEL_CHARACTERISTIC); FTxPowerValue = -50; // Invalid value if (FTXPowerLevelCharact != NULL) FBLEDevice->ReadCharacteristic(FTXPowerLevelCharact); } WriteLinkLossAlertLevel(0); EnableRSSIMonitorize(True); }
static void AnnotateInterfaceRegistrationForHive(JSONWriter& aJson, HKEY aHive, REFIID aIid, const JSONWriter::CollectionStyle aStyle) { nsAutoString interfaceSubKey; interfaceSubKey.AppendLiteral(kSoftwareClasses); interfaceSubKey.AppendLiteral(kInterface); nsAutoString iid; GUIDToString(aIid, iid); interfaceSubKey.Append(iid); nsAutoString interfaceName; if (GetStringValue(aHive, interfaceSubKey, kDefaultValue, interfaceName)) { aJson.StringProperty("InterfaceName", NS_ConvertUTF16toUTF8(interfaceName).get()); } nsAutoString psSubKey(interfaceSubKey); psSubKey.AppendLiteral(kProxyStubClsid32); nsAutoString psClsid; if (GetStringValue(aHive, psSubKey, kDefaultValue, psClsid)) { aJson.StartObjectProperty("ProxyStub", aStyle); aJson.StringProperty("CLSID", NS_ConvertUTF16toUTF8(psClsid).get()); AnnotateClsidRegistrationForHive(aJson, aHive, psClsid, aStyle); aJson.EndObject(); } nsAutoString typelibSubKey(interfaceSubKey); typelibSubKey.AppendLiteral(kTypeLib); nsAutoString typelibId; bool haveTypelibId = GetStringValue(aHive, typelibSubKey, kDefaultValue, typelibId); nsAutoString typelibVersion; bool haveTypelibVersion = GetStringValue(aHive, typelibSubKey, kVersion, typelibVersion); if (haveTypelibId || haveTypelibVersion) { aJson.StartObjectProperty("TypeLib", aStyle); } if (haveTypelibId) { aJson.StringProperty("ID", NS_ConvertUTF16toUTF8(typelibId).get()); } if (haveTypelibVersion) { aJson.StringProperty("Version", NS_ConvertUTF16toUTF8(typelibVersion).get()); } if (haveTypelibId && haveTypelibVersion) { AnnotateTypelibRegistrationForHive(aJson, aHive, typelibId, typelibVersion, aStyle); } if (haveTypelibId || haveTypelibVersion) { aJson.EndObject(); } }
void ofxPS3::StartSettingsDialog() { HWND hwnd; MSG msg; WNDCLASS wndclass; char szAppName[64] = "PS3 Eye settings: "; strcat(szAppName,GUIDToString(guid).c_str()); wndclass.style = 0; wndclass.lpfnWndProc = ofxPS3::WndProc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; HMODULE hInstance; GetModuleHandleEx(0,NULL,&hInstance); wndclass.hInstance = hInstance; wndclass.hIcon = LoadIconA(hInstance, szAppName); wndclass.hCursor = LoadCursor(NULL, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); //wndclass.lpszMenuName = szAppName; //wndclass.lpszClassName = szAppName; RegisterClass(&wndclass); InitCommonControls(); hwnd = CreateWindowA(szAppName, szAppName, DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE, 0, 0, 465, cameraPixelMode ? 410 : 110, NULL, NULL, hInstance, 0); SetWindowLongPtr(hwnd,GWLP_USERDATA,(LONG_PTR)(this)); while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } }
void __fastcall TForm1::BeaconsRectanglePaint(TObject *Sender, TCanvas *Canvas, const TRectF &ARect) { int I; String LGuid; int LMajor; int LMinor; if (FSelectedBeacon != "") { StringToRegion(FSelectedBeacon, LGuid, LMajor, LMinor); LbUUID->Text = LGuid; LbMajor->Text = IntToStr(LMajor); LbMinor->Text = IntToStr(LMinor); try { TMonitor::Enter(FLock); for (I = 0; I < FCurrentBeaconList.Length; I++) { if (( GUIDToString(FCurrentBeaconList[I]->GUID) == LGuid) && (LMajor == FCurrentBeaconList[I]->Major) && (LMinor == FCurrentBeaconList[I]->Minor) ) { LbDistance->Text = FloatToStr(FCurrentBeaconList[I]->Distance); LbRssi->Text = IntToStr(FCurrentBeaconList[I]->Rssi); break; }; }; } __finally { TMonitor::Exit(FLock); }; };
//--------------------------------------------------------------------------- void __fastcall TForm3::Beacon1BeaconExit(TObject * const Sender, IBeacon * const ABeacon, const TBeaconList CurrentBeaconList) { Memo1->Lines->Add("Beacon exited"); Memo1->Lines->Add( "UUID: " + GUIDToString(ABeacon->GUID) + " Major: " + IntToStr(ABeacon->Major) + " Minor: " + IntToStr(ABeacon->Minor)); Memo1->Lines->Add("Current Beacons count :" + static_cast<int>(CurrentBeaconList.Length)); }
/*************************************************************** * DMOGetName (MSDMO.@) * * Get DMO Name from the registry */ HRESULT WINAPI DMOGetName(REFCLSID clsidDMO, WCHAR name[]) { static const INT max_name_len = 80*sizeof(WCHAR); DWORD count = max_name_len; WCHAR szguid[64]; HKEY hrkey, hkey; LONG ret; TRACE("%s %p\n", debugstr_guid(clsidDMO), name); if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_READ, &hrkey)) return E_FAIL; ret = RegOpenKeyExW(hrkey, GUIDToString(szguid, clsidDMO), 0, KEY_READ, &hkey); RegCloseKey(hrkey); if (ret) return E_FAIL; ret = RegQueryValueExW(hkey, NULL, NULL, NULL, (LPBYTE)name, &count); RegCloseKey(hkey); if (!ret && count > 1) { TRACE("name=%s\n", debugstr_w(name)); return S_OK; } name[0] = 0; return S_FALSE; }
/*************************************************************** * DMOGetName (MSDMO.@) * * Get DMP Name from the registry */ HRESULT WINAPI DMOGetName(REFCLSID clsidDMO, WCHAR szName[]) { WCHAR szguid[64]; HRESULT hres; HKEY hrkey = 0; HKEY hkey = 0; static const INT max_name_len = 80; DWORD count; TRACE("%s\n", debugstr_guid(clsidDMO)); hres = RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_READ, &hrkey); if (ERROR_SUCCESS != hres) goto lend; hres = RegOpenKeyExW(hrkey, GUIDToString(szguid, clsidDMO), 0, KEY_READ, &hkey); if (ERROR_SUCCESS != hres) goto lend; count = max_name_len * sizeof(WCHAR); hres = RegQueryValueExW(hkey, NULL, NULL, NULL, (LPBYTE) szName, &count); TRACE(" szName=%s\n", debugstr_w(szName)); lend: if (hkey) RegCloseKey(hrkey); if (hkey) RegCloseKey(hkey); return hres; }
/*************************************************************** * DMOUnregister (MSDMO.@) * * Unregister a DirectX Media Object. */ HRESULT WINAPI DMOUnregister(REFCLSID clsidDMO, REFGUID guidCategory) { HRESULT hres; WCHAR szguid[64]; HKEY hrkey = 0; HKEY hckey = 0; GUIDToString(szguid, clsidDMO); TRACE("%s %p\n", debugstr_w(szguid), guidCategory); hres = RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_WRITE, &hrkey); if (ERROR_SUCCESS != hres) goto lend; hres = RegDeleteKeyW(hrkey, szguid); if (ERROR_SUCCESS != hres) goto lend; hres = RegOpenKeyExW(hrkey, szDMOCategories, 0, KEY_WRITE, &hckey); if (ERROR_SUCCESS != hres) goto lend; hres = RegDeleteKeyW(hckey, szguid); if (ERROR_SUCCESS != hres) goto lend; lend: if (hckey) RegCloseKey(hckey); if (hrkey) RegCloseKey(hrkey); return hres; }
//--------------------------------------------------------------------------- void __fastcall TFrDeviceExplorer::DidCharacteristicRead(TObject* const Sender, TBluetoothGattCharacteristic* const ACharacteristic, TBluetoothGattStatus AGattStatus) { if(GUIDToString(ACharacteristic->UUID) == EdCharacUID->Text) { RefreshCurrentCharacteristic(); } }
void __fastcall TForm1::ExitRegion(System::TObject* const Sender, const GUID &UUID, int AMajor, int AMinor) { TListViewItem *LItem; LItem = LvExitedRegion->Items->Add(); LItem->Text = GUIDToString(UUID); LItem->Detail = "Major: " + IntToStr(AMajor) + " Minor: " + IntToStr(AMinor) + " time :" + TimeToStr(Now()); };
/*************************************************************** * DMOUnregister (MSDMO.@) * * Unregister a DirectX Media Object. */ HRESULT WINAPI DMOUnregister(REFCLSID dmo, REFGUID category) { HKEY rootkey = 0, categorieskey = 0; WCHAR dmoW[64], catW[64]; HRESULT hr = S_FALSE; LONG ret; TRACE("%s %s\n", debugstr_guid(dmo), debugstr_guid(category)); ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_WRITE, &rootkey); if (ret) return S_FALSE; GUIDToString(dmoW, dmo); RegDeleteKeyW(rootkey, dmoW); /* open 'Categories' */ ret = RegOpenKeyExW(rootkey, szDMOCategories, 0, KEY_WRITE|KEY_ENUMERATE_SUB_KEYS, &categorieskey); RegCloseKey(rootkey); if (ret) { hr = HRESULT_FROM_WIN32(ret); goto lend; } /* remove from all categories */ if (IsEqualGUID(category, &GUID_NULL)) { DWORD index = 0, len = sizeof(catW)/sizeof(WCHAR); while (!RegEnumKeyExW(categorieskey, index++, catW, &len, NULL, NULL, NULL, NULL)) hr = unregister_dmo_from_category(dmoW, catW, categorieskey); } else { GUIDToString(catW, category); hr = unregister_dmo_from_category(dmoW, catW, categorieskey); } lend: if (categorieskey) RegCloseKey(categorieskey); return hr; }
//--------------------------------------------------------------------------- void __fastcall TForm8::BtnRandomClick(TObject *Sender) { TGUID LGuid; CreateGUID(LGuid); UnicodeString LStrGuid = GUIDToString(LGuid); EdtBeaconUUID->Text = LStrGuid.SubString0(1, LStrGuid.Length() - 2); EdtBeaconMajor->Text = IntToStr(Random(USHRT_MAX)); EdtBeaconMinor->Text = IntToStr(Random(USHRT_MAX)); }
//--------------------------------------------------------------------------- void __fastcall TFrDeviceExplorer::ServicesDiscovered(TObject* const Sender, TBluetoothGattServiceList* const AServiceList) { TvCharacteristics->Clear(); for(int i = 0; i < AServiceList->Count; i++) { ServiceItem = new TTreeViewItem(NULL); ServiceItem->Parent = TvCharacteristics; ServiceItem->Tag = i; ServiceItem->IsExpanded = true; if (AServiceList->Items[i]->UUIDName == "") { ServiceItem->Text = "Unnamed"; } else { ServiceItem->Text = AServiceList->Items[i]->UUIDName; } TBluetoothGattCharacteristicList *ACharList = AServiceList->Items[i]->Characteristics; for(j = 0; j < ACharList->Count; j++) { AChar = ACharList->Items[j]; String Options = ""; if(AChar->Properties.Contains(TBluetoothProperty::Broadcast)) Options = Options + "Broadcast "; if(AChar->Properties.Contains(TBluetoothProperty::ExtendedProps)) Options = Options + "ExtendedProps "; if(AChar->Properties.Contains(TBluetoothProperty::Notify)) Options = Options + "Notify "; if(AChar->Properties.Contains(TBluetoothProperty::Indicate)) Options = Options + "Indicate "; if(AChar->Properties.Contains(TBluetoothProperty::Read)) Options = Options + "Read "; if(AChar->Properties.Contains(TBluetoothProperty::Write)) Options = Options + "Write "; if(AChar->Properties.Contains(TBluetoothProperty::WriteNoResponse)) Options = Options + "WriteNoResponse "; if(AChar->Properties.Contains(TBluetoothProperty::SignedWrite)) Options = Options + "SignedWrite "; Characteristic = new TTreeViewItem(NULL); Characteristic->Parent = ServiceItem; Characteristic->IsExpanded = false; if (AChar->UUIDName != "") { Characteristic->Text = AChar->UUIDName; } else { Characteristic->Text = "Unnamed"; } Characteristic->Tag = j; CharProps = new TTreeViewItem(NULL); CharProps->Tag = -1; CharProps->Parent = Characteristic; CharProps->IsExpanded = true; CharProps->Text = GUIDToString(AChar->UUID); CharProps = new TTreeViewItem(NULL); CharProps->Tag = -1; CharProps->Parent = Characteristic; CharProps->IsExpanded = true; CharProps->Text = Options; // TThread::Synchronize(NULL, ServicesDiscoveredThreadMethod); Application->ProcessMessages(); } } tmAnimateFindServices->Enabled = false; PbServices->Value = 100; }
String CreateCardNo(String cardType) { _GUID guid; CoCreateGuid(&guid); String result = GUIDToString(guid); if(result.Length() < 3) { return "?NEVER BE HERE!?"; } cardType = cardType.UpperCase(); return FormatStr("%s_%s", cardType, String(result.c_str()+1, result.Length()-2)); }
//--------------------------------------------------------------------------- void __fastcall TForm1::Timer1Timer(TObject *Sender) { int I; TListViewItem *LItem; TMonitor::Enter(FLock); try { LvMonitoring->Items->Clear(); FList.Length = FCurrentBeaconList.Length; for (I = 0; I < FList.Length; I++) { if (FCurrentBeaconList[I]->ItsAlive()) { LItem = LvMonitoring->Items->Add(); LItem->Text = GUIDToString(FCurrentBeaconList[I]->GUID); LItem->Detail = "Major: " + IntToStr(FCurrentBeaconList[I]->Major)+ " Minor: " + IntToStr(FCurrentBeaconList[I]->Minor) + "Proximity: " + IntToStr(FCurrentBeaconList[I]->Proximity) + Char(13) + "Rssi: " + IntToStr(FCurrentBeaconList[I]->Rssi) + " Distance: " + FloatToStr(FCurrentBeaconList[I]->Distance); FList[I].FOriginalColor = TAlphaColorRec::Blue; FList[I].FDistance = FCurrentBeaconList[I]->Distance; FList[I].FName = GUIDToString(FCurrentBeaconList[I]->GUID) + ";" + IntToStr(FCurrentBeaconList[I]->Major) + ";" + IntToStr(FCurrentBeaconList[I]->Minor); switch (FCurrentBeaconList[I]->Proximity) { case TBeaconProximity::Inmediate: FList[I].FOriginalColor = TAlphaColorRec::Green; break; case TBeaconProximity::Near: FList[I].FOriginalColor = TAlphaColorRec::Yellow; break; case TBeaconProximity::Far: FList[I].FOriginalColor = TAlphaColorRec::Red; break; case TBeaconProximity::Away: FList[I].FOriginalColor = TAlphaColorRec::Black; break; }; }; }; BeaconsRectangle->Repaint(); } __finally { TMonitor::Exit(FLock); }; }
//=============================================================================* void BAR_TypeLib::CompareGuids(const GUID& guidFound, const GUID& guidExpected) const { //=== convert found and expected guid into strings const string sGuidFound = GUIDToString(guidFound); const string sGuidExpected = GUIDToString(guidExpected); //=== ... and compare if they are equal if ( sGuidFound == sGuidExpected ) { BAR_TRACE1(2, "type library has correct guid, guid=%s", sGuidFound.c_str()); return; } else { Throw_RegisteringTlbFailed(E_FAIL, wstring(L"type library has wrong guid") + L", found=" + ToWS(sGuidFound) + L", expected=" + ToWS(sGuidExpected) ); } }
void ofxMultiplexerManager::saveSettingsToXML(char* fileName) { ofxXmlSettings* xmlSettings = new ofxXmlSettings(); if (xmlSettings->loadFile(fileName)) { xmlSettings->setValue("MULTIPLEXER","",0); xmlSettings->pushTag("MULTIPLEXER", 0); xmlSettings->setValue("CAMERAGRID:WIDTH",cameraGridWidth); xmlSettings->setValue("CAMERAGRID:HEIGHT",cameraGridHeight); xmlSettings->setValue("CALIBRATIONGRID:WIDTH",calibrationGridWidth); xmlSettings->setValue("CALIBRATIONGRID:HEIGHT",calibrationGridHeight); xmlSettings->setValue("INTERLEAVE",interleaveMode); xmlSettings->setValue("CAMERAS","",0); xmlSettings->pushTag("CAMERAS", 0); //if (cameraGridWidth*cameraGridHeight == cameraBasesCalibration.size()) { for (int i=0;i<cameraBasesCalibration.size();i++) { xmlSettings->setValue("CAMERA","",i); xmlSettings->pushTag("CAMERA", i); if (cameraBasesCalibration[i]->camera != NULL) { xmlSettings->setValue("GUID", GUIDToString(cameraBasesCalibration[i]->camera->getBaseCameraGuid())); xmlSettings->setValue("TYPE", cameraBasesCalibration[i]->camera->getBaseCameraTypeName()); xmlSettings->setValue("INDEX", cameraBasesCalibration[i]->index); xmlSettings->setValue("POINTARRAY","",0); xmlSettings->pushTag("POINTARRAY", 0); int numPointTags = cameraBasesCalibration[i]->calibrationPoints.size(); for (int j = 0;j<numPointTags;j++) { xmlSettings->setValue("POINT","",j); xmlSettings->pushTag("POINT", j); xmlSettings->setValue("X",cameraBasesCalibration[i]->calibrationPoints[j].X); xmlSettings->setValue("Y",cameraBasesCalibration[i]->calibrationPoints[j].Y); xmlSettings->popTag(); } xmlSettings->popTag(); } xmlSettings->popTag(); } } xmlSettings->popTag(); xmlSettings->popTag(); } xmlSettings->saveFile(fileName); delete xmlSettings; xmlSettings = NULL; }
/*************************************************************** * DMOGetTypes (MSDMO.@) */ HRESULT WINAPI DMOGetTypes(REFCLSID clsidDMO, ULONG ulInputTypesRequested, ULONG* pulInputTypesSupplied, DMO_PARTIAL_MEDIATYPE* pInputTypes, ULONG ulOutputTypesRequested, ULONG* pulOutputTypesSupplied, DMO_PARTIAL_MEDIATYPE* pOutputTypes) { HKEY root,hkey; HRESULT ret = S_OK; WCHAR szguid[64]; TRACE ("(%s,%u,%p,%p,%u,%p,%p)\n", debugstr_guid(clsidDMO), ulInputTypesRequested, pulInputTypesSupplied, pInputTypes, ulOutputTypesRequested, pulOutputTypesSupplied, pOutputTypes); if (ERROR_SUCCESS != RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_READ, &root)) return E_FAIL; if (ERROR_SUCCESS != RegOpenKeyExW(root,GUIDToString(szguid,clsidDMO) , 0, KEY_READ, &hkey)) { RegCloseKey(root); return E_FAIL; } if (ulInputTypesRequested > 0) { ret = read_types(hkey, szDMOInputType, pulInputTypesSupplied, ulInputTypesRequested, pInputTypes ); } else *pulInputTypesSupplied = 0; if (ulOutputTypesRequested > 0) { HRESULT ret2; ret2 = read_types(hkey, szDMOOutputType, pulOutputTypesSupplied, ulOutputTypesRequested, pOutputTypes ); if (ret == S_OK) ret = ret2; } else *pulOutputTypesSupplied = 0; return ret; }
void __fastcall TForm1::BeaconExit(System::TObject* const Sender, const _di_IBeacon ABeacon, const TBeaconList CurrentBeaconList) { TListViewItem *LItem; LItem = LvExitedBeacon->Items->Add(); LItem->Text = GUIDToString(ABeacon->GUID); LItem->Detail = "Major: " + IntToStr(ABeacon->Major) + " Minor: " + IntToStr(ABeacon->Minor) + " time :" + TimeToStr(Now()) ; TMonitor::Enter(FLock); try { FCurrentBeaconList = CurrentBeaconList; } __finally { TMonitor::Exit(FLock); }; }
bool TMeasurementColorHistory::AddEntry(GUID& guid, AnsiString& strFileName, TPantoneColorEntry* e, int num) { AnsiString str_guid = GUIDToString(guid); TiXmlElement* element = new TiXmlElement("Measurement"); element->SetAttribute("id", str_guid.c_str()); element->SetAttribute("image", strFileName.c_str()); AnsiString str; for(int i = 0; i < num; i++) { str = "r" + IntToStr(i); element->SetAttribute(str.c_str(), e[i].Red); str = "g" + IntToStr(i); element->SetAttribute(str.c_str(), e[i].Green); str = "b" + IntToStr(i); element->SetAttribute(str.c_str(), e[i].Blue); } element->SetAttribute("descr", "n/a"); m_root->LinkEndChild(element); return true; }
void __fastcall TForm1::ButtonServicesClick(TObject *Sender) { ListView1->Items->Clear(); if(ComboBoxPaired->ItemIndex > -1 ){ TBluetoothDevice * LDevice = FPairedDevices->Items[ComboBoxPaired->ItemIndex]; AniIndicator2->Visible = True; TBluetoothServiceList * LServices = LDevice->GetServices(); AniIndicator2->Visible = False; for(int i = 0; i < LServices->Count; i++) { TListViewItem * LListItem = ListView1->Items->Add(); LListItem->ImageIndex = GetServiceImageIndex(LServices->Items[i].UUID); LListItem->Text = LServices->Items[i].Name; if (LListItem->Text == "") LListItem->Text = "<Unknown>"; LListItem->Detail = GUIDToString(LServices->Items[i].UUID); } } else { ShowMessage("No paired device selected"); } }
BOOL CALLBACK nxInputManager::EnumJoysticksCallback( const DIDEVICEINSTANCE* pInstance,VOID* ptData ) { // Skip XInput devices if (nxXInputDevice::IsXInputDevice(pInstance->guidProduct)) return DIENUM_CONTINUE; nxInputManager&objManager = nxInputManager::instance(); LPDIRECTINPUTDEVICE8 ptDevice; // Attempt to create a device interface for the joystick if (objManager.pDI->CreateDevice( pInstance->guidInstance, &ptDevice, NULL ) == DI_OK) { /*TODO: Set the range for axis and buttons DIPROPRANGE diPropRange; diPropRange.diph.dwSize = sizeof(DIPROPRANGE); diPropRange.diph.dwHeaderSize = sizeof(DIPROPHEADER);*/ // Set the device parameters if( ptDevice->SetDataFormat( &c_dfDIJoystick ) != DI_OK || ptDevice->SetCooperativeLevel(NULL,DISCL_BACKGROUND|DISCL_NONEXCLUSIVE) != DI_OK || ptDevice->EnumObjects(EnumObjectsCallback,reinterpret_cast<VOID*>(ptDevice),DIDFT_AXIS) != DI_OK) { ptDevice->Release(); } else { // Create the interface to device id mapping nxDeviceId uDevId = objManager.CreateDeviceId(); // Add the handle to device id mapping objManager.mpHandleId[ptDevice] = uDevId; // Add the device to the list of DInput devices (used for polling) objManager.stDInputDevices.insert(ptDevice); // Map the GUID to the device id objManager.SetGUIDMapping(uDevId,GUIDToString(pInstance->guidInstance)); } } return DIENUM_CONTINUE; }
//--------------------------------------------------------------------------- void __fastcall TFrDeviceExplorer::RefreshCurrentCharacteristic(void) { TBluetoothLEDevice * ADevice; ADevice = GetCurrentDevice(); if(ADevice != NULL) { TBluetoothGattService * AService = ADevice->Services->Items[CurrentService]; TBluetoothGattCharacteristic * AChar = AService->Characteristics->Items[CurrentCharacteristic]; lbCurrentService->Text = AService->UUIDName; EdCharacName->Text = AChar->UUIDName; EdCharacUID->Text = GUIDToString(AChar->UUID); cbBroadcast->IsChecked = AChar->Properties.Contains(TBluetoothProperty::Broadcast); cbExtendedProp->IsChecked = AChar->Properties.Contains(TBluetoothProperty::ExtendedProps); cbNotify->IsChecked = AChar->Properties.Contains(TBluetoothProperty::Notify); cbIndicate->IsChecked = AChar->Properties.Contains(TBluetoothProperty::Indicate); CbRead->IsChecked = AChar->Properties.Contains(TBluetoothProperty::Read); CbWrite->IsChecked = AChar->Properties.Contains(TBluetoothProperty::Write); cbWriteNoResponse->IsChecked = AChar->Properties.Contains(TBluetoothProperty::WriteNoResponse); cbSignedWrite->IsChecked = AChar->Properties.Contains(TBluetoothProperty::SignedWrite); if ((AChar->Value.Length > 0) && (CbRead->IsChecked)) { LbCurrentValue->Items->Clear(); try { LbCurrentValue->Items->Add("HEX: " + ConverToHex(AChar->GetValue())); } catch (...) { } try { LbCurrentValue->Items->Add("String(UTF8): " + AChar->GetValueAsString()); } catch (...) { } try { LbCurrentValue->Items->Add("String(NOUTF8): " + AChar->GetValueAsString(1,false)); } catch (...) { } try { LbCurrentValue->Items->Add("Int8: " + IntToStr(AChar->GetValueAsInt8())); } catch (...) { } try { LbCurrentValue->Items->Add("Int16: " + IntToStr(AChar->GetValueAsInt16())); } catch (...) { } try { LbCurrentValue->Items->Add("Int32: " + IntToStr(AChar->GetValueAsInt32())); } catch (...) { } try { LbCurrentValue->Items->Add("Int64: " + IntToStr(AChar->GetValueAsInt64())); } catch (...) { } try { LbCurrentValue->Items->Add("UInt8: " + IntToStr(AChar->GetValueAsUInt8())); } catch (...) { } try { LbCurrentValue->Items->Add("UInt16: " + IntToStr(AChar->GetValueAsUInt16())); } catch (...) { } try { LbCurrentValue->Items->Add("UInt32: " + IntToStr((int)AChar->GetValueAsUInt32())); } catch (...) { } try { LbCurrentValue->Items->Add("UInt64: " + IntToStr((__int64)AChar->GetValueAsUInt64())); } catch (...) { } try { LbCurrentValue->Items->Add("Double: " + FloatToStr(AChar->GetValueAsDouble())); } catch (...) { } try { LbCurrentValue->Items->Add("Single: " + FloatToStr(AChar->GetValueAsSingle())); } catch (...) { } } } }
// This is called when there is a new location report STDMETHODIMP CLocationEvents::OnLocationChanged(REFIID reportType, ILocationReport* pLocationReport) { // If the report type is a Latitude/Longitude report (as opposed to IID_ICivicAddressReport or another type) if (IID_ILatLongReport == reportType) { CComPtr<ILatLongReport> spLatLongReport; // Get the ILatLongReport interface from ILocationReport if ((SUCCEEDED(pLocationReport->QueryInterface(IID_PPV_ARGS(&spLatLongReport)))) && (NULL != spLatLongReport.p)) { // Print the Report Type GUID wchar_t szGUID[64]; wprintf(L"\nReportType: %s", GUIDToString(IID_ILatLongReport, szGUID, ARRAYSIZE(szGUID))); // Print the Timestamp and the time since the last report SYSTEMTIME systemTime; if (SUCCEEDED(spLatLongReport->GetTimestamp(&systemTime))) { // Compute the number of 100ns units that difference between the current report's time and the previous report's time. ULONGLONG currentTime = 0, diffTime = 0; if (TRUE == SystemTimeToFileTime(&systemTime, (FILETIME*)¤tTime)) { diffTime = (currentTime > m_previousTime) ? (currentTime - m_previousTime) : 0; } wprintf(L"\nTimestamp: YY:%d, MM:%d, DD:%d, HH:%d, MM:%d, SS:%d, MS:%d [%I64d]\n", systemTime.wYear, systemTime.wMonth, systemTime.wDay, systemTime.wHour, systemTime.wMinute, systemTime.wSecond, systemTime.wMilliseconds, diffTime / 10000); // Display in milliseconds m_previousTime = currentTime; // Set the previous time to the current time for the next report. } // Print the Sensor ID GUID GUID sensorID = {0}; if (SUCCEEDED(spLatLongReport->GetSensorID(&sensorID))) { wchar_t szGUID[64]; wprintf(L"SensorID: %s\n", GUIDToString(sensorID, szGUID, ARRAYSIZE(szGUID))); } DOUBLE latitude = 0, longitude = 0, altitude = 0, errorRadius = 0, altitudeError = 0; // Print the Latitude if (SUCCEEDED(spLatLongReport->GetLatitude(&latitude))) { wprintf(L"Latitude: %f\n", latitude); } // Print the Longitude if (SUCCEEDED(spLatLongReport->GetLongitude(&longitude))) { wprintf(L"Longitude: %f\n", longitude); } // Print the Altitude if (SUCCEEDED(spLatLongReport->GetAltitude(&altitude))) { wprintf(L"Altitude: %f\n", altitude); } else { // Altitude is optional and may not be available wprintf(L"Altitude: Not available.\n"); } // Print the Error Radius if (SUCCEEDED(spLatLongReport->GetErrorRadius(&errorRadius))) { wprintf(L"Error Radius: %f\n", errorRadius); } // Print the Altitude Error if (SUCCEEDED(spLatLongReport->GetAltitudeError(&altitudeError))) { wprintf(L"Altitude Error: %f\n", altitudeError); } else { // Altitude Error is optional and may not be available wprintf(L"Altitude Error: Not available.\n"); } } } return S_OK; }
/*************************************************************** * DMORegister (MSDMO.@) * * Register a DirectX Media Object. */ HRESULT WINAPI DMORegister( LPCWSTR szName, REFCLSID clsidDMO, REFGUID guidCategory, DWORD dwFlags, DWORD cInTypes, const DMO_PARTIAL_MEDIATYPE *pInTypes, DWORD cOutTypes, const DMO_PARTIAL_MEDIATYPE *pOutTypes ) { WCHAR szguid[64]; HRESULT hres; HKEY hrkey = 0; HKEY hkey = 0; HKEY hckey = 0; HKEY hclskey = 0; LONG ret; TRACE("%s %s %s\n", debugstr_w(szName), debugstr_guid(clsidDMO), debugstr_guid(guidCategory)); if (IsEqualGUID(guidCategory, &GUID_NULL)) return E_INVALIDARG; ret = RegCreateKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hrkey, NULL); if (ret) return HRESULT_FROM_WIN32(ret); /* Create clsidDMO key under MediaObjects */ ret = RegCreateKeyExW(hrkey, GUIDToString(szguid, clsidDMO), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, NULL); if (ret) goto lend; /* Set default Name value */ ret = RegSetValueExW(hkey, NULL, 0, REG_SZ, (const BYTE*) szName, (strlenW(szName) + 1) * sizeof(WCHAR)); /* Set InputTypes */ hres = write_types(hkey, szDMOInputType, pInTypes, cInTypes); /* Set OutputTypes */ hres = write_types(hkey, szDMOOutputType, pOutTypes, cOutTypes); if (dwFlags & DMO_REGISTERF_IS_KEYED) { /* Create Keyed key */ ret = RegCreateKeyExW(hkey, szDMOKeyed, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hckey, NULL); if (ret) goto lend; RegCloseKey(hckey); } /* Register the category */ ret = RegCreateKeyExW(hrkey, szDMOCategories, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hckey, NULL); if (ret) goto lend; RegCloseKey(hkey); ret = RegCreateKeyExW(hckey, GUIDToString(szguid, guidCategory), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkey, NULL); if (ret) goto lend; ret = RegCreateKeyExW(hkey, GUIDToString(szguid, clsidDMO), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hclskey, NULL); if (ret) goto lend; lend: if (hkey) RegCloseKey(hkey); if (hckey) RegCloseKey(hckey); if (hclskey) RegCloseKey(hclskey); if (hrkey) RegCloseKey(hrkey); hres = HRESULT_FROM_WIN32(ret); TRACE(" hresult=0x%08x\n", hres); return hres; }
void ofxGuiImage::drawInfo() { int i = 0; int textHeight = mGlobals->mParamFont.stringHeight( "foo" ); glColor4f( 0.9f, 0.9f, 0.9f, 1.0f ); drawHighlightParamString( PARAM_TEXT_OFFSET_X, mCtrHeight - PARAM_TEXT_OFFSET_X - ++i * textHeight, "GUID: " + GUIDToString( pCam->getCameraGUID()), false ); drawHighlightParamString( PARAM_TEXT_OFFSET_X, mCtrHeight - PARAM_TEXT_OFFSET_X - ++i * textHeight, "Camera resolution: " + ofToString( (int)mCamWidth ) + "x" + ofToString( (int)mCamHeight ), false ); drawHighlightParamString( PARAM_TEXT_OFFSET_X, mCtrHeight - PARAM_TEXT_OFFSET_X - ++i * textHeight, "Type: " + pCam->getBaseCameraTypeName(), false ); }
/************************************************************************** * IEnumDMO_Constructor */ static HRESULT IEnumDMO_Constructor( REFGUID guidCategory, DWORD dwFlags, DWORD cInTypes, const DMO_PARTIAL_MEDIATYPE *pInTypes, DWORD cOutTypes, const DMO_PARTIAL_MEDIATYPE *pOutTypes, IEnumDMO **obj) { IEnumDMOImpl* lpedmo; HRESULT hr; LONG ret; *obj = NULL; lpedmo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumDMOImpl)); if (!lpedmo) return E_OUTOFMEMORY; lpedmo->IEnumDMO_iface.lpVtbl = &edmovt; lpedmo->ref = 1; lpedmo->index = -1; lpedmo->category = *guidCategory; lpedmo->dwFlags = dwFlags; lpedmo->cInTypes = cInTypes; lpedmo->cOutTypes = cOutTypes; hr = dup_partial_mediatype(pInTypes, cInTypes, &lpedmo->pInTypes); if (FAILED(hr)) goto lerr; hr = dup_partial_mediatype(pOutTypes, cOutTypes, &lpedmo->pOutTypes); if (FAILED(hr)) goto lerr; /* If not filtering by category enum from media objects root */ if (IsEqualGUID(guidCategory, &GUID_NULL)) { if ((ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, szDMORootKey, 0, KEY_READ, &lpedmo->hkey))) hr = HRESULT_FROM_WIN32(ret); } else { WCHAR szguid[64]; WCHAR szKey[MAX_PATH]; wsprintfW(szKey, szCat3Fmt, szDMORootKey, szDMOCategories, GUIDToString(szguid, guidCategory)); if ((ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, szKey, 0, KEY_READ, &lpedmo->hkey))) hr = HRESULT_FROM_WIN32(ret); } lerr: if (FAILED(hr)) IEnumDMO_Release(&lpedmo->IEnumDMO_iface); else { TRACE("returning %p\n", lpedmo); *obj = &lpedmo->IEnumDMO_iface; } return hr; }