From 110cacd2e785f63ce69fa254a81b2b28b9dcd6f0 Mon Sep 17 00:00:00 2001 From: yunhanw Date: Wed, 29 Jul 2020 10:22:55 -0700 Subject: [PATCH] Add Chip Over Bluez Implementation -- Implement CHIPBluezHelper based upon the Thread Bluez Gio code from openthread. -- Implement BLEManager and corresponding state machine and event handling module. -- Implement TestCHIPoBLEStackMgr test -- Current code suport CHIPoBLE peripheral mode. -- Validated via repeatedly creating BLE connection, CHIP BTP communication via characteristic C1 and C2 Fix #2025 --- src/ble/BLEEndPoint.cpp | 3 + src/include/platform/CHIPDeviceConfig.h | 2 +- src/platform/Linux/BLEManagerImpl.cpp | 496 +- src/platform/Linux/BLEManagerImpl.h | 121 +- src/platform/Linux/BlePlatformConfig.h | 4 - src/platform/Linux/CHIPBluezHelper.cpp | 1753 ++ src/platform/Linux/CHIPBluezHelper.h | 206 + src/platform/Linux/CHIPDevicePlatformEvent.h | 31 +- src/platform/Linux/dbus/DbusBluez.c | 20468 ++++++++++++++++ src/platform/Linux/dbus/DbusBluez.h | 2230 ++ src/platform/Linux/dbus/org.bluez.xml | 53 +- src/platform/Makefile.am | 1 + src/platform/tests/Makefile.am | 25 + src/platform/tests/TestCHIPoBLEStackMgr.cpp | 68 + src/platform/tests/TestCHIPoBLEStackMgr.h | 30 + .../tests/TestCHIPoBLEStackMgrDriver.cpp | 25 + 16 files changed, 25438 insertions(+), 78 deletions(-) create mode 100644 src/platform/Linux/CHIPBluezHelper.cpp create mode 100644 src/platform/Linux/CHIPBluezHelper.h create mode 100644 src/platform/Linux/dbus/DbusBluez.c create mode 100644 src/platform/Linux/dbus/DbusBluez.h create mode 100644 src/platform/tests/TestCHIPoBLEStackMgr.cpp create mode 100644 src/platform/tests/TestCHIPoBLEStackMgr.h create mode 100644 src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp diff --git a/src/ble/BLEEndPoint.cpp b/src/ble/BLEEndPoint.cpp index 78d9058e67d682..f4bec7b1f10066 100644 --- a/src/ble/BLEEndPoint.cpp +++ b/src/ble/BLEEndPoint.cpp @@ -765,6 +765,8 @@ BLE_ERROR BLEEndPoint::SendNextMessage() VerifyOrExit(PrepareNextFragment(data, sentAck), err = BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT); data = NULL; // Ownership passed to fragmenter's tx buf on PrepareNextFragment success. + /* + // Todo: reenabled it after integrating fault injection // Send first message fragment over the air. CHIP_FAULT_INJECT(chip::FaultInjection::kFault_CHIPOBLESend, { if (mRole == kBleRole_Central) @@ -777,6 +779,7 @@ BLE_ERROR BLEEndPoint::SendNextMessage() } ExitNow(); }); + */ err = SendCharacteristic(mBtpEngine.TxPacket()); SuccessOrExit(err); diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index 72912612221746..8aa3ce36e96082 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -324,7 +324,7 @@ * Enable support for chip-over-BLE (CHIPoBLE). */ #ifndef CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 +#define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0 #endif /** diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index c6f7126a7f7806..99130005f57b38 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -26,24 +26,53 @@ #include #include #include +#include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#include "CHIPBluezHelper.h" + using namespace ::nl; -using namespace ::nl::Ble; +using namespace ::chip::Ble; namespace chip { namespace DeviceLayer { namespace Internal { +namespace { +const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, + 0x00, 0x10, 0x00, 0x00, 0xAF, 0xFE, 0x00, 0x00 }; +const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, + 0x9D, 0x11 } }; +const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, + 0x9D, 0x12 } }; + +} // namespace + BLEManagerImpl BLEManagerImpl::sInstance; +void HandleIncomingBleConnection(BLEEndPoint * bleEP) +{ + ChipLogProgress(DeviceLayer, "CHIPoBluez con rcvd"); +} + CHIP_ERROR BLEManagerImpl::_Init() { CHIP_ERROR err; - // Initialize the CHIP BleLayer. + err = BleLayer::Init(this, this, &SystemLayer); SuccessOrExit(err); + + mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled; + mFlags = kFlag_AdvertisingEnabled; + mAppState = NULL; + + memset(mDeviceName, 0, sizeof(mDeviceName)); + + OnChipBleConnectReceived = HandleIncomingBleConnection; + + PlatformMgr().ScheduleWork(DriveBLEState, 0); + exit: return err; } @@ -51,7 +80,16 @@ CHIP_ERROR BLEManagerImpl::_Init() CHIP_ERROR BLEManagerImpl::_SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val) { CHIP_ERROR err = CHIP_NO_ERROR; - ChipLogProgress(DeviceLayer, "%s: %d", __FUNCTION__, val); + + VerifyOrExit(val != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrExit(mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + + if (val != mServiceMode) + { + mServiceMode = val; + PlatformMgr().ScheduleWork(DriveBLEState, 0); + } + exit: return err; } @@ -59,7 +97,14 @@ CHIP_ERROR BLEManagerImpl::_SetCHIPoBLEServiceMode(CHIPoBLEServiceMode val) CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val) { CHIP_ERROR err = CHIP_NO_ERROR; - ChipLogProgress(DeviceLayer, "%s: %d", __FUNCTION__, val); + + if (GetFlag(mFlags, kFlag_AdvertisingEnabled) != val) + { + SetFlag(mFlags, kFlag_AdvertisingEnabled, val); + } + + PlatformMgr().ScheduleWork(DriveBLEState, 0); + exit: return err; } @@ -67,7 +112,15 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val) CHIP_ERROR BLEManagerImpl::_SetFastAdvertisingEnabled(bool val) { CHIP_ERROR err = CHIP_NO_ERROR; - ChipLogProgress(DeviceLayer, "%s: %d", __FUNCTION__, val); + + VerifyOrExit(mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); + + if (GetFlag(mFlags, kFlag_FastAdvertisingEnabled) != val) + { + SetFlag(mFlags, kFlag_FastAdvertisingEnabled, val); + PlatformMgr().ScheduleWork(DriveBLEState, 0); + } + exit: return err; } @@ -79,6 +132,7 @@ CHIP_ERROR BLEManagerImpl::_GetDeviceName(char * buf, size_t bufSize) return CHIP_ERROR_BUFFER_TOO_SMALL; } strcpy(buf, mDeviceName); + return CHIP_NO_ERROR; } @@ -102,15 +156,439 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName) mDeviceName[0] = 0; ClearFlag(mFlags, kFlag_UseCustomDeviceName); } + return CHIP_NO_ERROR; } -void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) {} - uint16_t BLEManagerImpl::_NumConnections(void) { - ChipLogProgress(DeviceLayer, "%s", __FUNCTION__); - return 0; + uint16_t numCons = 0; + return numCons; +} + +CHIP_ERROR BLEManagerImpl::ConfigureBle(uint32_t aNodeId, bool aIsCentral) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + mBLEAdvConfig.mpBleName = mDeviceName; + mBLEAdvConfig.mNodeId = aNodeId; + mBLEAdvConfig.mMajor = 1; + mBLEAdvConfig.mMinor = 1; + mBLEAdvConfig.mVendorId = 1; + mBLEAdvConfig.mProductId = 1; + mBLEAdvConfig.mDeviceId = 1; + mBLEAdvConfig.mDuration = 2; + mBLEAdvConfig.mPairingStatus = 0; + mBLEAdvConfig.mType = ChipAdvType::BLUEZ_ADV_TYPE_UNDIRECTED_CONNECTABLE_SCANNABLE; + mBLEAdvConfig.mpAdvertisingUUID = "0xFEAF"; + + mpBleAddr = NULL; + mIsCentral = aIsCentral; + +exit: + return err; +} + +CHIP_ERROR BLEManagerImpl::StartBLEAdvertising(void) +{ + return StartBluezAdv(mpAppState); +} + +CHIP_ERROR BLEManagerImpl::StopBLEAdvertising(void) +{ + return StopBluezAdv(mpAppState); +} + +void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) +{ + switch (event->Type) + { + case DeviceEventType::kCHIPoBLESubscribe: + HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + { + ChipDeviceEvent connectionEvent; + connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; + PlatformMgr().PostEvent(&connectionEvent); + } + break; + + case DeviceEventType::kCHIPoBLEUnsubscribe: + HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + break; + + case DeviceEventType::kCHIPoBLEWriteReceived: + HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, + event->CHIPoBLEWriteReceived.Data); + break; + + case DeviceEventType::kCHIPoBLEIndicateConfirm: + HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); + break; + + case DeviceEventType::kCHIPoBLEConnectionError: + HandleConnectionError(event->CHIPoBLEConnectionError.ConId, event->CHIPoBLEConnectionError.Reason); + break; + case DeviceEventType::kFabricMembershipChange: + case DeviceEventType::kServiceProvisioningChange: + case DeviceEventType::kAccountPairingChange: + + // If CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, and there is a change to the + // device's provisioning state, then automatically disable CHIPoBLE advertising if the device + // is now fully provisioned. +#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED + if (ConfigurationMgr().IsFullyProvisioned()) + { + ClearFlag(mFlags, kFlag_AdvertisingEnabled); + ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); + } +#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED + + // Force the advertising configuration to be refreshed to reflect new provisioning state. + ClearFlag(mFlags, kFlag_AdvertisingConfigured); + + DriveBLEState(); + + default: + break; + } + + HandlePlatformSpecificBLEEvent(event); +} + +void BLEManagerImpl::HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * apEvent) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + bool controlOpComplete = false; + ChipLogProgress(DeviceLayer, "HandlePlatformSpecificBLEEvent , %d", apEvent->Type); + switch (apEvent->Type) + { + case DeviceEventType::kPlatformLinuxBLEPeripheralAdvConfiguredComplete: + VerifyOrExit(apEvent->Platform.BLEPeripheralAdvConfiguredComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE); + SetFlag(sInstance.mFlags, kFlag_AdvertisingConfigured); + ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress); + controlOpComplete = true; + ChipLogProgress(DeviceLayer, "CHIPoBLE advertising config complete"); + break; + case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete: + VerifyOrExit(apEvent->Platform.BLEPeripheralAdvStartComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE); + ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress); + ClearFlag(sInstance.mFlags, kFlag_AdvertisingRefreshNeeded); + + if (!GetFlag(sInstance.mFlags, kFlag_Advertising)) + { + SetFlag(sInstance.mFlags, kFlag_Advertising); + } + + break; + case DeviceEventType::kPlatformLinuxBLEPeripheralAdvStopComplete: + VerifyOrExit(apEvent->Platform.BLEPeripheralAdvStopComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE); + + ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress); + ClearFlag(sInstance.mFlags, kFlag_AdvertisingRefreshNeeded); + + // Transition to the not Advertising state... + if (GetFlag(sInstance.mFlags, kFlag_Advertising)) + { + ClearFlag(sInstance.mFlags, kFlag_Advertising); + ChipLogProgress(DeviceLayer, "CHIPoBLE advertising stopped"); + } + break; + case DeviceEventType::kPlatformLinuxBLEPeripheralRegisterAppComplete: + VerifyOrExit(apEvent->Platform.BLEPeripheralRegisterAppComplete.mIsSuccess, err = CHIP_ERROR_INCORRECT_STATE); + SetFlag(mFlags, kFlag_AppRegistered); + controlOpComplete = true; + break; + default: + break; + } + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %s", ErrorStr(err)); + mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled; + ClearFlag(sInstance.mFlags, kFlag_ControlOpInProgress); + } + + if (controlOpComplete) + { + ClearFlag(mFlags, kFlag_ControlOpInProgress); + DriveBLEState(); + } +} + +uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const +{ + BluezConnection * con = static_cast(conId); + return (con != NULL) ? con->mMtu : 0; +} + +bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +{ + ChipLogError(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); + return true; +} + +bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) +{ + ChipLogError(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); + return true; +} + +bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) +{ + BluezConnection * con = static_cast(conId); + ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %u)", conId); + return CloseBluezConnection(con); +} + +bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + chip::System::PacketBuffer * pBuf) +{ + return SendBluezIndication((void *) conId, pBuf); +} + +bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + chip::System::PacketBuffer * pBuf) +{ + ChipLogError(Ble, "SendWriteRequest: Not implemented"); + return true; +} + +bool BLEManagerImpl::SendReadRequest(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId, + chip::System::PacketBuffer * pBuf) +{ + ChipLogError(Ble, "SendReadRequest: Not implemented"); + return true; +} + +bool BLEManagerImpl::SendReadResponse(BLE_CONNECTION_OBJECT conId, BLE_READ_REQUEST_CONTEXT requestContext, + const Ble::ChipBleUUID * svcId, const Ble::ChipBleUUID * charId) +{ + ChipLogError(Ble, "SendReadRBluezonse: Not implemented"); + return true; +} + +void BLEManagerImpl::CHIPoBluez_NewConnection(void * data) +{ + ChipLogProgress(Ble, "CHIPoBluez_NewConnection: %p", data); +} + +void BLEManagerImpl::HandleRXCharWrite(void * data, const uint8_t * value, size_t len) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + PacketBuffer * buf = NULL; + + // Copy the data to a PacketBuffer. + buf = PacketBuffer::New(); + VerifyOrExit(buf != NULL, err = CHIP_ERROR_NO_MEMORY); + VerifyOrExit(buf->AvailableDataLength() >= len, err = CHIP_ERROR_BUFFER_TOO_SMALL); + memcpy(buf->Start(), value, len); + buf->SetDataLength(len); + + // Post an event to the Chip queue to deliver the data into the Chip stack. + { + ChipDeviceEvent event; + event.Type = DeviceEventType::kCHIPoBLEWriteReceived; + ChipLogProgress(Ble, "Write request received debug %p", data); + event.CHIPoBLEWriteReceived.ConId = data; + event.CHIPoBLEWriteReceived.Data = buf; + PlatformMgr().PostEvent(&event); + buf = NULL; + } + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "HandleRXCharWrite() failed: %s", ErrorStr(err)); + } + + if (NULL != buf) + { + chip::System::PacketBuffer::Free(buf); + } +} + +void BLEManagerImpl::CHIPoBluez_ConnectionClosed(void * data) +{ + ChipLogProgress(DeviceLayer, "Bluez notify CHIPoBluez connection disconnected"); + + // If this was a CHIPoBLE connection, post an event to deliver a connection error to the CHIPoBLE layer. + { + ChipDeviceEvent event; + event.Type = DeviceEventType::kCHIPoBLEConnectionError; + event.CHIPoBLEConnectionError.ConId = data; + event.CHIPoBLEConnectionError.Reason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED; + PlatformMgr().PostEvent(&event); + } +} + +void BLEManagerImpl::HandleTXCharCCCDWrite(void * data) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + BluezConnection * connection = static_cast(data); + const char * msg = NULL; + + VerifyOrExit(connection != NULL, msg = "Connection is NULL in HandleTXCharCCCDWrite"); + VerifyOrExit(connection->mpC2 != NULL, msg = "C2 is NULL in HandleTXCharCCCDWrite"); + + // Post an event to the Chip queue to process either a CHIPoBLE Subscribe or Unsubscribe based on + // whether the client is enabling or disabling indications. + { + ChipDeviceEvent event; + event.Type = (connection->mIsNotify) ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe; + event.CHIPoBLESubscribe.ConId = data; + PlatformMgr().PostEvent(&event); + } + + ChipLogProgress(DeviceLayer, "CHIPoBLE %s received", (connection->mIsNotify) ? "subscribe" : "unsubscribe"); + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "HandleTXCharCCCDWrite() failed: %s", ErrorStr(err)); + // TODO: fail connection + } +} + +void BLEManagerImpl::HandleTXComplete(void * data) +{ + // Post an event to the Chip queue to process the indicate confirmation. + ChipDeviceEvent event; + event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; + event.CHIPoBLEIndicateConfirm.ConId = data; + PlatformMgr().PostEvent(&event); +} + +void BLEManagerImpl::DriveBLEState() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + + // Perform any initialization actions that must occur after the Chip task is running. + if (!GetFlag(mFlags, kFlag_AsyncInitCompleted)) + { + SetFlag(mFlags, kFlag_AsyncInitCompleted); + + // If CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED is enabled, + // disable CHIPoBLE advertising if the device is fully provisioned. +#if CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED + if (ConfigurationMgr().IsFullyProvisioned()) + { + ClearFlag(mFlags, kFlag_AdvertisingEnabled); + ChipLogProgress(DeviceLayer, "CHIPoBLE advertising disabled because device is fully provisioned"); + } +#endif // CHIP_DEVICE_CONFIG_CHIPOBLE_DISABLE_ADVERTISING_WHEN_PROVISIONED + ExitNow(); + } + + // If there's already a control operation in progress, wait until it completes. + VerifyOrExit(!GetFlag(mFlags, kFlag_ControlOpInProgress), /* */); + + // Initializes the Bluez BLE layer if needed. + if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !GetFlag(mFlags, kFlag_BluezBLELayerInitialized)) + { + err = InitBluezBleLayer(false, NULL, mBLEAdvConfig, mpAppState); + SuccessOrExit(err); + SetFlag(mFlags, kFlag_BluezBLELayerInitialized); + } + + // Register the CHIPoBLE application with the Bluez BLE layer if needed. + if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && !GetFlag(mFlags, kFlag_AppRegistered)) + { + err = BluezGattsAppRegister(mpAppState); + SetFlag(mFlags, kFlag_ControlOpInProgress); + ExitNow(); + } + + // If the application has enabled CHIPoBLE and BLE advertising... + if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && GetFlag(mFlags, kFlag_AdvertisingEnabled)) + { + // Start/re-start advertising if not already advertising, or if the advertising state of the + // Bluez BLE layer needs to be refreshed. + if (!GetFlag(mFlags, kFlag_Advertising) || GetFlag(mFlags, kFlag_AdvertisingRefreshNeeded)) + { + // Configure advertising data if it hasn't been done yet. This is an asynchronous step which + // must complete before advertising can be started. When that happens, this method will + // be called again, and execution will proceed to the code below. + if (!GetFlag(mFlags, kFlag_AdvertisingConfigured)) + { + err = BluezAdvertisementSetup(mpAppState); + ExitNow(); + } + + // Start advertising. This is also an asynchronous step. + err = StartBLEAdvertising(); + SuccessOrExit(err); + + SetFlag(sInstance.mFlags, kFlag_Advertising); + ExitNow(); + } + } + + // Otherwise stop advertising if needed... + else + { + if (GetFlag(mFlags, kFlag_Advertising)) + { + err = StopBLEAdvertising(); + SuccessOrExit(err); + SetFlag(mFlags, kFlag_ControlOpInProgress); + + ExitNow(); + } + } + +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %s", ErrorStr(err)); + mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled; + } +} + +void BLEManagerImpl::DriveBLEState(intptr_t arg) +{ + sInstance.DriveBLEState(); +} + +void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) +{ + ChipLogRetain(Ble, "Got notification regarding chip connection closure"); +} + +void BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(bool aIsSuccess, void * apAppstate) +{ + ChipDeviceEvent event; + event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralRegisterAppComplete; + event.Platform.BLEPeripheralRegisterAppComplete.mIsSuccess = aIsSuccess; + event.Platform.BLEPeripheralRegisterAppComplete.mpAppstate = apAppstate; + PlatformMgr().PostEvent(&event); +} + +void BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(bool aIsSuccess, void * apAppstate) +{ + ChipDeviceEvent event; + event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvConfiguredComplete; + event.Platform.BLEPeripheralAdvConfiguredComplete.mIsSuccess = aIsSuccess; + event.Platform.BLEPeripheralAdvConfiguredComplete.mpAppstate = apAppstate; + PlatformMgr().PostEvent(&event); +} + +void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess, void * apAppstate) +{ + ChipDeviceEvent event; + event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete; + event.Platform.BLEPeripheralAdvStartComplete.mIsSuccess = aIsSuccess; + event.Platform.BLEPeripheralAdvStartComplete.mpAppstate = apAppstate; + PlatformMgr().PostEvent(&event); +} + +void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * apAppstate) +{ + ChipDeviceEvent event; + event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvStopComplete; + event.Platform.BLEPeripheralAdvStopComplete.mIsSuccess = aIsSuccess; + event.Platform.BLEPeripheralAdvStopComplete.mpAppstate = apAppstate; + PlatformMgr().PostEvent(&event); } } // namespace Internal diff --git a/src/platform/Linux/BLEManagerImpl.h b/src/platform/Linux/BLEManagerImpl.h index 4656bb07f47147..0018883d604e57 100644 --- a/src/platform/Linux/BLEManagerImpl.h +++ b/src/platform/Linux/BLEManagerImpl.h @@ -24,6 +24,8 @@ #ifndef BLE_MANAGER_IMPL_H #define BLE_MANAGER_IMPL_H +#include + #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE namespace chip { @@ -32,8 +34,42 @@ namespace Internal { using namespace chip::Ble; +void HandleIncomingBleConnection(BLEEndPoint * bleEP); + +enum ChipAdvType +{ + BLUEZ_ADV_TYPE_CONNECTABLE = 0x01, + BLUEZ_ADV_TYPE_SCANNABLE = 0x02, + BLUEZ_ADV_TYPE_DIRECTED = 0x04, + + BLUEZ_ADV_TYPE_UNDIRECTED_NONCONNECTABLE_NONSCANNABLE = 0, + BLUEZ_ADV_TYPE_UNDIRECTED_CONNECTABLE_NONSCANNABLE = BLUEZ_ADV_TYPE_CONNECTABLE, + BLUEZ_ADV_TYPE_UNDIRECTED_NONCONNECTABLE_SCANNABLE = BLUEZ_ADV_TYPE_SCANNABLE, + BLUEZ_ADV_TYPE_UNDIRECTED_CONNECTABLE_SCANNABLE = BLUEZ_ADV_TYPE_CONNECTABLE | BLUEZ_ADV_TYPE_SCANNABLE, + + BLUEZ_ADV_TYPE_DIRECTED_NONCONNECTABLE_NONSCANNABLE = BLUEZ_ADV_TYPE_DIRECTED, + BLUEZ_ADV_TYPE_DIRECTED_CONNECTABLE_NONSCANNABLE = BLUEZ_ADV_TYPE_DIRECTED | BLUEZ_ADV_TYPE_CONNECTABLE, + BLUEZ_ADV_TYPE_DIRECTED_NONCONNECTABLE_SCANNABLE = BLUEZ_ADV_TYPE_DIRECTED | BLUEZ_ADV_TYPE_SCANNABLE, + BLUEZ_ADV_TYPE_DIRECTED_CONNECTABLE_SCANNABLE = BLUEZ_ADV_TYPE_DIRECTED | BLUEZ_ADV_TYPE_CONNECTABLE | BLUEZ_ADV_TYPE_SCANNABLE, +}; + +struct BLEAdvConfig +{ + char * mpBleName; + uint32_t mNodeId; + uint8_t mMajor; + uint8_t mMinor; + uint16_t mVendorId; + uint16_t mProductId; + uint64_t mDeviceId; + uint8_t mPairingStatus; + ChipAdvType mType; + uint16_t mDuration; + char * mpAdvertisingUUID; +}; + /** - * Concrete implementation of the NetworkProvisioningServer singleton object for the Linux platforms. + * Concrete implementation of the BLEManagerImpl singleton object for the Linux platforms. */ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePlatformDelegate, private BleApplicationDelegate { @@ -42,10 +78,20 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla friend BLEManager; public: - // ===== Platform-specific members available for use by the application. + CHIP_ERROR ConfigureBle(uint32_t aNodeId, bool aIsCentral); + + // Driven by BlueZ IO + static void CHIPoBluez_NewConnection(void * user_data); + static void HandleRXCharWrite(void * user_data, const uint8_t * value, size_t len); + static void CHIPoBluez_ConnectionClosed(void * user_data); + static void HandleTXCharCCCDWrite(void * user_data); + static void HandleTXComplete(void * user_data); + static bool WoBLEz_TimerCb(void * user_data); - uint8_t GetAdvertisingHandle(void); - void SetAdvertisingHandle(uint8_t handle); + static void NotifyBLEPeripheralRegisterAppComplete(bool aIsSuccess, void * apAppstate); + static void NotifyBLEPeripheralAdvConfiguredComplete(bool aIsSuccess, void * apAppstate); + static void NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess, void * apAppstate); + static void NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * apAppstate); private: // ===== Members that implement the BLEManager internal interface. @@ -61,7 +107,9 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla CHIP_ERROR _GetDeviceName(char * buf, size_t bufSize); CHIP_ERROR _SetDeviceName(const char * deviceName); uint16_t _NumConnections(void); + void _OnPlatformEvent(const ChipDeviceEvent * event); + void HandlePlatformSpecificBLEEvent(const ChipDeviceEvent * event); BleLayer * _GetBleLayer(void) const; // ===== Members that implement virtual methods on BlePlatformDelegate. @@ -91,51 +139,40 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla static BLEManagerImpl sInstance; // ===== Private members reserved for use by this class only. - enum { - kFlag_AsyncInitCompleted = 0x0001, /**< One-time asynchronous initialization actions have been performed. */ - kFlag_AdvertisingEnabled = 0x0002, /**< The application has enabled CHIPoBLE advertising. */ - kFlag_FastAdvertisingEnabled = 0x0004, /**< The application has enabled fast advertising. */ - kFlag_Advertising = 0x0008, /**< The system is currently CHIPoBLE advertising. */ - kFlag_AdvertisingRefreshNeeded = - 0x0010, /**< The advertising state/configuration has changed, but the SoftDevice has yet to be updated. */ + kFlag_AsyncInitCompleted = 0x0001, /**< One-time asynchronous initialization actions have been performed. */ + kFlag_BluezBLELayerInitialized = 0x0002, /**< The Bluez layer has been initialized. */ + kFlag_AppRegistered = 0x0004, /**< The CHIPoBLE application has been registered with the Bluez layer. */ + kFlag_AdvertisingConfigured = 0x0008, /**< CHIPoBLE advertising has been configured in the Bluez layer. */ + kFlag_Advertising = 0x0010, /**< The system is currently CHIPoBLE advertising. */ + kFlag_ControlOpInProgress = 0x0020, /**< An async control operation has been issued to the ESP BLE layer. */ + kFlag_AdvertisingEnabled = 0x0040, /**< The application has enabled CHIPoBLE advertising. */ + kFlag_FastAdvertisingEnabled = 0x0080, /**< The application has enabled fast advertising. */ + kFlag_UseCustomDeviceName = 0x0100, /**< The application has configured a custom BLE device name. */ + kFlag_AdvertisingRefreshNeeded = 0x0200, /**< The advertising configuration/state in ESP BLE layer needs to be updated. */ }; enum { - kMaxConnections = MIN(BLE_LAYER_NUM_BLE_ENDPOINTS, NRF_SDH_BLE_PERIPHERAL_LINK_COUNT), + kMaxConnections = 1, // TODO: right max connection kMaxDeviceNameLength = 20, // TODO: right-size this kMaxAdvertismentDataSetSize = 31 // TODO: verify this }; - ble_gatts_char_handles_t mCHIPoBLECharHandle_RX; - ble_gatts_char_handles_t mCHIPoBLECharHandle_TX; - CHIPoBLEServiceMode mServiceMode; - uint16_t mFlags; - uint16_t mNumGAPCons; - uint16_t mSubscribedConIds[kMaxConnections]; - uint8_t mAdvHandle; - uint8_t mAdvDataBuf[kMaxAdvertismentDataSetSize]; - uint8_t mScanRespDataBuf[kMaxAdvertismentDataSetSize]; - - void DriveBLEState(void); - CHIP_ERROR ConfigureAdvertising(void); - CHIP_ERROR EncodeAdvertisingData(ble_gap_adv_data_t & gapAdvData); - CHIP_ERROR StartAdvertising(void); - CHIP_ERROR StopAdvertising(void); - void HandleSoftDeviceBLEEvent(const ChipDeviceEvent * event); - CHIP_ERROR HandleGAPConnect(const ChipDeviceEvent * event); - CHIP_ERROR HandleGAPDisconnect(const ChipDeviceEvent * event); - CHIP_ERROR HandleRXCharWrite(const ChipDeviceEvent * event); - CHIP_ERROR HandleTXCharCCCDWrite(const ChipDeviceEvent * event); - CHIP_ERROR HandleTXComplete(const ChipDeviceEvent * event); - CHIP_ERROR SetSubscribed(uint16_t conId); - bool UnsetSubscribed(uint16_t conId); - bool IsSubscribed(uint16_t conId); + CHIP_ERROR StartBLEAdvertising(void); + CHIP_ERROR StopBLEAdvertising(void); + void DriveBLEState(); static void DriveBLEState(intptr_t arg); - static void SoftDeviceBLEEventCallback(const ble_evt_t * bleEvent, void * context); + + CHIPoBLEServiceMode mServiceMode; + BLEAdvConfig mBLEAdvConfig; + uint16_t mFlags; + char mDeviceName[kMaxDeviceNameLength + 1]; + bool mIsCentral; + char * mpBleAddr; + void * mpAppState; }; /** @@ -160,16 +197,6 @@ inline BLEManagerImpl & BLEMgrImpl(void) return BLEManagerImpl::sInstance; } -inline uint8_t BLEManagerImpl::GetAdvertisingHandle(void) -{ - return mAdvHandle; -} - -inline void BLEManagerImpl::SetAdvertisingHandle(uint8_t handle) -{ - mAdvHandle = handle; -} - inline BleLayer * BLEManagerImpl::_GetBleLayer() const { return (BleLayer *) (this); diff --git a/src/platform/Linux/BlePlatformConfig.h b/src/platform/Linux/BlePlatformConfig.h index 738e9339b4f330..cc92ce348d981b 100644 --- a/src/platform/Linux/BlePlatformConfig.h +++ b/src/platform/Linux/BlePlatformConfig.h @@ -27,10 +27,6 @@ // ==================== Platform Adaptations ==================== -#define BLE_CONNECTION_OBJECT uint16_t -#define BLE_CONNECTION_UNINITIALIZED ((uint16_t) -1) -#define BLE_MAX_RECEIVE_WINDOW_SIZE 5 - // ========== Platform-specific Configuration Overrides ========= /* none so far */ diff --git a/src/platform/Linux/CHIPBluezHelper.cpp b/src/platform/Linux/CHIPBluezHelper.cpp new file mode 100644 index 00000000000000..feb367832093aa --- /dev/null +++ b/src/platform/Linux/CHIPBluezHelper.cpp @@ -0,0 +1,1753 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Copyright (c) 2016-2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * Provides Bluez dbus implementatioon for BLE + */ + +#include +#include +#include + +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#include +#include +#include +#include +#include + +#include "CHIPBluezHelper.h" +#include + +using namespace ::nl; + +namespace chip { +namespace DeviceLayer { +namespace Internal { + +static int sBluezFD[2]; +static GMainLoop * sBluezMainLoop = NULL; +static pthread_t sBluezThread; +static BluezConnection * GetBluezConnectionViaDevice(BluezEndpoint * apEndpoint); +static BluezConnection * BluezCharacteristicGetBluezConnection(BluezGattCharacteristic1 * aChar, GVariant * aOptions, + BluezEndpoint * apEndpoint); + +static gboolean BluezAdvertisingRelease(BluezLEAdvertisement1 * aAdv, GDBusMethodInvocation * aInvocation, gpointer apClosure) +{ + bool isSuccess = false; + BluezEndpoint * endpoint = static_cast(apClosure); + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + VerifyOrExit(aAdv != NULL, ChipLogProgress(DeviceLayer, "BluezLEAdvertisement1 is NULL in %s", __func__)); + ChipLogProgress(DeviceLayer, "Release adv object in %s", __func__); + + g_dbus_object_manager_server_unexport(endpoint->mpRoot, endpoint->mpAdvPath); + endpoint->mIsAdvertising = false; + isSuccess = true; +exit: + + return isSuccess ? TRUE : FALSE; +} + +static BluezLEAdvertisement1 * BluezAdvertisingCreate(BluezEndpoint * apEndpoint) +{ + BluezLEAdvertisement1 * adv = NULL; + BluezObjectSkeleton * object; + GVariant * serviceData; + gchar * localName; + GVariantBuilder serviceDataBuilder; + GVariantBuilder serviceUUIDsBuilder; + uint16_t offset; + char * debugStr; + const gchar * array[1]; + + VerifyOrExit(apEndpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + if (apEndpoint->mpAdvPath == NULL) + apEndpoint->mpAdvPath = g_strdup_printf("%s/advertising", apEndpoint->mpRootPath); + + array[0] = g_strdup_printf("%s", apEndpoint->mpAdvertisingUUID); + + ChipLogProgress(DeviceLayer, "Create adv object at %s", apEndpoint->mpAdvPath); + object = bluez_object_skeleton_new(apEndpoint->mpAdvPath); + + adv = bluez_leadvertisement1_skeleton_new(); + + g_variant_builder_init(&serviceDataBuilder, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&serviceUUIDsBuilder, G_VARIANT_TYPE("as")); + offset = 0; + + g_variant_builder_add( + &serviceDataBuilder, "{sv}", apEndpoint->mpAdvertisingUUID, + g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, apEndpoint->mpChipServiceData, sizeof(CHIPServiceData), sizeof(uint8_t))); + g_variant_builder_add(&serviceUUIDsBuilder, "s", apEndpoint->mpAdvertisingUUID); + + if (apEndpoint->mpAdapterName != NULL) + localName = g_strdup_printf("%s", apEndpoint->mpAdapterName); + else + localName = g_strdup_printf("%s%04x", CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, getpid() & 0xffff); + + serviceData = g_variant_builder_end(&serviceDataBuilder); + debugStr = g_variant_print(serviceData, TRUE); + ChipLogProgress(DeviceLayer, "SET service data to %s", debugStr); + g_free(debugStr); + + bluez_leadvertisement1_set_type_(adv, (apEndpoint->mType & BLUEZ_ADV_TYPE_CONNECTABLE) ? "peripheral" : "broadcast"); + // empty manufacturer data + // empty solicit UUIDs + bluez_leadvertisement1_set_service_data(adv, serviceData); + // empty data + + bluez_leadvertisement1_set_discoverable(adv, (apEndpoint->mType & BLUEZ_ADV_TYPE_SCANNABLE) ? TRUE : FALSE); + + // advertising name corresponding to the PID and object path, for debug purposes + bluez_leadvertisement1_set_local_name(adv, localName); + bluez_leadvertisement1_set_service_uuids(adv, array); + + // 0xffff means no appearance + bluez_leadvertisement1_set_appearance(adv, 0xffff); + + bluez_leadvertisement1_set_duration(adv, apEndpoint->mDuration); + // empty duration, we don't have a clear notion what it would mean to timeslice between toble and anyone else + bluez_leadvertisement1_set_timeout(adv, 0); + // empty secondary channel for now + + bluez_object_skeleton_set_leadvertisement1(object, adv); + g_signal_connect(adv, "handle-release", G_CALLBACK(BluezAdvertisingRelease), apEndpoint); + + g_dbus_object_manager_server_export(apEndpoint->mpRoot, G_DBUS_OBJECT_SKELETON(object)); + g_object_unref(object); + + BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(true, NULL); + +exit: + return adv; +} + +static void BluezAdvStartDone(GObject * aObject, GAsyncResult * aResult, gpointer apClosure) +{ + BluezLEAdvertisingManager1 * advMgr = BLUEZ_LEADVERTISING_MANAGER1(aObject); + GError * error = NULL; + BluezEndpoint * endpoint = static_cast(apClosure); + gboolean success; + + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + success = bluez_leadvertising_manager1_call_register_advertisement_finish(advMgr, aResult, &error); + if (success == FALSE) + { + g_dbus_object_manager_server_unexport(endpoint->mpRoot, endpoint->mpAdvPath); + } + VerifyOrExit(success == TRUE, ChipLogProgress(DeviceLayer, "FAIL: RegisterAdvertisement : %s", error->message)); + + endpoint->mIsAdvertising = true; + + ChipLogProgress(DeviceLayer, "RegisterAdvertisement complete"); + +exit: + BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(success == TRUE ? true : false, NULL); + if (error != NULL) + g_error_free(error); +} + +static void BluezAdvStopDone(GObject * aObject, GAsyncResult * aResult, gpointer apClosure) +{ + BluezLEAdvertisingManager1 * advMgr = BLUEZ_LEADVERTISING_MANAGER1(aObject); + BluezEndpoint * endpoint = static_cast(apClosure); + GError * error = NULL; + gboolean success; + + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + success = bluez_leadvertising_manager1_call_unregister_advertisement_finish(advMgr, aResult, &error); + + if (success == FALSE) + { + g_dbus_object_manager_server_unexport(endpoint->mpRoot, endpoint->mpAdvPath); + } + else + { + endpoint->mIsAdvertising = false; + } + + VerifyOrExit(success == TRUE, ChipLogProgress(DeviceLayer, "FAIL: UnregisterAdvertisement : %s", error->message)); + + ChipLogProgress(DeviceLayer, "UnregisterAdvertisement complete"); + +exit: + BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(success == TRUE ? true : false, NULL); + if (error != NULL) + g_error_free(error); +} + +static gboolean BluezAdvSetup(void * apClosure) +{ + GDBusObject * adapter; + BluezEndpoint * endpoint = static_cast(apClosure); + BluezLEAdvertisingManager1 * advMgr = NULL; + GVariantBuilder optionsBuilder; + GVariant * options; + BluezLEAdvertisement1 * adv; + + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + VerifyOrExit(endpoint->mIsAdvertising == FALSE, + ChipLogProgress(DeviceLayer, "FAIL: Advertising already enabled in %s", __func__)); + VerifyOrExit(endpoint->mpAdapter != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__)); + + adv = BluezAdvertisingCreate(endpoint); + VerifyOrExit(adv != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL adv in %s", __func__)); + +exit: + return G_SOURCE_REMOVE; +} + +static gboolean BluezAdvStart(void * apClosure) +{ + GDBusObject * adapter; + BluezLEAdvertisingManager1 * advMgr = NULL; + GVariantBuilder optionsBuilder; + GVariant * options; + BluezLEAdvertisement1 * adv; + BluezEndpoint * endpoint = static_cast(apClosure); + + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + VerifyOrExit(!endpoint->mIsAdvertising, + ChipLogProgress(DeviceLayer, "FAIL: Advertising has already been enabled in %s", __func__)); + VerifyOrExit(endpoint->mpAdapter != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__)); + + adapter = g_dbus_interface_get_object(G_DBUS_INTERFACE(endpoint->mpAdapter)); + VerifyOrExit(adapter != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL adapter in %s", __func__)); + + advMgr = bluez_object_get_leadvertising_manager1(BLUEZ_OBJECT(adapter)); + VerifyOrExit(advMgr != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL advMgr in %s", __func__)); + + g_variant_builder_init(&optionsBuilder, G_VARIANT_TYPE("a{sv}")); + options = g_variant_builder_end(&optionsBuilder); + + bluez_leadvertising_manager1_call_register_advertisement(advMgr, endpoint->mpAdvPath, options, NULL, BluezAdvStartDone, + apClosure); + +exit: + return G_SOURCE_REMOVE; +} + +static gboolean BluezAdvStop(void * apClosure) +{ + GDBusObject * adapter; + BluezEndpoint * endpoint = static_cast(apClosure); + BluezLEAdvertisingManager1 * advMgr = NULL; + GVariantBuilder optionsBuilder; + GVariant * options; + BluezLEAdvertisement1 * adv; + + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + VerifyOrExit(endpoint->mIsAdvertising, + ChipLogProgress(DeviceLayer, "FAIL: Advertising has already been disabled in %s", __func__)); + VerifyOrExit(endpoint->mpAdapter != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__)); + + adapter = g_dbus_interface_get_object(G_DBUS_INTERFACE(endpoint->mpAdapter)); + VerifyOrExit(adapter != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL adapter in %s", __func__)); + + advMgr = bluez_object_get_leadvertising_manager1(BLUEZ_OBJECT(adapter)); + VerifyOrExit(advMgr != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL advMgr in %s", __func__)); + + g_variant_builder_init(&optionsBuilder, G_VARIANT_TYPE("a{sv}")); + options = g_variant_builder_end(&optionsBuilder); + + bluez_leadvertising_manager1_call_unregister_advertisement(advMgr, endpoint->mpAdvPath, NULL, BluezAdvStopDone, apClosure); + +exit: + return G_SOURCE_REMOVE; +} + +static gboolean BluezCharacteristicReadValue(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + GVariant * aOptions) +{ + GVariant * val; + ChipLogProgress(DeviceLayer, "Received BluezCharacteristicReadValue"); + val = (GVariant *) bluez_gatt_characteristic1_get_value(aChar); + bluez_gatt_characteristic1_complete_read_value(aChar, aInvocation, val); + return TRUE; +} + +static gboolean BluezCharacteristicWriteValue(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + GVariant * aValue, GVariant * aOptions, gpointer apClosure) +{ + const uint8_t * tmpBuf; + uint8_t * buf; + size_t len; + bool isSuccess = false; + BluezConnection * conn = NULL; + + BluezEndpoint * endpoint = static_cast(apClosure); + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + VerifyOrExit(aValue != NULL, ChipLogProgress(DeviceLayer, "aValue is NULL in %s", __func__)); + + conn = GetBluezConnectionViaDevice(endpoint); + VerifyOrExit(conn != NULL, + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No CHIP Bluez connection")); + + bluez_gatt_characteristic1_set_value(aChar, g_variant_ref(aValue)); + + tmpBuf = (uint8_t *) (g_variant_get_fixed_array(aValue, &len, sizeof(uint8_t))); + buf = (uint8_t *) (g_memdup(tmpBuf, len)); + + BLEManagerImpl::HandleRXCharWrite(conn, buf, len); + bluez_gatt_characteristic1_complete_write_value(aChar, aInvocation); + isSuccess = true; + +exit: + return isSuccess ? TRUE : FALSE; +} + +static gboolean BluezCharacteristicWriteValueError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + GVariant * aValue, GVariant * aOptions, gpointer apClosure) +{ + ChipLogProgress(DeviceLayer, "BluezCharacteristicWriteValueError"); + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotSupported", + "Write for characteristic is unsupported"); +exit: + return TRUE; +} + +static gboolean BluezCharacteristicWriteFD(GIOChannel * aChannel, GIOCondition aCond, gpointer apClosure) +{ + GVariant * newVal; + gchar * buf; + ssize_t len; + int fd; + bool isSuccess = false; + + BluezConnection * conn = static_cast(apClosure); + + VerifyOrExit(conn != NULL, ChipLogProgress(DeviceLayer, "No CHIP Bluez connection in %s", __func__)); + + VerifyOrExit(!(aCond & G_IO_HUP), ChipLogProgress(DeviceLayer, "INFO: socket disconnected in %s", __func__)); + VerifyOrExit(!(aCond & (G_IO_ERR | G_IO_NVAL)), ChipLogProgress(DeviceLayer, "INFO: socket error in %s", __func__)); + VerifyOrExit(aCond == G_IO_IN, ChipLogProgress(DeviceLayer, "FAIL: error in %s", __func__)); + + ChipLogProgress(DeviceLayer, "c1 %s mtu, %d", __func__, conn->mMtu); + + buf = (gchar *) (g_malloc(conn->mMtu)); + fd = g_io_channel_unix_get_fd(aChannel); + + len = read(fd, buf, conn->mMtu); + + VerifyOrExit(len > 0, ChipLogProgress(DeviceLayer, "FAIL: short read in %s (%d)", __func__, len)); + + newVal = g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, buf, len, sizeof(uint8_t)); + + bluez_gatt_characteristic1_set_value(conn->mpC1, newVal); + BLEManagerImpl::HandleRXCharWrite(conn, (uint8_t *) (buf), len); + isSuccess = true; + +exit: + return isSuccess ? TRUE : FALSE; +} + +static void Bluez_gatt_characteristic1_complete_acquire_write_with_fd(GDBusMethodInvocation * invocation, int fd, guint16 mtu) +{ + GUnixFDList * fd_list = g_unix_fd_list_new(); + int index; + + index = g_unix_fd_list_append(fd_list, fd, NULL); + + g_dbus_method_invocation_return_value_with_unix_fd_list(invocation, g_variant_new("(@hq)", g_variant_new_handle(index), mtu), + fd_list); +} + +static gboolean bluezCharacteristicDestroyFD(GIOChannel * aChannel, GIOCondition aCond, gpointer apClosure) +{ + return G_SOURCE_REMOVE; +} + +static gboolean BluezCharacteristicAcquireWrite(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + GVariant * aOptions, gpointer apClosure) +{ + int fds[2] = { -1, -1 }; + GIOChannel * channel; + char * errStr; + GVariantDict options; + bool isSuccess = false; + BluezConnection * conn = NULL; + + BluezEndpoint * endpoint = static_cast(apClosure); + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + conn = GetBluezConnectionViaDevice(endpoint); + VerifyOrExit(conn != NULL, + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No Chipoble connection")); + + ChipLogProgress(DeviceLayer, "BluezCharacteristicAcquireWrite is called, conn: %p", conn); + + if (socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, 0, fds) < 0) + { + errStr = strerror(errno); + ChipLogProgress(DeviceLayer, "FAIL: socketpair: %s in %s", errStr, __func__); + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "FD creation failed"); + SuccessOrExit(false); + } + + g_variant_dict_init(&options, aOptions); + if (g_variant_dict_contains(&options, "mtu") == TRUE) + { + GVariant * v = g_variant_dict_lookup_value(&options, "mtu", G_VARIANT_TYPE_UINT16); + conn->mMtu = g_variant_get_uint16(v); + } + else + { + ChipLogProgress(DeviceLayer, "FAIL: no MTU in options in %s", __func__); + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.InvalidArguments", "MTU negotiation failed"); + SuccessOrExit(false); + } + + channel = g_io_channel_unix_new(fds[0]); + g_io_channel_set_encoding(channel, NULL, NULL); + g_io_channel_set_close_on_unref(channel, TRUE); + g_io_channel_set_buffered(channel, FALSE); + + conn->mC1Channel.mpChannel = channel; + conn->mC1Channel.mWatch = + g_io_add_watch(channel, (GIOCondition)(G_IO_HUP | G_IO_IN | G_IO_ERR | G_IO_NVAL), BluezCharacteristicWriteFD, conn); + + bluez_gatt_characteristic1_set_write_acquired(aChar, TRUE); + + Bluez_gatt_characteristic1_complete_acquire_write_with_fd(aInvocation, fds[1], conn->mMtu); + close(fds[1]); + isSuccess = true; + +exit: + return isSuccess ? TRUE : FALSE; +} + +static gboolean BluezCharacteristicAcquireWriteError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + GVariant * aOptions) +{ + ChipLogProgress(DeviceLayer, "BluezCharacteristicAcquireWriteError is called"); + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotSupported", + "AcquireWrite for characteristic is unsupported"); + return TRUE; +} + +static gboolean BluezCharacteristicAcquireNotify(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + GVariant * aOptions, gpointer apClosure) +{ + int fds[2] = { -1, -1 }; + GIOChannel * channel; + char * errStr; + GVariantDict options; + BluezConnection * conn = NULL; + bool isSuccess = false; + + BluezEndpoint * endpoint = static_cast(apClosure); + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + conn = GetBluezConnectionViaDevice(endpoint); + VerifyOrExit(conn != NULL, + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No Chipoble connection")); + + g_variant_dict_init(&options, aOptions); + if ((g_variant_dict_contains(&options, "mtu") == TRUE)) + { + GVariant * v = g_variant_dict_lookup_value(&options, "mtu", G_VARIANT_TYPE_UINT16); + conn->mMtu = g_variant_get_uint16(v); + } + + if (bluez_gatt_characteristic1_get_notifying(aChar)) + { + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotPermitted", "Already notifying"); + } + if (socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, 0, fds) < 0) + { + errStr = strerror(errno); + ChipLogProgress(DeviceLayer, "FAIL: socketpair: %s in %s", errStr, __func__); + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "FD creation failed"); + SuccessOrExit(false); + } + channel = g_io_channel_unix_new(fds[0]); + g_io_channel_set_encoding(channel, NULL, NULL); + g_io_channel_set_close_on_unref(channel, TRUE); + g_io_channel_set_buffered(channel, FALSE); + conn->mC2Channel.mpChannel = channel; + conn->mC2Channel.mWatch = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT_IDLE, (GIOCondition)(G_IO_HUP | G_IO_ERR | G_IO_NVAL), + bluezCharacteristicDestroyFD, conn, NULL); + + bluez_gatt_characteristic1_set_notify_acquired(aChar, TRUE); + + // same reply as for AcquireWrite + Bluez_gatt_characteristic1_complete_acquire_write_with_fd(aInvocation, fds[1], conn->mMtu); + close(fds[1]); + + conn->mIsNotify = true; + BLEManagerImpl::HandleTXCharCCCDWrite((void *) conn); + isSuccess = true; + +exit: + return isSuccess ? TRUE : FALSE; +} + +static gboolean BluezCharacteristicAcquireNotifyError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + GVariant * aOptions) +{ + ChipLogProgress(DeviceLayer, "TRACE: AcquireNotify is called"); + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotSupported", + "AcquireNotify for characteristic is unsupported"); + return TRUE; +} + +static gboolean BluezCharacteristicStartNotify(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + gpointer apClosure) +{ + bool isSuccess = false; + BluezConnection * conn = NULL; + + BluezEndpoint * endpoint = static_cast(apClosure); + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + conn = GetBluezConnectionViaDevice(endpoint); + VerifyOrExit(conn != NULL, + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No Chipoble connection")); + + if (bluez_gatt_characteristic1_get_notifying(aChar) == TRUE) + { + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "Characteristic is already subscribed"); + } + else + { + bluez_gatt_characteristic1_complete_start_notify(aChar, aInvocation); + bluez_gatt_characteristic1_set_notifying(aChar, TRUE); + conn->mIsNotify = true; + BLEManagerImpl::HandleTXCharCCCDWrite(conn); + } + isSuccess = true; + +exit: + return isSuccess ? TRUE : FALSE; +} + +static gboolean BluezCharacteristicStartNotifyError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation) +{ + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.NotSupported", + "Subscribing to characteristic is unsupported"); + return TRUE; +} + +static gboolean BluezCharacteristicStopNotify(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + gpointer apClosure) +{ + bool isSuccess = false; + BluezConnection * conn = NULL; + + BluezEndpoint * endpoint = static_cast(apClosure); + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + conn = GetBluezConnectionViaDevice(endpoint); + VerifyOrExit(conn != NULL, + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "No Chipoble connection")); + + if (bluez_gatt_characteristic1_get_notifying(aChar) == FALSE) + { + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "Characteristic is already unsubscribed"); + } + else + { + bluez_gatt_characteristic1_complete_start_notify(aChar, aInvocation); + bluez_gatt_characteristic1_set_notifying(aChar, FALSE); + } + conn->mIsNotify = false; + + isSuccess = true; + +exit: + return isSuccess ? TRUE : FALSE; +} + +static gboolean BluezCharacteristicConfirm(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation, + gpointer apClosure) +{ + BluezEndpoint * endpoint = (BluezEndpoint *) apClosure; + BluezConnection * conn = GetBluezConnectionViaDevice(endpoint); + + ChipLogDetail(Ble, "Indication confirmation, %p", conn); + BLEManagerImpl::HandleTXComplete(conn); + + return TRUE; +} + +static gboolean BluezCharacteristicStopNotifyError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation) +{ + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", + "Unsubscribing from characteristic is unsupported"); + return TRUE; +} + +static gboolean BluezCharacteristicConfirmError(BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInvocation) +{ + g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "Confirm from characteristic is unsupported"); + return TRUE; +} + +// both arguments allocated, and non-null +static void BluezStringAddressToCHIPAddress(const char * aAddressString, BluezAddress * apAddress) +{ + size_t i, j = 0; + for (i = 0; i < BLUEZ_ADDRESS_SIZE; i++) + { + apAddress->mAddress[i] = (CHAR_TO_BLUEZ(aAddressString[j]) << 4) + CHAR_TO_BLUEZ(aAddressString[j + 1]); + j += 2; + if (aAddressString[j] == ':') + j++; + } +} + +static gboolean BluezIsDeviceOnAdapter(BluezDevice1 * aDevice, BluezAdapter1 * aAdapter) +{ + return strcmp(bluez_device1_get_adapter(aDevice), g_dbus_proxy_get_object_path(G_DBUS_PROXY(aAdapter))) == 0 ? TRUE : FALSE; +} + +static gboolean BluezIsServiceOnDevice(BluezGattService1 * aService, BluezDevice1 * aDevice) +{ + return strcmp(bluez_gatt_service1_get_device(aService), g_dbus_proxy_get_object_path(G_DBUS_PROXY(aDevice))) == 0 ? TRUE + : FALSE; +} + +static gboolean BluezIsCharOnService(BluezGattCharacteristic1 * aChar, BluezGattService1 * aService) +{ + ChipLogProgress(DeviceLayer, "Char1 %s", bluez_gatt_characteristic1_get_service(aChar)); + ChipLogProgress(DeviceLayer, "Char1 %s", g_dbus_proxy_get_object_path(G_DBUS_PROXY(aService))); + return strcmp(bluez_gatt_characteristic1_get_service(aChar), g_dbus_proxy_get_object_path(G_DBUS_PROXY(aService))) == 0 ? TRUE + : FALSE; +} + +static uint16_t BluezUUIDStringToShortServiceID(const char * aService) +{ + uint32_t shortService = 0; + size_t i; + // check that the service is a short UUID + + if (strncasecmp(CHIP_BLE_BASE_SERVICE_UUID_STRING, aService + CHIP_BLE_SERVICE_PREFIX_LENGTH, + sizeof(CHIP_BLE_BASE_SERVICE_UUID_STRING)) == 0) + { + for (i = 0; i < 4; i++) + { + shortService = (shortService << 8) | (CHAR_TO_BLUEZ(aService[2 * i]) << 4) | CHAR_TO_BLUEZ(aService[2 * i + 1]); + } + + ChipLogProgress(DeviceLayer, "TRACE: full service UUID: %s, short service %08x", aService, shortService); + + if (shortService > UINT16_MAX) + { + shortService = 0; + } + } + return (uint16_t) shortService; +} + +static void BluezConnectionInit(BluezConnection * apConn) +{ + // populate the service and the characteristics + GList * objects = NULL; + GList * l; + BluezEndpoint * endpoint = NULL; + + VerifyOrExit(apConn != NULL, ChipLogProgress(DeviceLayer, "Bluez connection is NULL in %s", __func__)); + + endpoint = apConn->mpEndpoint; + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + if (!endpoint->mIsCentral) + { + apConn->mpService = BLUEZ_GATT_SERVICE1(g_object_ref(apConn->mpEndpoint->mpService)); + apConn->mpC1 = BLUEZ_GATT_CHARACTERISTIC1(g_object_ref(endpoint->mpC1)); + apConn->mpC2 = BLUEZ_GATT_CHARACTERISTIC1(g_object_ref(endpoint->mpC2)); + } + else + { + objects = g_dbus_object_manager_get_objects(endpoint->mpObjMgr); + + for (l = objects; l != NULL; l = l->next) + { + BluezObject * object = BLUEZ_OBJECT(l->data); + BluezGattService1 * service = bluez_object_get_gatt_service1(object); + + if (service != NULL) + { + if ((BluezIsServiceOnDevice(service, apConn->mpDevice)) == TRUE && + (strcmp(bluez_gatt_service1_get_uuid(service), CHIP_BLE_UUID_SERVICE_STRING) == 0)) + { + apConn->mpService = service; + break; + } + g_object_unref(service); + } + } + + VerifyOrExit(apConn->mpService != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL service in %s", __func__)); + + for (l = objects; l != NULL; l = l->next) + { + BluezObject * object = BLUEZ_OBJECT(l->data); + BluezGattCharacteristic1 * char1 = bluez_object_get_gatt_characteristic1(object); + + if (char1 != NULL) + { + if ((BluezIsCharOnService(char1, apConn->mpService) == TRUE) && + (strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C1_STRING) == 0)) + { + apConn->mpC1 = char1; + } + else if ((BluezIsCharOnService(char1, apConn->mpService) == TRUE) && + (strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C2_STRING) == 0)) + { + apConn->mpC2 = char1; + } + else + { + g_object_unref(char1); + } + if ((apConn->mpC1 != NULL) && (apConn->mpC2 != NULL)) + { + break; + } + } + } + + VerifyOrExit(apConn->mpC1 != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL C1 in %s", __func__)); + VerifyOrExit(apConn->mpC2 != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL C2 in %s", __func__)); + } + +exit: + if (objects != NULL) + g_list_free_full(objects, g_object_unref); +} + +static gboolean BluezConnectionInitIdle(gpointer user_data) +{ + BluezConnection * conn = (BluezConnection *) user_data; + + ChipLogProgress(DeviceLayer, "%s", __func__); + + BluezConnectionInit(conn); + + return FALSE; +} + +static void BluezOTConnectionDestroy(BluezConnection * aConn) +{ + if (aConn) + { + if (aConn->mpDevice) + g_object_unref(aConn->mpDevice); + if (aConn->mpService) + g_object_unref(aConn->mpService); + if (aConn->mpC1) + g_object_unref(aConn->mpC1); + if (aConn->mpC2) + g_object_unref(aConn->mpC2); + if (aConn->mpPeerAddress) + g_free(aConn->mpPeerAddress); + if (aConn->mC1Channel.mWatch > 0) + g_source_remove(aConn->mC1Channel.mWatch); + if (aConn->mC1Channel.mpChannel) + g_io_channel_unref(aConn->mC1Channel.mpChannel); + if (aConn->mC2Channel.mWatch > 0) + g_source_remove(aConn->mC2Channel.mWatch); + if (aConn->mC2Channel.mpChannel) + g_io_channel_unref(aConn->mC2Channel.mpChannel); + + g_free(aConn); + } +} + +static BluezGattCharacteristic1 * BluezCharacteristicCreate(BluezGattService1 * aService, const char * aCharName, + const char * aUUID, GDBusObjectManagerServer * aRoot) +{ + char * servicePath = g_strdup(g_dbus_object_get_object_path(g_dbus_interface_get_object(G_DBUS_INTERFACE(aService)))); + char * charPath = g_strdup_printf("%s/%s", servicePath, aCharName); + BluezObjectSkeleton * object; + BluezGattCharacteristic1 * characteristic; + + ChipLogProgress(DeviceLayer, "Create characteristic object at %s", charPath); + object = bluez_object_skeleton_new(charPath); + + characteristic = bluez_gatt_characteristic1_skeleton_new(); + bluez_gatt_characteristic1_set_uuid(characteristic, aUUID); + bluez_gatt_characteristic1_set_service(characteristic, servicePath); + + bluez_object_skeleton_set_gatt_characteristic1(object, characteristic); + g_dbus_object_manager_server_export(aRoot, G_DBUS_OBJECT_SKELETON(object)); + g_object_unref(object); + + return characteristic; +} + +static void BluezPeripheralRegisterAppDone(GObject * aObject, GAsyncResult * aResult, gpointer apClosure) +{ + GError * error = NULL; + BluezGattManager1 * gattMgr = BLUEZ_GATT_MANAGER1(aObject); + + gboolean success = bluez_gatt_manager1_call_register_application_finish(gattMgr, aResult, &error); + + VerifyOrExit(success == TRUE, ChipLogProgress(DeviceLayer, "FAIL: RegisterApplication : %s", error->message)); + + BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(true, NULL); + ChipLogProgress(DeviceLayer, "BluezPeripheralRegisterAppDone done"); + +exit: + if (error != NULL) + { + BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(false, NULL); + g_error_free(error); + } + return; +} + +gboolean BluezPeripheralRegisterApp(void * apClosure) +{ + GDBusObject * adapter; + BluezGattManager1 * gattMgr; + GVariantBuilder optionsBuilder; + GVariant * options; + + BluezEndpoint * endpoint = (BluezEndpoint *) apClosure; + VerifyOrExit(endpoint->mpAdapter != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__)); + + adapter = g_dbus_interface_get_object(G_DBUS_INTERFACE(endpoint->mpAdapter)); + VerifyOrExit(adapter != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL adapter in %s", __func__)); + + gattMgr = bluez_object_get_gatt_manager1(BLUEZ_OBJECT(adapter)); + VerifyOrExit(gattMgr != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL gattMgr in %s", __func__)); + + g_variant_builder_init(&optionsBuilder, G_VARIANT_TYPE("a{sv}")); + options = g_variant_builder_end(&optionsBuilder); + + bluez_gatt_manager1_call_register_application(gattMgr, endpoint->mpRootPath, options, NULL, BluezPeripheralRegisterAppDone, + NULL); + +exit: + return G_SOURCE_REMOVE; +} + +/*********************************************************************** + * GATT Characteristic object + ***********************************************************************/ + +static void BluezHandleAdvertisementFromDevice(BluezDevice1 * aDevice) +{ + const char * address = bluez_device1_get_address(aDevice); + int16_t rssi = bluez_device1_get_rssi(aDevice); + GVariant * serviceData = bluez_device1_get_service_data(aDevice); + GVariant * entry; + GVariantIter iter; + ChipAdvType type; + BluezAddress * src; + const uint8_t * tmpBuf; + uint8_t * buf; + size_t len, dataLen; + size_t i, j; + uint16_t serviceId; + char * debugStr; + + // service data is optional and may not be present + SuccessOrExit(serviceData != NULL); + + src = g_new0(BluezAddress, 1); + + BluezStringAddressToCHIPAddress(address, src); + type = ChipAdvType::BLUEZ_ADV_TYPE_CONNECTABLE; + debugStr = g_variant_print(serviceData, TRUE); + ChipLogProgress(DeviceLayer, "TRACE: Device %s Service data: %s", address, debugStr); + g_free(debugStr); + // advertising flags + ChipLogProgress(DeviceLayer, "TRACE: Device %s Advertising flags: %s", address, bluez_device1_get_advertising_flags(aDevice)); + + g_variant_iter_init(&iter, serviceData); + + len = 0; + while ((entry = g_variant_iter_next_value(&iter)) != NULL) + { + GVariant * key = g_variant_get_child_value(entry, 0); + GVariant * val = g_variant_get_child_value(entry, 1); + GVariant * rawVal = g_variant_get_variant(val); + + serviceId = BluezUUIDStringToShortServiceID(g_variant_get_string(key, &dataLen)); + + if (serviceId != 0) + { + len += 1 + sizeof(uint8_t) + sizeof(serviceId) + g_variant_n_children(rawVal); + } + } + + if (len != 0) + { + // we only parsed services, add 3 bytes for flags + len = len + 3; + buf = (uint8_t *) g_malloc(len); + i = 0; + buf[i++] = 2; // length of flags + buf[i++] = BLUEZ_ADV_TYPE_FLAGS; + buf[i++] = BLUEZ_ADV_FLAGS_LE_DISCOVERABLE | BLUEZ_ADV_FLAGS_EDR_UNSUPPORTED; + g_variant_iter_init(&iter, serviceData); + while ((entry = g_variant_iter_next_value(&iter)) != NULL) + { + GVariant * key = g_variant_get_child_value(entry, 0); + GVariant * val = g_variant_get_child_value(entry, 1); + GVariant * rawVal = g_variant_get_variant(val); + serviceId = BluezUUIDStringToShortServiceID(g_variant_get_string(key, &dataLen)); + + if (serviceId != 0) + { + buf[i++] = g_variant_n_children(rawVal) + 2 + 1; + buf[i++] = BLUEZ_ADV_TYPE_SERVICE_DATA; + buf[i++] = serviceId & 0xff; + buf[i++] = (serviceId >> 8) & 0xff; + tmpBuf = (const uint8_t *) g_variant_get_fixed_array(rawVal, &dataLen, sizeof(uint8_t)); + for (j = 0; j < dataLen; j++) + { + buf[i++] = tmpBuf[j]; + } + } + } + } + +exit: + return; +} + +static void BluezSignalInterfacePropertiesChanged(GDBusObjectManagerClient * aManager, GDBusObjectProxy * aObject, + GDBusProxy * aInterface, GVariant * aChangedProperties, + const gchar * const * aInvalidatedProps, gpointer apClosure) +{ + + BluezEndpoint * endpoint = (BluezEndpoint *) apClosure; + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + VerifyOrExit(endpoint->mpAdapter != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL endpoint->mpAdapter in %s", __func__)); + + if (strcmp(g_dbus_proxy_get_interface_name(aInterface), CHARACTERISTIC_INTERFACE) == 0) + { + BluezGattCharacteristic1 * chr = BLUEZ_GATT_CHARACTERISTIC1(aInterface); + BluezConnection * conn = BluezCharacteristicGetBluezConnection(chr, NULL, endpoint); + + if (conn) + { + GVariantIter iter; + GVariant * value; + char * key; + + g_variant_iter_init(&iter, aChangedProperties); + while (g_variant_iter_next(&iter, "{&sv}", &key, &value)) + { + if (strcmp(key, "Value") == 0) + { + gconstpointer data; + uint8_t * buf; + size_t len; + + data = g_variant_get_fixed_array(value, &len, sizeof(uint8_t)); + + /* TODO why is otPlat API limited to 255 bytes? */ + if (len > 255) + len = 255; + + buf = (uint8_t *) g_memdup(data, len); + } + g_variant_unref(value); + } + } + } + else if (strcmp(g_dbus_proxy_get_interface_name(aInterface), DEVICE_INTERFACE) == 0) + { + BluezDevice1 * device = BLUEZ_DEVICE1(aInterface); + GVariantIter iter; + GVariant * value; + char * key; + + if (BluezIsDeviceOnAdapter(device, endpoint->mpAdapter)) + { + BluezConnection * conn = + (BluezConnection *) g_hash_table_lookup(endpoint->mpConnMap, g_dbus_proxy_get_object_path(aInterface)); + g_variant_iter_init(&iter, aChangedProperties); + while (g_variant_iter_next(&iter, "{&sv}", &key, &value)) + { + if (strcmp(key, "Connected") == 0) + { + gboolean connected; + connected = g_variant_get_boolean(value); + + if (connected) + { + ChipLogProgress(DeviceLayer, "Bluez coonnected"); + // for a central, the connection has been already allocated. For a peripheral, it has not. + // todo do we need this ? we could handle all connection the same wa... + if (endpoint->mIsCentral) + SuccessOrExit(conn != NULL); + + if (!endpoint->mIsCentral) + { + VerifyOrExit(conn == NULL, + ChipLogProgress(DeviceLayer, "FAIL: connection already tracked: conn: %x device: %s", conn, + g_dbus_proxy_get_object_path(aInterface))); + conn = g_new0(BluezConnection, 1); + conn->mpPeerAddress = g_strdup(bluez_device1_get_address(device)); + conn->mpDevice = (BluezDevice1 *) g_object_ref(device); + conn->mpEndpoint = endpoint; + BluezConnectionInit(conn); + endpoint->mpPeerDevicePath = g_strdup(g_dbus_proxy_get_object_path(aInterface)); + ChipLogProgress(DeviceLayer, "coonnected, insert, conn:%p, c1:%p, c2:%p and %s", conn, conn->mpC1, + conn->mpC2, endpoint->mpPeerDevicePath); + g_hash_table_insert(endpoint->mpConnMap, endpoint->mpPeerDevicePath, conn); + } + // for central, we do not call BluezConnectionInit until the services have been resolved + + BLEManagerImpl::CHIPoBluez_NewConnection(endpoint); + } + else + { + ChipLogProgress(DeviceLayer, "Bluez disconnected"); + BLEManagerImpl::CHIPoBluez_ConnectionClosed(endpoint); + BluezOTConnectionDestroy(conn); + g_hash_table_remove(endpoint->mpConnMap, g_dbus_proxy_get_object_path(aInterface)); + } + } + else if (strcmp(key, "ServicesResolved") == 0) + { + gboolean resolved; + resolved = g_variant_get_boolean(value); + + if (endpoint->mIsCentral && conn != NULL && resolved == TRUE) + { + /* delay to idle, this is to workaround race in handling + * of interface-added and properites-changed signals + * it looks like we cannot specify order of those + * handlers and currently implementation assumes + * that interfaces-added is called first. + * + * TODO figure out if we can avoid this + */ + g_idle_add(BluezConnectionInitIdle, conn); + } + } + else if (strcmp(key, "RSSI") == 0) + { + /* when discovery starts we will get this one device is + * found even if device object was already present + */ + if (endpoint->mIsCentral) + { + BluezHandleAdvertisementFromDevice(device); + } + } + + g_variant_unref(value); + } + } + } +exit: + return; +} + +static void BluezHandleNewDevice(BluezDevice1 * device, BluezEndpoint * apEndpoint) +{ + VerifyOrExit(apEndpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + if (apEndpoint->mIsCentral) + { + BluezHandleAdvertisementFromDevice(device); + } + else + { + BluezConnection * conn; + SuccessOrExit(bluez_device1_get_connected(device)); + + conn = (BluezConnection *) g_hash_table_lookup(apEndpoint->mpConnMap, g_dbus_proxy_get_object_path(G_DBUS_PROXY(device))); + VerifyOrExit(conn == NULL, + ChipLogProgress(DeviceLayer, "FAIL: connection already tracked: conn: %x new device: %s", conn, + g_dbus_proxy_get_object_path(G_DBUS_PROXY(device)))); + + conn = g_new0(BluezConnection, 1); + conn->mpPeerAddress = g_strdup(bluez_device1_get_address(device)); + conn->mpDevice = (BluezDevice1 *) g_object_ref(device); + conn->mpEndpoint = apEndpoint; + BluezConnectionInit(conn); + + g_hash_table_insert(apEndpoint->mpConnMap, g_strdup(g_dbus_proxy_get_object_path(G_DBUS_PROXY(device))), conn); + } + +exit: + return; +} + +static void BluezSignalOnObjectAdded(GDBusObjectManager * aManager, GDBusObject * aObject, gpointer apClosure) +{ + // TODO: right now we do not handle addition/removal of adapters + // Primary focus here is to handle addition of a device + + BluezObject * o = BLUEZ_OBJECT(aObject); + BluezDevice1 * device = bluez_object_get_device1(o); + BluezEndpoint * endpoint = (BluezEndpoint *) apClosure; + if (device != NULL) + { + if (BluezIsDeviceOnAdapter(device, endpoint->mpAdapter) == TRUE) + { + BluezHandleNewDevice(device, endpoint); + } + + g_object_unref(device); + } +} + +static void BluezSignalOnObjectRemoved(GDBusObjectManager * aManager, GDBusObject * aObject, gpointer apClosure) +{ + // TODO: for Device1, lookup connection, and call otPlatTobleHandleDisconnected + // for Adapter1: unclear, crash if this pertains to our adapter? at least null out the endpoint->mpAdapter. + // for Characteristic1, or GattService -- handle here via calling otPlatTobleHandleDisconnected, or ignore. +} + +static BluezGattService1 * BluezServiceCreate(gpointer apClosure) +{ + BluezObjectSkeleton * object; + BluezGattService1 * service; + BluezEndpoint * endpoint = (BluezEndpoint *) apClosure; + + endpoint->mpServicePath = g_strdup_printf("%s/service", endpoint->mpRootPath); + ChipLogProgress(DeviceLayer, "CREATE service object at %s", endpoint->mpServicePath); + object = bluez_object_skeleton_new(endpoint->mpServicePath); + + service = bluez_gatt_service1_skeleton_new(); + bluez_gatt_service1_set_uuid(service, "0xFEAF"); + // device is only valid for remote services + bluez_gatt_service1_set_primary(service, TRUE); + + // includes -- unclear whether required. Might be filled in later + bluez_object_skeleton_set_gatt_service1(object, service); + g_dbus_object_manager_server_export(endpoint->mpRoot, G_DBUS_OBJECT_SKELETON(object)); + g_object_unref(object); + + return service; +} + +static void bluezObjectsSetup(BluezEndpoint * apEndpoint) +{ + GList * objects; + GList * l; + char * expectedPath = NULL; + + VerifyOrExit(apEndpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + expectedPath = g_strdup_printf("%s/hci%d", BLUEZ_PATH, apEndpoint->mNodeId); + objects = g_dbus_object_manager_get_objects(apEndpoint->mpObjMgr); + + for (l = objects; l != NULL && apEndpoint->mpAdapter == NULL; l = l->next) + { + BluezObject * object = BLUEZ_OBJECT(l->data); + GList * interfaces; + GList * ll; + interfaces = g_dbus_object_get_interfaces(G_DBUS_OBJECT(object)); + + for (ll = interfaces; ll != NULL; ll = ll->next) + { + if (BLUEZ_IS_ADAPTER1(ll->data)) + { // we found the adapter + BluezAdapter1 * adapter = BLUEZ_ADAPTER1(ll->data); + char * addr = (char *) bluez_adapter1_get_address(adapter); + if (apEndpoint->mpAdapterAddr == NULL) // no adapter address provided, bind to the hci indicated by nodeid + { + if (strcmp(g_dbus_proxy_get_object_path(G_DBUS_PROXY(adapter)), expectedPath) == 0) + { + apEndpoint->mpAdapter = (BluezAdapter1 *) g_object_ref(adapter); + } + } + else + { + if (strcmp(apEndpoint->mpAdapterAddr, addr) == 0) + { + apEndpoint->mpAdapter = (BluezAdapter1 *) g_object_ref(adapter); + } + } + } + } + g_list_free_full(interfaces, g_object_unref); + } + VerifyOrExit(apEndpoint->mpAdapter != NULL, ChipLogProgress(DeviceLayer, "FAIL: NULL apEndpoint->mpAdapter in %s", __func__)); + bluez_adapter1_set_powered(apEndpoint->mpAdapter, TRUE); + + // with BLE we are discoverable only when advertising so this can be + // set once on init + bluez_adapter1_set_discoverable_timeout(apEndpoint->mpAdapter, 0); + bluez_adapter1_set_discoverable(apEndpoint->mpAdapter, TRUE); + +exit: + g_list_free_full(objects, g_object_unref); + g_free(expectedPath); +} + +static BluezConnection * GetBluezConnectionViaDevice(BluezEndpoint * apEndpoint) +{ + BluezConnection * retval = (BluezConnection *) g_hash_table_lookup(apEndpoint->mpConnMap, apEndpoint->mpPeerDevicePath); + // ChipLogProgress(DeviceLayer, "acquire connection object %p in (%s)", retval, __func__); + return retval; +} + +static BluezConnection * BluezCharacteristicGetBluezConnection(BluezGattCharacteristic1 * aChar, GVariant * aOptions, + BluezEndpoint * apEndpoint) +{ + BluezConnection * retval = NULL; + const gchar * path = NULL; + GVariantDict options; + GVariant * v; + + VerifyOrExit(apEndpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + VerifyOrExit(apEndpoint->mIsCentral, ); + ChipLogProgress(DeviceLayer, "loopup BluezCharacteristicGetBluezConnection"); + /* TODO Unfortunately StartNotify/StopNotify doesn't provide info about + * peer device in call params so we need look this up ourselves. + */ + if (aOptions == NULL) + { + GList * objects; + GList * l; + GList * ll; + + objects = g_dbus_object_manager_get_objects(apEndpoint->mpObjMgr); + for (l = objects; l != NULL; l = l->next) + { + BluezDevice1 * device = bluez_object_get_device1(BLUEZ_OBJECT(l->data)); + if (device != NULL) + { + if (BluezIsDeviceOnAdapter(device, apEndpoint->mpAdapter)) + { + for (ll = objects; ll != NULL; ll = ll->next) + { + BluezGattService1 * service = bluez_object_get_gatt_service1(BLUEZ_OBJECT(ll->data)); + if (service != NULL) + { + if (BluezIsServiceOnDevice(service, device)) + { + if (BluezIsCharOnService(aChar, service)) + { + retval = (BluezConnection *) g_hash_table_lookup( + apEndpoint->mpConnMap, g_dbus_proxy_get_object_path(G_DBUS_PROXY(device))); + } + } + g_object_unref(service); + if (retval != NULL) + break; + } + } + } + g_object_unref(device); + if (retval != NULL) + break; + } + } + + g_list_free_full(objects, g_object_unref); + } + else + { + g_variant_dict_init(&options, aOptions); + + v = g_variant_dict_lookup_value(&options, "device", G_VARIANT_TYPE_OBJECT_PATH); + + VerifyOrExit(v != NULL, ChipLogProgress(DeviceLayer, "FAIL: No device option in dictionary (%s)", __func__)); + + path = g_variant_get_string(v, NULL); + + retval = (BluezConnection *) g_hash_table_lookup(apEndpoint->mpConnMap, path); + } + +exit: + return retval; +} + +void EndpointCleanup(BluezEndpoint * apEndpoint) +{ + if (apEndpoint != NULL) + { + if (apEndpoint->mpOwningName != NULL) + { + g_free(apEndpoint->mpOwningName); + apEndpoint->mpOwningName = NULL; + } + if (apEndpoint->mpAdapterName != NULL) + { + g_free(apEndpoint->mpAdapterName); + apEndpoint->mpAdapterName = NULL; + } + if (apEndpoint->mpAdapterAddr != NULL) + { + g_free(apEndpoint->mpAdapterAddr); + apEndpoint->mpAdapterAddr = NULL; + } + if (apEndpoint->mpRootPath != NULL) + { + g_free(apEndpoint->mpRootPath); + apEndpoint->mpRootPath = NULL; + } + if (apEndpoint->mpAdvPath != NULL) + { + g_free(apEndpoint->mpAdvPath); + apEndpoint->mpAdvPath = NULL; + } + if (apEndpoint->mpServicePath != NULL) + { + g_free(apEndpoint->mpServicePath); + apEndpoint->mpServicePath = NULL; + } + if (apEndpoint->mpConnMap != NULL) + { + g_hash_table_destroy(apEndpoint->mpConnMap); + apEndpoint->mpConnMap = NULL; + } + if (apEndpoint->mpAdvertisingUUID != NULL) + { + g_free(apEndpoint->mpAdvertisingUUID); + apEndpoint->mpAdvertisingUUID = NULL; + } + if (apEndpoint->mpChipServiceData != NULL) + { + g_free(apEndpoint->mpChipServiceData); + apEndpoint->mpChipServiceData = NULL; + } + if (apEndpoint->mpPeerDevicePath != NULL) + { + g_free(apEndpoint->mpPeerDevicePath); + apEndpoint->mpPeerDevicePath = NULL; + } + + g_free(apEndpoint); + } +} + +void BluezObjectsCleanup(BluezEndpoint * apEndpoint) +{ + g_object_unref(apEndpoint->mpAdapter); + EndpointCleanup(apEndpoint); +} + +static void BluezPeripheralObjectsSetup(gpointer apClosure) +{ + + static const char * const c1_flags[] = { "write", NULL }; + static const char * const c2_flags[] = { "read", "indicate", NULL }; + + BluezEndpoint * endpoint = (BluezEndpoint *) apClosure; + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + endpoint->mpService = BluezServiceCreate(apClosure); + // C1 characteristic + endpoint->mpC1 = + BluezCharacteristicCreate(endpoint->mpService, g_strdup("c1"), g_strdup(CHIP_PLAT_BLE_UUID_C1_STRING), endpoint->mpRoot); + bluez_gatt_characteristic1_set_flags(endpoint->mpC1, c1_flags); + + g_signal_connect(endpoint->mpC1, "handle-read-value", G_CALLBACK(BluezCharacteristicReadValue), apClosure); + g_signal_connect(endpoint->mpC1, "handle-write-value", G_CALLBACK(BluezCharacteristicWriteValueError), NULL); + g_signal_connect(endpoint->mpC1, "handle-acquire-write", G_CALLBACK(BluezCharacteristicAcquireWrite), apClosure); + g_signal_connect(endpoint->mpC1, "handle-acquire-notify", G_CALLBACK(BluezCharacteristicAcquireNotifyError), NULL); + g_signal_connect(endpoint->mpC1, "handle-start-notify", G_CALLBACK(BluezCharacteristicStartNotifyError), NULL); + g_signal_connect(endpoint->mpC1, "handle-stop-notify", G_CALLBACK(BluezCharacteristicStopNotifyError), NULL); + g_signal_connect(endpoint->mpC1, "handle-confirm", G_CALLBACK(BluezCharacteristicConfirmError), NULL); + + endpoint->mpC2 = + BluezCharacteristicCreate(endpoint->mpService, g_strdup("c2"), g_strdup(CHIP_PLAT_BLE_UUID_C2_STRING), endpoint->mpRoot); + bluez_gatt_characteristic1_set_flags(endpoint->mpC2, c2_flags); + g_signal_connect(endpoint->mpC2, "handle-read-value", G_CALLBACK(BluezCharacteristicReadValue), apClosure); + g_signal_connect(endpoint->mpC2, "handle-write-value", G_CALLBACK(BluezCharacteristicWriteValueError), NULL); + g_signal_connect(endpoint->mpC2, "handle-acquire-write", G_CALLBACK(BluezCharacteristicAcquireWriteError), NULL); + g_signal_connect(endpoint->mpC2, "handle-acquire-notify", G_CALLBACK(BluezCharacteristicAcquireNotify), apClosure); + g_signal_connect(endpoint->mpC2, "handle-start-notify", G_CALLBACK(BluezCharacteristicStartNotify), apClosure); + g_signal_connect(endpoint->mpC2, "handle-stop-notify", G_CALLBACK(BluezCharacteristicStopNotify), apClosure); + g_signal_connect(endpoint->mpC2, "handle-confirm", G_CALLBACK(BluezCharacteristicConfirm), apClosure); + + ChipLogProgress(DeviceLayer, "CHIP BTP C1 %s", bluez_gatt_characteristic1_get_service(endpoint->mpC1)); + ChipLogProgress(DeviceLayer, "CHIP BTP C2 %s", bluez_gatt_characteristic1_get_service(endpoint->mpC2)); + +exit: + return; +} + +static void BluezOnBusAcquired(GDBusConnection * aConn, const gchar * aName, gpointer apClosure) +{ + BluezEndpoint * endpoint = (BluezEndpoint *) apClosure; + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + ChipLogProgress(DeviceLayer, "TRACE: Bus acquired for name %s", aName); + + endpoint->mpRootPath = g_strdup_printf("/chipoble/%04x", getpid() & 0xffff); + endpoint->mpRoot = g_dbus_object_manager_server_new(endpoint->mpRootPath); + g_dbus_object_manager_server_set_connection(endpoint->mpRoot, aConn); + BluezPeripheralObjectsSetup(apClosure); + +exit: + return; +} + +static void BluezOnNameAcquired(GDBusConnection * aConn, const gchar * aName, gpointer apClosure) +{ + ChipLogProgress(DeviceLayer, "TRACE: Owning name: Acquired %s", aName); +} + +static void BluezOnNameLost(GDBusConnection * aConn, const gchar * aName, gpointer apClosure) +{ + ChipLogProgress(DeviceLayer, "TRACE: Owning name: lost %s", aName); +} + +static void * BluezMainLoop(void * apClosure) +{ + GDBusObjectManager * manager; + GError * error = NULL; + guint id; + GDBusConnection * conn = NULL; + BluezEndpoint * endpoint = (BluezEndpoint *) apClosure; + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "endpoint is NULL in %s", __func__)); + + conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error); + VerifyOrExit(conn != NULL, ChipLogProgress(DeviceLayer, "FAIL: get bus sync in %s, error: %s", __func__, error->message)); + + if (endpoint->mpAdapterName != NULL) + endpoint->mpOwningName = g_strdup_printf("%s", endpoint->mpAdapterName); + else + endpoint->mpOwningName = g_strdup_printf("C-%04x", getpid() & 0xffff); + + BluezOnBusAcquired(conn, endpoint->mpOwningName, apClosure); + + manager = g_dbus_object_manager_client_new_sync( + conn, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_INTERFACE, "/", bluez_object_manager_client_get_proxy_type, + NULL /* unused user data in the Proxy Type Func */, NULL /*destroy notify */, NULL /* cancellable */, &error); + + VerifyOrExit(manager != NULL, ChipLogProgress(DeviceLayer, "FAIL: Error getting object manager client: %s", error->message)); + + endpoint->mpObjMgr = manager; + + bluezObjectsSetup(endpoint); + +#if 0 + // reenable if we want to handle the bluetoothd restart + g_signal_connect (manager, + "notify::name-owner", + G_CALLBACK (on_notify_name_owner), + NULL); +#endif + g_signal_connect(manager, "object-added", G_CALLBACK(BluezSignalOnObjectAdded), apClosure); + g_signal_connect(manager, "object-removed", G_CALLBACK(BluezSignalOnObjectRemoved), apClosure); + g_signal_connect(manager, "interface-proxy-properties-changed", G_CALLBACK(BluezSignalInterfacePropertiesChanged), apClosure); + + ChipLogProgress(DeviceLayer, "TRACE: Bluez mainloop starting %s", __func__); + g_main_loop_run(sBluezMainLoop); + ChipLogProgress(DeviceLayer, "TRACE: Bluez mainloop stopping %s", __func__); + + g_bus_unown_name(id); + BluezObjectsCleanup(endpoint); + +exit: + if (error != NULL) + g_error_free(error); + return NULL; +} + +bool BluezRunOnBluezThread(int (*aCallback)(void *), void * apClosure) +{ + GMainContext * context = NULL; + const char * msg = NULL; + + VerifyOrExit(sBluezMainLoop != NULL, msg = "FAIL: NULL sBluezMainLoop"); + VerifyOrExit(g_main_loop_is_running(sBluezMainLoop), msg = "FAIL: sBluezMainLoop not running"); + + context = g_main_loop_get_context(sBluezMainLoop); + VerifyOrExit(context != NULL, msg = "FAIL: NULL main context"); + g_main_context_invoke(context, aCallback, apClosure); + +exit: + if (msg != NULL) + { + ChipLogProgress(DeviceLayer, "%s in %s", msg, __func__); + } + + return msg == NULL; +} + +static gboolean BluezC2Indicate(void * apClosure) +{ + ConnectionDataBundle * closure = NULL; + BluezConnection * conn = NULL; + GError * error = NULL; + GIOStatus status; + const char * buf; + size_t len, written; + + closure = static_cast(apClosure); + VerifyOrExit(closure != NULL, ChipLogProgress(DeviceLayer, "ConnectionDataBundle is NULL in %s", __func__)); + + conn = closure->mpConn; + VerifyOrExit(conn != NULL, ChipLogProgress(DeviceLayer, "BluezConnection is NULL in %s", __func__)); + VerifyOrExit(conn->mpC2 != NULL, ChipLogProgress(DeviceLayer, "FAIL: C2 Indicate: %s", "NULL C2")); + + if (bluez_gatt_characteristic1_get_notify_acquired(conn->mpC2) == TRUE) + { + buf = (char *) g_variant_get_fixed_array(closure->mpVal, &len, sizeof(uint8_t)); + status = g_io_channel_write_chars(conn->mC2Channel.mpChannel, buf, len, &written, &error); + g_variant_unref(closure->mpVal); + closure->mpVal = NULL; + + VerifyOrExit(status == G_IO_STATUS_NORMAL, ChipLogProgress(DeviceLayer, "FAIL: C2 Indicate: %s", error->message)); + } + else + { + bluez_gatt_characteristic1_set_value(conn->mpC2, closure->mpVal); + closure->mpVal = NULL; + } + +exit: + if (closure != NULL) + { + if (closure->mpVal) + { + g_variant_unref(closure->mpVal); + } + g_free(closure); + } + + if (error != NULL) + g_error_free(error); + return G_SOURCE_REMOVE; +} + +bool SendBluezIndication(void * apConn, chip::System::PacketBuffer * apBuf) +{ + ConnectionDataBundle * closure; + const char * msg = NULL; + bool success = false; + uint8_t * buffer = NULL; + size_t len = 0; + + VerifyOrExit(apBuf != NULL, ChipLogProgress(DeviceLayer, "apBuf is NULL in %s", __func__)); + buffer = apBuf->Start(); + len = apBuf->DataLength(); + + closure = g_new(ConnectionDataBundle, 1); + closure->mpConn = static_cast(apConn); + + closure->mpVal = g_variant_new_fixed_array(G_VARIANT_TYPE_BYTE, buffer, len * sizeof(uint8_t), sizeof(uint8_t)); + + success = BluezRunOnBluezThread(BluezC2Indicate, closure); + +exit: + if (NULL != msg) + { + ChipLogError(Ble, msg); + } + + if (NULL != apBuf) + { + chip::System::PacketBuffer::Free(apBuf); + } + + return success; +} + +static gboolean BluezDisconnect(void * apClosure) +{ + BluezConnection * conn = static_cast(apClosure); + GError * error = NULL; + gboolean success; + + VerifyOrExit(conn != NULL, ChipLogProgress(DeviceLayer, "conn is NULL in %s", __func__)); + VerifyOrExit(conn->mpDevice != NULL, ChipLogProgress(DeviceLayer, "FAIL: Disconnect: %s", "NULL Device")); + + ChipLogProgress(DeviceLayer, "%s peer=%s", __func__, bluez_device1_get_address(conn->mpDevice)); + + success = bluez_device1_call_disconnect_sync(conn->mpDevice, NULL, &error); + VerifyOrExit(success == TRUE, ChipLogProgress(DeviceLayer, "FAIL: Disconnect: %s", error->message)); + +exit: + if (error != NULL) + g_error_free(error); + return G_SOURCE_REMOVE; +} + +static int CloseBleconnectionCB(void * apAppState) +{ + BluezDisconnect(apAppState); + return G_SOURCE_REMOVE; +} + +bool CloseBluezConnection(void * apAppState) +{ + return BluezRunOnBluezThread(CloseBleconnectionCB, apAppState); +} + +CHIP_ERROR StartBluezAdv(void * apAppState) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + if (!BluezRunOnBluezThread(BluezAdvStart, apAppState)) + { + err = CHIP_ERROR_INCORRECT_STATE; + ChipLogError(Ble, "Failed to schedule BluezAdvStart() on CHIPoBluez thread"); + } + return err; +} + +CHIP_ERROR StopBluezAdv(void * apAppState) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + if (!BluezRunOnBluezThread(BluezAdvSetup, apAppState)) + { + err = CHIP_ERROR_INCORRECT_STATE; + ChipLogError(Ble, "Failed to schedule BluezAdvStop() on CHIPoBluez thread"); + } + return err; +} + +CHIP_ERROR BluezAdvertisementSetup(void * apAppState) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + if (!BluezRunOnBluezThread(BluezAdvSetup, apAppState)) + { + err = CHIP_ERROR_INCORRECT_STATE; + ChipLogError(Ble, "Failed to schedule BluezAdvertisementSetup() on CHIPoBluez thread"); + } + return err; +} + +CHIP_ERROR BluezGattsAppRegister(void * apAppState) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + if (!BluezRunOnBluezThread(BluezPeripheralRegisterApp, apAppState)) + { + err = CHIP_ERROR_INCORRECT_STATE; + ChipLogError(Ble, "Failed to schedule BluezPeripheralRegisterApp() on CHIPoBluez thread"); + } + return err; +} + +CHIP_ERROR ConfigureBluezAdv(BLEAdvConfig & aBleAdvConfig, BluezEndpoint * apEndpoint) +{ + const char * msg = NULL; + CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrExit(aBleAdvConfig.mpBleName != NULL, msg = "FAIL: BLE name is NULL"); + VerifyOrExit(aBleAdvConfig.mpAdvertisingUUID != NULL, msg = "FAIL: BLE mpAdvertisingUUID is NULL in %s"); + + apEndpoint->mpAdapterName = g_strdup(aBleAdvConfig.mpBleName); + apEndpoint->mpAdvertisingUUID = g_strdup(aBleAdvConfig.mpAdvertisingUUID); + apEndpoint->mNodeId = aBleAdvConfig.mNodeId; + apEndpoint->mType = aBleAdvConfig.mType; + apEndpoint->mDuration = aBleAdvConfig.mDuration; + apEndpoint->mpChipServiceData = static_cast(g_malloc(sizeof(CHIPServiceData) + 1)); + apEndpoint->mpChipServiceData->mDataBlock0Len = sizeof(CHIPIdInfo) + 1; + apEndpoint->mpChipServiceData->mDataBlock0Type = 1; + apEndpoint->mpChipServiceData->mIdInfo.mMajor = aBleAdvConfig.mMajor; + apEndpoint->mpChipServiceData->mIdInfo.mMinor = aBleAdvConfig.mMinor; + apEndpoint->mpChipServiceData->mIdInfo.mVendorId = aBleAdvConfig.mVendorId; + apEndpoint->mpChipServiceData->mIdInfo.mProductId = aBleAdvConfig.mProductId; + apEndpoint->mpChipServiceData->mIdInfo.mDeviceId = aBleAdvConfig.mDeviceId; + apEndpoint->mpChipServiceData->mIdInfo.mPairingStatus = aBleAdvConfig.mPairingStatus; + apEndpoint->mDuration = aBleAdvConfig.mDuration; + +exit: + if (NULL != msg) + { + ChipLogProgress(DeviceLayer, "%s in %s", msg, __func__); + err = CHIP_ERROR_INCORRECT_STATE; + if (apEndpoint->mpChipServiceData != NULL) + { + g_free(apEndpoint->mpChipServiceData); + apEndpoint->mpChipServiceData = NULL; + } + } + return err; +} + +CHIP_ERROR InitBluezBleLayer(bool aIsCentral, char * apBleAddr, BLEAdvConfig & aBleAdvConfig, void *& apEndpoint) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + bool retval = false; + int pthreadErr = 0; + int tmpErrno; + BluezEndpoint * endpoint = NULL; + + VerifyOrExit(pipe2(sBluezFD, O_DIRECT) == 0, ChipLogProgress(DeviceLayer, "FAIL: open pipe in %s", __func__)); + + // initialize server endpoint + endpoint = g_new0(BluezEndpoint, 1); + VerifyOrExit(endpoint != NULL, ChipLogProgress(DeviceLayer, "FAIL: memory allocation in %s", __func__)); + + if (apBleAddr != NULL) + endpoint->mpAdapterAddr = g_strdup(apBleAddr); + else + endpoint->mpAdapterAddr = NULL; + + endpoint->mpConnMap = g_hash_table_new(g_str_hash, g_str_equal); + endpoint->mIsCentral = aIsCentral; + + err = ConfigureBluezAdv(aBleAdvConfig, endpoint); + SuccessOrExit(err); + + sBluezMainLoop = g_main_loop_new(NULL, FALSE); + VerifyOrExit(sBluezMainLoop != NULL, ChipLogProgress(DeviceLayer, "FAIL: memory alloc in %s", __func__)); + + pthreadErr = pthread_create(&sBluezThread, NULL, BluezMainLoop, endpoint); + tmpErrno = errno; + VerifyOrExit(pthreadErr == 0, ChipLogProgress(DeviceLayer, "FAIL: pthread_create (%s) in %s", strerror(tmpErrno), __func__)); + sleep(1); + + retval = TRUE; + +exit: + if (retval) + { + apEndpoint = endpoint; + ChipLogProgress(DeviceLayer, "PlatformBlueZInit init success"); + } + else + { + EndpointCleanup(endpoint); + } + + return err; +} + +} // namespace Internal +} // namespace DeviceLayer +} // namespace chip +#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/Linux/CHIPBluezHelper.h b/src/platform/Linux/CHIPBluezHelper.h new file mode 100644 index 00000000000000..2bed2fa5ffdb83 --- /dev/null +++ b/src/platform/Linux/CHIPBluezHelper.h @@ -0,0 +1,206 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Copyright (c) 2016-2019, The OpenThread Authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the copyright holder nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * @file + * Provides Bluez dbus implementation for BLE + */ + +#ifndef CHIP_BLUEZ_HELPER_H +#define CHIP_BLUEZ_HELPER_H + +#include "BLEManagerImpl.h" +#include +#include +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + +#include "Linux/gen/DbusBluez.h" + +namespace chip { +namespace DeviceLayer { +namespace Internal { + +#define BLUEZ_ADDRESS_SIZE 6 ///< BLE address size (in bytes) +#define BLUEZ_PATH "/org/bluez" +#define BLUEZ_INTERFACE "org.bluez" +#define ADAPTER_INTERFACE BLUEZ_INTERFACE ".Adapter1" +#define PROFILE_INTERFACE BLUEZ_INTERFACE ".GattManager1" +#define ADVERTISING_MANAGER_INTERFACE BLUEZ_INTERFACE ".LEAdvertisingManager1" +#define SERVICE_INTERFACE BLUEZ_INTERFACE ".GattService1" +#define CHARACTERISTIC_INTERFACE BLUEZ_INTERFACE ".GattCharacteristic1" +#define ADVERTISING_INTERFACE BLUEZ_INTERFACE ".LEAdvertisement1" +#define DEVICE_INTERFACE BLUEZ_INTERFACE ".Device1" + +#define CHIP_PLAT_BLE_UUID_C1_STRING "18ee2ef5-263d-4559-959f-4f9c429f9d11" +#define CHIP_PLAT_BLE_UUID_C2_STRING "18ee2ef5-263d-4559-959f-4f9c429f9d12" + +#define CHIP_BLE_BASE_SERVICE_UUID_STRING "-0000-1000-8000-00805f9b34fb" +#define CHIP_BLE_SERVICE_PREFIX_LENGTH 8 +#define CHIP_BLE_BASE_SERVICE_PREFIX "0000" +#define CHIP_BLE_UUID_SERVICE_SHORT_STRING "fffb" + +#define CHIP_BLE_UUID_SERVICE_STRING \ + CHIP_BLE_BASE_SERVICE_PREFIX CHIP_BLE_UUID_SERVICE_SHORT_STRING CHIP_BLE_BASE_SERVICE_UUID_STRING + +#define BLUEZ_ADV_TYPE_FLAGS 0x01 +#define BLUEZ_ADV_TYPE_SERVICE_DATA 0x16 + +#define BLUEZ_ADV_FLAGS_LE_LIMITED (1 << 0) +#define BLUEZ_ADV_FLAGS_LE_DISCOVERABLE (1 << 1) +#define BLUEZ_ADV_FLAGS_EDR_UNSUPPORTED (1 << 2) +#define BLUEZ_ADV_FLAGS_LE_EDR_CONTROLLER (1 << 3) +#define BLUEZ_ADV_FLAGS_LE_EDR_HOST (1 << 4) + +#define CHAR_TO_BLUEZ(c) (((c) <= '9') ? (c) - '0' : tolower((c)) - 'a' + 10) + +enum BluezAddressType +{ + BLUEZ_ADDRESS_TYPE_PUBLIC = 0, ///< Bluetooth public device address. + BLUEZ_ADDRESS_TYPE_RANDOM_STATIC = 1, ///< Bluetooth random static address. + BLUEZ_ADDRESS_TYPE_RANDOM_PRIVATE_RESOLVABLE = 2, ///< Bluetooth random private resolvable address. + BLUEZ_ADDRESS_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE = 3, ///< Bluetooth random private non-resolvable address. +}; + +struct BluezAddress +{ + BluezAddressType mType; ///< Bluetooth device address type. + uint8_t mAddress[BLUEZ_ADDRESS_SIZE]; ///< A 48-bit address of Bluetooth device in LSB format. +}; + +struct IOChannel +{ + GIOChannel * mpChannel; + guint mWatch; +}; + +struct CHIPIdInfo +{ + uint8_t mMajor; + uint8_t mMinor; + uint16_t mVendorId; + uint16_t mProductId; + uint64_t mDeviceId; + uint8_t mPairingStatus; +} __attribute__((packed)); + +struct CHIPServiceData +{ + uint8_t mDataBlock0Len; + uint8_t mDataBlock0Type; + CHIPIdInfo mIdInfo; +} __attribute__((packed)); + +struct BluezEndpoint +{ + char * mpOwningName; // Bus owning name + + // Adapter properties + char * mpAdapterName; + char * mpAdapterAddr; + + // Paths for objects published by this service + char * mpRootPath; + char * mpAdvPath; + char * mpServicePath; + + // Objects (interfaces) subscibed to by this service + GDBusObjectManager * mpObjMgr; + BluezAdapter1 * mpAdapter; + BluezDevice1 * mpDevice; + + // Objects (interfaces) published by this service + GDBusObjectManagerServer * mpRoot; + BluezGattService1 * mpService; + BluezGattCharacteristic1 * mpC1; + BluezGattCharacteristic1 * mpC2; + + // map device path to the connection + GHashTable * mpConnMap; + uint32_t mNodeId; + bool mIsNotify; + bool mIsCentral; + char * mpAdvertisingUUID; + CHIPServiceData * mpChipServiceData; + ChipAdvType mType; ///< Advertisement type. + uint16_t mDuration; ///< Advertisement interval (in ms). + bool mIsAdvertising; + char * mpPeerDevicePath; +}; + +struct BluezConnection +{ + char * mpPeerAddress; + BluezDevice1 * mpDevice; + BluezGattService1 * mpService; + BluezGattCharacteristic1 * mpC1; + BluezGattCharacteristic1 * mpC2; + bool mIsNotify; + uint16_t mMtu; + struct IOChannel mC1Channel; + struct IOChannel mC2Channel; + BluezEndpoint * mpEndpoint; +}; + +struct ConnectionDataBundle +{ + BluezConnection * mpConn; + GVariant * mpVal; +}; + +CHIP_ERROR InitBluezBleLayer(bool aIsCentral, char * apBleAddr, BLEAdvConfig & aBleAdvConfig, void *& apEndpoint); +bool BluezRunOnBluezThread(int (*aCallback)(void *), void * apClosure); +bool SendBluezIndication(void * apConn, chip::System::PacketBuffer * apBuf); +bool CloseBluezConnection(void * apAppState); +CHIP_ERROR StartBluezAdv(void * apAppState); +CHIP_ERROR StopBluezAdv(void * apAppState); +CHIP_ERROR BluezGattsAppRegister(void * apAppState); +CHIP_ERROR BluezAdvertisementSetup(void * apAppState); + +} // namespace Internal +} // namespace DeviceLayer +} // namespace chip + +#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#endif // CHIP_BLUEZ_HELPER_H diff --git a/src/platform/Linux/CHIPDevicePlatformEvent.h b/src/platform/Linux/CHIPDevicePlatformEvent.h index 55f7feaef0028c..998ab75aea774b 100644 --- a/src/platform/Linux/CHIPDevicePlatformEvent.h +++ b/src/platform/Linux/CHIPDevicePlatformEvent.h @@ -51,8 +51,12 @@ enum PublicPlatformSpecificEventTypes enum InternalPlatformSpecificEventTypes { kPlatformLinuxEvent = kRange_InternalPlatformSpecific, - kPlatformLinuxBleC1WriteEvent, - kPlatformLinuxBleOutOfBuffersEvent, + kPlatformLinuxBLEC1WriteEvent, + kPlatformLinuxBLEOutOfBuffersEvent, + kPlatformLinuxBLEPeripheralRegisterAppComplete, + kPlatformLinuxBLEPeripheralAdvConfiguredComplete, + kPlatformLinuxBLEPeripheralAdvStartComplete, + kPlatformLinuxBLEPeripheralAdvStopComplete }; } // namespace DeviceEventType @@ -60,15 +64,30 @@ enum InternalPlatformSpecificEventTypes /** * Represents platform-specific event information for Linux platforms. */ -struct ChipDevicePlatformEvent final +struct ChipDevicePlatformEvent { union { struct { - uint16_t ConnId; - ::chip::System::PacketBuffer * Data; - } BleC1WriteEvent; + bool mIsSuccess; + void * mpAppstate; + } BLEPeripheralRegisterAppComplete; + struct + { + bool mIsSuccess; + void * mpAppstate; + } BLEPeripheralAdvConfiguredComplete; + struct + { + bool mIsSuccess; + void * mpAppstate; + } BLEPeripheralAdvStartComplete; + struct + { + bool mIsSuccess; + void * mpAppstate; + } BLEPeripheralAdvStopComplete; }; }; diff --git a/src/platform/Linux/dbus/DbusBluez.c b/src/platform/Linux/dbus/DbusBluez.c new file mode 100644 index 00000000000000..c15477af956678 --- /dev/null +++ b/src/platform/Linux/dbus/DbusBluez.c @@ -0,0 +1,20468 @@ +/* + * This file is generated by gdbus-codegen, do not modify it. + * + * The license of this code is the same as for the D-Bus interface description + * it was derived from. Note that it links to GLib, so must comply with the + * LGPL linking clauses. + */ + +#ifdef HAVE_CONFIG_H +#include "BuildConfig.h" +#endif + +#include "DbusBluez.h" + +#include +#ifdef G_OS_UNIX +#include +#endif + +typedef struct +{ + GDBusArgInfo parent_struct; + gboolean use_gvariant; +} _ExtendedGDBusArgInfo; + +typedef struct +{ + GDBusMethodInfo parent_struct; + const gchar * signal_name; + gboolean pass_fdlist; +} _ExtendedGDBusMethodInfo; + +typedef struct +{ + GDBusSignalInfo parent_struct; + const gchar * signal_name; +} _ExtendedGDBusSignalInfo; + +typedef struct +{ + GDBusPropertyInfo parent_struct; + const gchar * hyphen_name; + guint use_gvariant : 1; + guint emits_changed_signal : 1; +} _ExtendedGDBusPropertyInfo; + +typedef struct +{ + GDBusInterfaceInfo parent_struct; + const gchar * hyphen_name; +} _ExtendedGDBusInterfaceInfo; + +typedef struct +{ + const _ExtendedGDBusPropertyInfo * info; + guint prop_id; + GValue orig_value; /* the value before the change */ +} ChangedProperty; + +static void _changed_property_free(ChangedProperty * data) +{ + g_value_unset(&data->orig_value); + g_free(data); +} + +static gboolean _g_strv_equal0(gchar ** a, gchar ** b) +{ + gboolean ret = FALSE; + guint n; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + if (g_strv_length(a) != g_strv_length(b)) + goto out; + for (n = 0; a[n] != NULL; n++) + if (g_strcmp0(a[n], b[n]) != 0) + goto out; + ret = TRUE; +out: + return ret; +} + +static gboolean _g_variant_equal0(GVariant * a, GVariant * b) +{ + gboolean ret = FALSE; + if (a == NULL && b == NULL) + { + ret = TRUE; + goto out; + } + if (a == NULL || b == NULL) + goto out; + ret = g_variant_equal(a, b); +out: + return ret; +} + +G_GNUC_UNUSED static gboolean _g_value_equal(const GValue * a, const GValue * b) +{ + gboolean ret = FALSE; + g_assert(G_VALUE_TYPE(a) == G_VALUE_TYPE(b)); + switch (G_VALUE_TYPE(a)) + { + case G_TYPE_BOOLEAN: + ret = (g_value_get_boolean(a) == g_value_get_boolean(b)); + break; + case G_TYPE_UCHAR: + ret = (g_value_get_uchar(a) == g_value_get_uchar(b)); + break; + case G_TYPE_INT: + ret = (g_value_get_int(a) == g_value_get_int(b)); + break; + case G_TYPE_UINT: + ret = (g_value_get_uint(a) == g_value_get_uint(b)); + break; + case G_TYPE_INT64: + ret = (g_value_get_int64(a) == g_value_get_int64(b)); + break; + case G_TYPE_UINT64: + ret = (g_value_get_uint64(a) == g_value_get_uint64(b)); + break; + case G_TYPE_DOUBLE: { + /* Avoid -Wfloat-equal warnings by doing a direct bit compare */ + gdouble da = g_value_get_double(a); + gdouble db = g_value_get_double(b); + ret = memcmp(&da, &db, sizeof(gdouble)) == 0; + } + break; + case G_TYPE_STRING: + ret = (g_strcmp0(g_value_get_string(a), g_value_get_string(b)) == 0); + break; + case G_TYPE_VARIANT: + ret = _g_variant_equal0(g_value_get_variant(a), g_value_get_variant(b)); + break; + default: + if (G_VALUE_TYPE(a) == G_TYPE_STRV) + ret = _g_strv_equal0(g_value_get_boxed(a), g_value_get_boxed(b)); + else + g_critical("_g_value_equal() does not handle type %s", g_type_name(G_VALUE_TYPE(a))); + break; + } + return ret; +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.Adapter1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezAdapter1 + * @title: BluezAdapter1 + * @short_description: Generated C code for the org.bluez.Adapter1 D-Bus interface + * + * This section contains code for working with the org.bluez.Adapter1 D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.Adapter1 ---- */ + +static const _ExtendedGDBusMethodInfo _bluez_adapter1_method_info_start_discovery = { + { -1, (gchar *) "StartDiscovery", NULL, NULL, NULL }, "handle-start-discovery", FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_adapter1_method_info_set_discovery_filter_IN_ARG_properties = { + { -1, (gchar *) "properties", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_adapter1_method_info_set_discovery_filter_IN_ARG_pointers[] = { + &_bluez_adapter1_method_info_set_discovery_filter_IN_ARG_properties.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_adapter1_method_info_set_discovery_filter = { + { -1, (gchar *) "SetDiscoveryFilter", (GDBusArgInfo **) &_bluez_adapter1_method_info_set_discovery_filter_IN_ARG_pointers, NULL, + NULL }, + "handle-set-discovery-filter", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _bluez_adapter1_method_info_stop_discovery = { + { -1, (gchar *) "StopDiscovery", NULL, NULL, NULL }, "handle-stop-discovery", FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_adapter1_method_info_remove_device_IN_ARG_device = { + { -1, (gchar *) "device", (gchar *) "o", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_adapter1_method_info_remove_device_IN_ARG_pointers[] = { + &_bluez_adapter1_method_info_remove_device_IN_ARG_device.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_adapter1_method_info_remove_device = { + { -1, (gchar *) "RemoveDevice", (GDBusArgInfo **) &_bluez_adapter1_method_info_remove_device_IN_ARG_pointers, NULL, NULL }, + "handle-remove-device", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_adapter1_method_info_get_discovery_filters_OUT_ARG_filters = { + { -1, (gchar *) "filters", (gchar *) "as", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_adapter1_method_info_get_discovery_filters_OUT_ARG_pointers[] = { + &_bluez_adapter1_method_info_get_discovery_filters_OUT_ARG_filters.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_adapter1_method_info_get_discovery_filters = { + { -1, (gchar *) "GetDiscoveryFilters", NULL, + (GDBusArgInfo **) &_bluez_adapter1_method_info_get_discovery_filters_OUT_ARG_pointers, NULL }, + "handle-get-discovery-filters", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_adapter1_method_info_connect_device_IN_ARG_properties = { + { -1, (gchar *) "properties", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_adapter1_method_info_connect_device_IN_ARG_pointers[] = { + &_bluez_adapter1_method_info_connect_device_IN_ARG_properties.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_adapter1_method_info_connect_device = { + { -1, (gchar *) "ConnectDevice", (GDBusArgInfo **) &_bluez_adapter1_method_info_connect_device_IN_ARG_pointers, NULL, NULL }, + "handle-connect-device", + FALSE +}; + +static const GDBusMethodInfo * const _bluez_adapter1_method_info_pointers[] = { + &_bluez_adapter1_method_info_start_discovery.parent_struct, + &_bluez_adapter1_method_info_set_discovery_filter.parent_struct, + &_bluez_adapter1_method_info_stop_discovery.parent_struct, + &_bluez_adapter1_method_info_remove_device.parent_struct, + &_bluez_adapter1_method_info_get_discovery_filters.parent_struct, + &_bluez_adapter1_method_info_connect_device.parent_struct, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_address = { + { -1, (gchar *) "Address", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "address", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_address_type = { + { -1, (gchar *) "AddressType", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "address-type", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_name = { + { -1, (gchar *) "Name", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "name", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_alias = { + { -1, (gchar *) "Alias", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, + "alias", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_class = { + { -1, (gchar *) "Class", (gchar *) "u", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "class", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_powered = { + { -1, (gchar *) "Powered", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, + "powered", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_discoverable = { + { -1, (gchar *) "Discoverable", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL }, + "discoverable", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_discoverable_timeout = { + { -1, (gchar *) "DiscoverableTimeout", (gchar *) "u", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL }, + "discoverable-timeout", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_pairable = { + { -1, (gchar *) "Pairable", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, + "pairable", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_pairable_timeout = { + { -1, (gchar *) "PairableTimeout", (gchar *) "u", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, + NULL }, + "pairable-timeout", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_discovering = { + { -1, (gchar *) "Discovering", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "discovering", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_uuids = { + { -1, (gchar *) "UUIDs", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "uuids", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_modalias = { + { -1, (gchar *) "Modalias", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "modalias", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_adapter1_property_info_roles = { + { -1, (gchar *) "Roles", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "roles", FALSE, TRUE +}; + +static const GDBusPropertyInfo * const _bluez_adapter1_property_info_pointers[] = { + &_bluez_adapter1_property_info_address.parent_struct, + &_bluez_adapter1_property_info_address_type.parent_struct, + &_bluez_adapter1_property_info_name.parent_struct, + &_bluez_adapter1_property_info_alias.parent_struct, + &_bluez_adapter1_property_info_class.parent_struct, + &_bluez_adapter1_property_info_powered.parent_struct, + &_bluez_adapter1_property_info_discoverable.parent_struct, + &_bluez_adapter1_property_info_discoverable_timeout.parent_struct, + &_bluez_adapter1_property_info_pairable.parent_struct, + &_bluez_adapter1_property_info_pairable_timeout.parent_struct, + &_bluez_adapter1_property_info_discovering.parent_struct, + &_bluez_adapter1_property_info_uuids.parent_struct, + &_bluez_adapter1_property_info_modalias.parent_struct, + &_bluez_adapter1_property_info_roles.parent_struct, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_adapter1_interface_info = { + { -1, (gchar *) "org.bluez.Adapter1", (GDBusMethodInfo **) &_bluez_adapter1_method_info_pointers, NULL, + (GDBusPropertyInfo **) &_bluez_adapter1_property_info_pointers, NULL }, + "adapter1", +}; + +/** + * bluez_adapter1_interface_info: + * + * Gets a machine-readable description of the org.bluez.Adapter1 D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_adapter1_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_adapter1_interface_info.parent_struct; +} + +/** + * bluez_adapter1_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezAdapter1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_adapter1_override_properties(GObjectClass * klass, guint property_id_begin) +{ + g_object_class_override_property(klass, property_id_begin++, "address"); + g_object_class_override_property(klass, property_id_begin++, "address-type"); + g_object_class_override_property(klass, property_id_begin++, "name"); + g_object_class_override_property(klass, property_id_begin++, "alias"); + g_object_class_override_property(klass, property_id_begin++, "class"); + g_object_class_override_property(klass, property_id_begin++, "powered"); + g_object_class_override_property(klass, property_id_begin++, "discoverable"); + g_object_class_override_property(klass, property_id_begin++, "discoverable-timeout"); + g_object_class_override_property(klass, property_id_begin++, "pairable"); + g_object_class_override_property(klass, property_id_begin++, "pairable-timeout"); + g_object_class_override_property(klass, property_id_begin++, "discovering"); + g_object_class_override_property(klass, property_id_begin++, "uuids"); + g_object_class_override_property(klass, property_id_begin++, "modalias"); + g_object_class_override_property(klass, property_id_begin++, "roles"); + return property_id_begin - 1; +} + +/** + * BluezAdapter1: + * + * Abstract interface type for the D-Bus interface org.bluez.Adapter1. + */ + +/** + * BluezAdapter1Iface: + * @parent_iface: The parent interface. + * @handle_connect_device: Handler for the #BluezAdapter1::handle-connect-device signal. + * @handle_get_discovery_filters: Handler for the #BluezAdapter1::handle-get-discovery-filters signal. + * @handle_remove_device: Handler for the #BluezAdapter1::handle-remove-device signal. + * @handle_set_discovery_filter: Handler for the #BluezAdapter1::handle-set-discovery-filter signal. + * @handle_start_discovery: Handler for the #BluezAdapter1::handle-start-discovery signal. + * @handle_stop_discovery: Handler for the #BluezAdapter1::handle-stop-discovery signal. + * @get_address: Getter for the #BluezAdapter1:address property. + * @get_address_type: Getter for the #BluezAdapter1:address-type property. + * @get_alias: Getter for the #BluezAdapter1:alias property. + * @get_class: Getter for the #BluezAdapter1:class property. + * @get_discoverable: Getter for the #BluezAdapter1:discoverable property. + * @get_discoverable_timeout: Getter for the #BluezAdapter1:discoverable-timeout property. + * @get_discovering: Getter for the #BluezAdapter1:discovering property. + * @get_modalias: Getter for the #BluezAdapter1:modalias property. + * @get_name: Getter for the #BluezAdapter1:name property. + * @get_pairable: Getter for the #BluezAdapter1:pairable property. + * @get_pairable_timeout: Getter for the #BluezAdapter1:pairable-timeout property. + * @get_powered: Getter for the #BluezAdapter1:powered property. + * @get_roles: Getter for the #BluezAdapter1:roles property. + * @get_uuids: Getter for the #BluezAdapter1:uuids property. + * + * Virtual table for the D-Bus interface org.bluez.Adapter1. + */ + +typedef BluezAdapter1Iface BluezAdapter1Interface; +G_DEFINE_INTERFACE(BluezAdapter1, bluez_adapter1, G_TYPE_OBJECT) + +static void bluez_adapter1_default_init(BluezAdapter1Iface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezAdapter1::handle-start-discovery: + * @object: A #BluezAdapter1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the StartDiscovery() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_adapter1_complete_start_discovery() or e.g. g_dbus_method_invocation_return_error() on + * it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-start-discovery", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezAdapter1Iface, handle_start_discovery), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * BluezAdapter1::handle-set-discovery-filter: + * @object: A #BluezAdapter1. + * @invocation: A #GDBusMethodInvocation. + * @arg_properties: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the SetDiscoveryFilter() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_adapter1_complete_set_discovery_filter() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-set-discovery-filter", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezAdapter1Iface, handle_set_discovery_filter), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); + + /** + * BluezAdapter1::handle-stop-discovery: + * @object: A #BluezAdapter1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the StopDiscovery() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_adapter1_complete_stop_discovery() or e.g. g_dbus_method_invocation_return_error() on + * it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-stop-discovery", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezAdapter1Iface, handle_stop_discovery), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * BluezAdapter1::handle-remove-device: + * @object: A #BluezAdapter1. + * @invocation: A #GDBusMethodInvocation. + * @arg_device: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the RemoveDevice() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_adapter1_complete_remove_device() or e.g. g_dbus_method_invocation_return_error() on + * it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-remove-device", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezAdapter1Iface, handle_remove_device), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * BluezAdapter1::handle-get-discovery-filters: + * @object: A #BluezAdapter1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the GetDiscoveryFilters() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_adapter1_complete_get_discovery_filters() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-get-discovery-filters", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezAdapter1Iface, handle_get_discovery_filters), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * BluezAdapter1::handle-connect-device: + * @object: A #BluezAdapter1. + * @invocation: A #GDBusMethodInvocation. + * @arg_properties: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the ConnectDevice() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_adapter1_complete_connect_device() or e.g. g_dbus_method_invocation_return_error() on + * it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-connect-device", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezAdapter1Iface, handle_connect_device), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); + + /* GObject properties for D-Bus properties: */ + /** + * BluezAdapter1:address: + * + * Represents the D-Bus property "Address". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("address", "Address", "Address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:address-type: + * + * Represents the D-Bus property "AddressType". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("address-type", "AddressType", "AddressType", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:name: + * + * Represents the D-Bus property "Name". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:alias: + * + * Represents the D-Bus property "Alias". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("alias", "Alias", "Alias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:class: + * + * Represents the D-Bus property "Class". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_uint("class", "Class", "Class", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:powered: + * + * Represents the D-Bus property "Powered". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boolean("powered", "Powered", "Powered", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:discoverable: + * + * Represents the D-Bus property "Discoverable". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_boolean("discoverable", "Discoverable", "Discoverable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:discoverable-timeout: + * + * Represents the D-Bus property "DiscoverableTimeout". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property(iface, + g_param_spec_uint("discoverable-timeout", "DiscoverableTimeout", "DiscoverableTimeout", 0, + G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:pairable: + * + * Represents the D-Bus property "Pairable". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boolean("pairable", "Pairable", "Pairable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:pairable-timeout: + * + * Represents the D-Bus property "PairableTimeout". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property(iface, + g_param_spec_uint("pairable-timeout", "PairableTimeout", "PairableTimeout", 0, G_MAXUINT32, + 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:discovering: + * + * Represents the D-Bus property "Discovering". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_boolean("discovering", "Discovering", "Discovering", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:uuids: + * + * Represents the D-Bus property "UUIDs". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boxed("uuids", "UUIDs", "UUIDs", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:modalias: + * + * Represents the D-Bus property "Modalias". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("modalias", "Modalias", "Modalias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezAdapter1:roles: + * + * Represents the D-Bus property "Roles". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boxed("roles", "Roles", "Roles", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * bluez_adapter1_get_address: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Address" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_adapter1_dup_address() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_adapter1_get_address(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_address(object); +} + +/** + * bluez_adapter1_dup_address: (skip) + * @object: A #BluezAdapter1. + * + * Gets a copy of the "Address" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_adapter1_dup_address(BluezAdapter1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "address", &value, NULL); + return value; +} + +/** + * bluez_adapter1_set_address: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Address" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_adapter1_set_address(BluezAdapter1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "address", value, NULL); +} + +/** + * bluez_adapter1_get_address_type: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "AddressType" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_adapter1_dup_address_type() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_adapter1_get_address_type(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_address_type(object); +} + +/** + * bluez_adapter1_dup_address_type: (skip) + * @object: A #BluezAdapter1. + * + * Gets a copy of the "AddressType" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_adapter1_dup_address_type(BluezAdapter1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "address-type", &value, NULL); + return value; +} + +/** + * bluez_adapter1_set_address_type: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "AddressType" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_adapter1_set_address_type(BluezAdapter1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "address-type", value, NULL); +} + +/** + * bluez_adapter1_get_name: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Name" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_adapter1_dup_name() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_adapter1_get_name(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_name(object); +} + +/** + * bluez_adapter1_dup_name: (skip) + * @object: A #BluezAdapter1. + * + * Gets a copy of the "Name" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_adapter1_dup_name(BluezAdapter1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "name", &value, NULL); + return value; +} + +/** + * bluez_adapter1_set_name: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Name" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_adapter1_set_name(BluezAdapter1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "name", value, NULL); +} + +/** + * bluez_adapter1_get_alias: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Alias" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_adapter1_dup_alias() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_adapter1_get_alias(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_alias(object); +} + +/** + * bluez_adapter1_dup_alias: (skip) + * @object: A #BluezAdapter1. + * + * Gets a copy of the "Alias" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_adapter1_dup_alias(BluezAdapter1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "alias", &value, NULL); + return value; +} + +/** + * bluez_adapter1_set_alias: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Alias" D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_adapter1_set_alias(BluezAdapter1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "alias", value, NULL); +} + +/** + * bluez_adapter1_get_class: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Class" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint bluez_adapter1_get_class(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_class(object); +} + +/** + * bluez_adapter1_set_class: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Class" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_adapter1_set_class(BluezAdapter1 * object, guint value) +{ + g_object_set(G_OBJECT(object), "class", value, NULL); +} + +/** + * bluez_adapter1_get_powered: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Powered" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: The property value. + */ +gboolean bluez_adapter1_get_powered(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_powered(object); +} + +/** + * bluez_adapter1_set_powered: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Powered" D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_adapter1_set_powered(BluezAdapter1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "powered", value, NULL); +} + +/** + * bluez_adapter1_get_discoverable: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Discoverable" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: The property value. + */ +gboolean bluez_adapter1_get_discoverable(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_discoverable(object); +} + +/** + * bluez_adapter1_set_discoverable: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Discoverable" D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_adapter1_set_discoverable(BluezAdapter1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "discoverable", value, NULL); +} + +/** + * bluez_adapter1_get_discoverable_timeout: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "DiscoverableTimeout" D-Bus + * property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: The property value. + */ +guint bluez_adapter1_get_discoverable_timeout(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_discoverable_timeout(object); +} + +/** + * bluez_adapter1_set_discoverable_timeout: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "DiscoverableTimeout" D-Bus property to + * @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_adapter1_set_discoverable_timeout(BluezAdapter1 * object, guint value) +{ + g_object_set(G_OBJECT(object), "discoverable-timeout", value, NULL); +} + +/** + * bluez_adapter1_get_pairable: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Pairable" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: The property value. + */ +gboolean bluez_adapter1_get_pairable(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_pairable(object); +} + +/** + * bluez_adapter1_set_pairable: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Pairable" D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_adapter1_set_pairable(BluezAdapter1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "pairable", value, NULL); +} + +/** + * bluez_adapter1_get_pairable_timeout: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "PairableTimeout" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: The property value. + */ +guint bluez_adapter1_get_pairable_timeout(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_pairable_timeout(object); +} + +/** + * bluez_adapter1_set_pairable_timeout: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "PairableTimeout" D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_adapter1_set_pairable_timeout(BluezAdapter1 * object, guint value) +{ + g_object_set(G_OBJECT(object), "pairable-timeout", value, NULL); +} + +/** + * bluez_adapter1_get_discovering: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Discovering" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_adapter1_get_discovering(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_discovering(object); +} + +/** + * bluez_adapter1_set_discovering: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Discovering" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_adapter1_set_discovering(BluezAdapter1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "discovering", value, NULL); +} + +/** + * bluez_adapter1_get_uuids: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "UUIDs" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_adapter1_dup_uuids() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * const * bluez_adapter1_get_uuids(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_uuids(object); +} + +/** + * bluez_adapter1_dup_uuids: (skip) + * @object: A #BluezAdapter1. + * + * Gets a copy of the "UUIDs" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_strfreev(). + */ +gchar ** bluez_adapter1_dup_uuids(BluezAdapter1 * object) +{ + gchar ** value; + g_object_get(G_OBJECT(object), "uuids", &value, NULL); + return value; +} + +/** + * bluez_adapter1_set_uuids: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "UUIDs" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_adapter1_set_uuids(BluezAdapter1 * object, const gchar * const * value) +{ + g_object_set(G_OBJECT(object), "uuids", value, NULL); +} + +/** + * bluez_adapter1_get_modalias: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Modalias" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_adapter1_dup_modalias() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_adapter1_get_modalias(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_modalias(object); +} + +/** + * bluez_adapter1_dup_modalias: (skip) + * @object: A #BluezAdapter1. + * + * Gets a copy of the "Modalias" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_adapter1_dup_modalias(BluezAdapter1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "modalias", &value, NULL); + return value; +} + +/** + * bluez_adapter1_set_modalias: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Modalias" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_adapter1_set_modalias(BluezAdapter1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "modalias", value, NULL); +} + +/** + * bluez_adapter1_get_roles: (skip) + * @object: A #BluezAdapter1. + * + * Gets the value of the "Roles" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_adapter1_dup_roles() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * const * bluez_adapter1_get_roles(BluezAdapter1 * object) +{ + return BLUEZ_ADAPTER1_GET_IFACE(object)->get_roles(object); +} + +/** + * bluez_adapter1_dup_roles: (skip) + * @object: A #BluezAdapter1. + * + * Gets a copy of the "Roles" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_strfreev(). + */ +gchar ** bluez_adapter1_dup_roles(BluezAdapter1 * object) +{ + gchar ** value; + g_object_get(G_OBJECT(object), "roles", &value, NULL); + return value; +} + +/** + * bluez_adapter1_set_roles: (skip) + * @object: A #BluezAdapter1. + * @value: The value to set. + * + * Sets the "Roles" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_adapter1_set_roles(BluezAdapter1 * object, const gchar * const * value) +{ + g_object_set(G_OBJECT(object), "roles", value, NULL); +} + +/** + * bluez_adapter1_call_start_discovery: + * @proxy: A #BluezAdapter1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the StartDiscovery() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_adapter1_call_start_discovery_finish() to + * get the result of the operation. + * + * See bluez_adapter1_call_start_discovery_sync() for the synchronous, blocking version of this method. + */ +void bluez_adapter1_call_start_discovery(BluezAdapter1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "StartDiscovery", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_adapter1_call_start_discovery_finish: + * @proxy: A #BluezAdapter1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_adapter1_call_start_discovery(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_adapter1_call_start_discovery(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_start_discovery_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_start_discovery_sync: + * @proxy: A #BluezAdapter1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the StartDiscovery() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_adapter1_call_start_discovery() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_start_discovery_sync(BluezAdapter1 * proxy, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "StartDiscovery", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_set_discovery_filter: + * @proxy: A #BluezAdapter1Proxy. + * @arg_properties: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the SetDiscoveryFilter() D-Bus + * method on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_adapter1_call_set_discovery_filter_finish() to get the result of the operation. + * + * See bluez_adapter1_call_set_discovery_filter_sync() for the synchronous, blocking version of this method. + */ +void bluez_adapter1_call_set_discovery_filter(BluezAdapter1 * proxy, GVariant * arg_properties, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "SetDiscoveryFilter", g_variant_new("(@a{sv})", arg_properties), G_DBUS_CALL_FLAGS_NONE, + -1, cancellable, callback, user_data); +} + +/** + * bluez_adapter1_call_set_discovery_filter_finish: + * @proxy: A #BluezAdapter1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_adapter1_call_set_discovery_filter(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_adapter1_call_set_discovery_filter(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_set_discovery_filter_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_set_discovery_filter_sync: + * @proxy: A #BluezAdapter1Proxy. + * @arg_properties: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the SetDiscoveryFilter() D-Bus + * method on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_adapter1_call_set_discovery_filter() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_set_discovery_filter_sync(BluezAdapter1 * proxy, GVariant * arg_properties, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "SetDiscoveryFilter", g_variant_new("(@a{sv})", arg_properties), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_stop_discovery: + * @proxy: A #BluezAdapter1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the StopDiscovery() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_adapter1_call_stop_discovery_finish() to get + * the result of the operation. + * + * See bluez_adapter1_call_stop_discovery_sync() for the synchronous, blocking version of this method. + */ +void bluez_adapter1_call_stop_discovery(BluezAdapter1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "StopDiscovery", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_adapter1_call_stop_discovery_finish: + * @proxy: A #BluezAdapter1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_adapter1_call_stop_discovery(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_adapter1_call_stop_discovery(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_stop_discovery_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_stop_discovery_sync: + * @proxy: A #BluezAdapter1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the StopDiscovery() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_adapter1_call_stop_discovery() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_stop_discovery_sync(BluezAdapter1 * proxy, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "StopDiscovery", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_remove_device: + * @proxy: A #BluezAdapter1Proxy. + * @arg_device: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the RemoveDevice() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_adapter1_call_remove_device_finish() to get + * the result of the operation. + * + * See bluez_adapter1_call_remove_device_sync() for the synchronous, blocking version of this method. + */ +void bluez_adapter1_call_remove_device(BluezAdapter1 * proxy, const gchar * arg_device, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "RemoveDevice", g_variant_new("(o)", arg_device), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_adapter1_call_remove_device_finish: + * @proxy: A #BluezAdapter1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_adapter1_call_remove_device(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_adapter1_call_remove_device(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_remove_device_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_remove_device_sync: + * @proxy: A #BluezAdapter1Proxy. + * @arg_device: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the RemoveDevice() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_adapter1_call_remove_device() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_remove_device_sync(BluezAdapter1 * proxy, const gchar * arg_device, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "RemoveDevice", g_variant_new("(o)", arg_device), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_get_discovery_filters: + * @proxy: A #BluezAdapter1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the GetDiscoveryFilters() D-Bus + * method on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_adapter1_call_get_discovery_filters_finish() to get the result of the operation. + * + * See bluez_adapter1_call_get_discovery_filters_sync() for the synchronous, blocking version of this method. + */ +void bluez_adapter1_call_get_discovery_filters(BluezAdapter1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "GetDiscoveryFilters", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, + callback, user_data); +} + +/** + * bluez_adapter1_call_get_discovery_filters_finish: + * @proxy: A #BluezAdapter1Proxy. + * @out_filters: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_adapter1_call_get_discovery_filters(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_adapter1_call_get_discovery_filters(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_get_discovery_filters_finish(BluezAdapter1 * proxy, gchar *** out_filters, GAsyncResult * res, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(^as)", out_filters); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_get_discovery_filters_sync: + * @proxy: A #BluezAdapter1Proxy. + * @out_filters: (out) (optional) (array zero-terminated=1): Return location for return parameter or %NULL to ignore. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the GetDiscoveryFilters() D-Bus + * method on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_adapter1_call_get_discovery_filters() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_get_discovery_filters_sync(BluezAdapter1 * proxy, gchar *** out_filters, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "GetDiscoveryFilters", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(^as)", out_filters); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_connect_device: + * @proxy: A #BluezAdapter1Proxy. + * @arg_properties: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the ConnectDevice() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_adapter1_call_connect_device_finish() to get + * the result of the operation. + * + * See bluez_adapter1_call_connect_device_sync() for the synchronous, blocking version of this method. + */ +void bluez_adapter1_call_connect_device(BluezAdapter1 * proxy, GVariant * arg_properties, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "ConnectDevice", g_variant_new("(@a{sv})", arg_properties), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_adapter1_call_connect_device_finish: + * @proxy: A #BluezAdapter1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_adapter1_call_connect_device(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_adapter1_call_connect_device(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_connect_device_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_call_connect_device_sync: + * @proxy: A #BluezAdapter1Proxy. + * @arg_properties: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the ConnectDevice() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_adapter1_call_connect_device() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_adapter1_call_connect_device_sync(BluezAdapter1 * proxy, GVariant * arg_properties, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "ConnectDevice", g_variant_new("(@a{sv})", arg_properties), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_adapter1_complete_start_discovery: + * @object: A #BluezAdapter1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the StartDiscovery() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_adapter1_complete_start_discovery(BluezAdapter1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_adapter1_complete_set_discovery_filter: + * @object: A #BluezAdapter1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the SetDiscoveryFilter() D-Bus method. If you instead want to + * finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_adapter1_complete_set_discovery_filter(BluezAdapter1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_adapter1_complete_stop_discovery: + * @object: A #BluezAdapter1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the StopDiscovery() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_adapter1_complete_stop_discovery(BluezAdapter1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_adapter1_complete_remove_device: + * @object: A #BluezAdapter1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the RemoveDevice() D-Bus method. If you instead want to finish handling + * an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_adapter1_complete_remove_device(BluezAdapter1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_adapter1_complete_get_discovery_filters: + * @object: A #BluezAdapter1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @filters: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the GetDiscoveryFilters() D-Bus method. If you instead want to + * finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_adapter1_complete_get_discovery_filters(BluezAdapter1 * object, GDBusMethodInvocation * invocation, + const gchar * const * filters) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("(^as)", filters)); +} + +/** + * bluez_adapter1_complete_connect_device: + * @object: A #BluezAdapter1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the ConnectDevice() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_adapter1_complete_connect_device(BluezAdapter1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezAdapter1Proxy: + * + * The #BluezAdapter1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezAdapter1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezAdapter1Proxy. + */ + +struct _BluezAdapter1ProxyPrivate +{ + GData * qdata; +}; + +static void bluez_adapter1_proxy_iface_init(BluezAdapter1Iface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezAdapter1Proxy, bluez_adapter1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezAdapter1Proxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ADAPTER1, bluez_adapter1_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezAdapter1Proxy, bluez_adapter1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ADAPTER1, bluez_adapter1_proxy_iface_init)) + +#endif +static void bluez_adapter1_proxy_finalize(GObject * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_adapter1_proxy_parent_class)->finalize(object); +} + +static void bluez_adapter1_proxy_get_property(GObject * object, guint prop_id, GValue * value, GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 14); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_adapter1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant(value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue(variant, value); + } + if (variant != NULL) + g_variant_unref(variant); +} + +static void bluez_adapter1_proxy_set_property_cb(GDBusProxy * proxy, GAsyncResult * res, gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo * info = user_data; + GError * error; + GVariant * _ret; + error = NULL; + _ret = g_dbus_proxy_call_finish(proxy, res, &error); + if (!_ret) + { + g_warning("Error setting property '%s' on interface org.bluez.Adapter1: %s (%s, %d)", info->parent_struct.name, + error->message, g_quark_to_string(error->domain), error->code); + g_error_free(error); + } + else + { + g_variant_unref(_ret); + } +} + +static void bluez_adapter1_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 14); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_adapter1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant(value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_dbus_proxy_call(G_DBUS_PROXY(object), "org.freedesktop.DBus.Properties.Set", + g_variant_new("(ssv)", "org.bluez.Adapter1", info->parent_struct.name, variant), G_DBUS_CALL_FLAGS_NONE, -1, + NULL, (GAsyncReadyCallback) bluez_adapter1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref(variant); +} + +static void bluez_adapter1_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, const gchar * signal_name, + GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_adapter1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_ADAPTER1); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_ADAPTER1); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_adapter1_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_adapter1_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_adapter1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static const gchar * bluez_adapter1_proxy_get_address(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Address"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_adapter1_proxy_get_address_type(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "AddressType"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_adapter1_proxy_get_name(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Name"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_adapter1_proxy_get_alias(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Alias"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static guint bluez_adapter1_proxy_get_class(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Class"); + if (variant != NULL) + { + value = g_variant_get_uint32(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_adapter1_proxy_get_powered(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Powered"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_adapter1_proxy_get_discoverable(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Discoverable"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static guint bluez_adapter1_proxy_get_discoverable_timeout(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "DiscoverableTimeout"); + if (variant != NULL) + { + value = g_variant_get_uint32(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_adapter1_proxy_get_pairable(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Pairable"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static guint bluez_adapter1_proxy_get_pairable_timeout(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "PairableTimeout"); + if (variant != NULL) + { + value = g_variant_get_uint32(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_adapter1_proxy_get_discovering(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Discovering"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static const gchar * const * bluez_adapter1_proxy_get_uuids(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + const gchar * const * value = NULL; + value = g_datalist_get_data(&proxy->priv->qdata, "UUIDs"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "UUIDs"); + if (variant != NULL) + { + value = g_variant_get_strv(variant, NULL); + g_datalist_set_data_full(&proxy->priv->qdata, "UUIDs", (gpointer) value, g_free); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_adapter1_proxy_get_modalias(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Modalias"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * const * bluez_adapter1_proxy_get_roles(BluezAdapter1 * object) +{ + BluezAdapter1Proxy * proxy = BLUEZ_ADAPTER1_PROXY(object); + GVariant * variant; + const gchar * const * value = NULL; + value = g_datalist_get_data(&proxy->priv->qdata, "Roles"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Roles"); + if (variant != NULL) + { + value = g_variant_get_strv(variant, NULL); + g_datalist_set_data_full(&proxy->priv->qdata, "Roles", (gpointer) value, g_free); + g_variant_unref(variant); + } + return value; +} + +static void bluez_adapter1_proxy_init(BluezAdapter1Proxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_adapter1_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_ADAPTER1_PROXY, BluezAdapter1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_adapter1_interface_info()); +} + +static void bluez_adapter1_proxy_class_init(BluezAdapter1ProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_adapter1_proxy_finalize; + gobject_class->get_property = bluez_adapter1_proxy_get_property; + gobject_class->set_property = bluez_adapter1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_adapter1_proxy_g_signal; + proxy_class->g_properties_changed = bluez_adapter1_proxy_g_properties_changed; + + bluez_adapter1_override_properties(gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezAdapter1ProxyPrivate)); +#endif +} + +static void bluez_adapter1_proxy_iface_init(BluezAdapter1Iface * iface) +{ + iface->get_address = bluez_adapter1_proxy_get_address; + iface->get_address_type = bluez_adapter1_proxy_get_address_type; + iface->get_name = bluez_adapter1_proxy_get_name; + iface->get_alias = bluez_adapter1_proxy_get_alias; + iface->get_class = bluez_adapter1_proxy_get_class; + iface->get_powered = bluez_adapter1_proxy_get_powered; + iface->get_discoverable = bluez_adapter1_proxy_get_discoverable; + iface->get_discoverable_timeout = bluez_adapter1_proxy_get_discoverable_timeout; + iface->get_pairable = bluez_adapter1_proxy_get_pairable; + iface->get_pairable_timeout = bluez_adapter1_proxy_get_pairable_timeout; + iface->get_discovering = bluez_adapter1_proxy_get_discovering; + iface->get_uuids = bluez_adapter1_proxy_get_uuids; + iface->get_modalias = bluez_adapter1_proxy_get_modalias; + iface->get_roles = bluez_adapter1_proxy_get_roles; +} + +/** + * bluez_adapter1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.bluez.Adapter1. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_adapter1_proxy_new_finish() to get the result of + * the operation. + * + * See bluez_adapter1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_adapter1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_ADAPTER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, + "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.bluez.Adapter1", NULL); +} + +/** + * bluez_adapter1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_adapter1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_adapter1_proxy_new(). + * + * Returns: (transfer full) (type BluezAdapter1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezAdapter1 * bluez_adapter1_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_ADAPTER1(ret); + else + return NULL; +} + +/** + * bluez_adapter1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.bluez.Adapter1. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_adapter1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezAdapter1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezAdapter1 * bluez_adapter1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_ADAPTER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", + connection, "g-object-path", object_path, "g-interface-name", "org.bluez.Adapter1", NULL); + if (ret != NULL) + return BLUEZ_ADAPTER1(ret); + else + return NULL; +} + +/** + * bluez_adapter1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_adapter1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_adapter1_proxy_new_for_bus_finish() to get the + * result of the operation. + * + * See bluez_adapter1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_adapter1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_ADAPTER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, + "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", + "org.bluez.Adapter1", NULL); +} + +/** + * bluez_adapter1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_adapter1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_adapter1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezAdapter1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezAdapter1 * bluez_adapter1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_ADAPTER1(ret); + else + return NULL; +} + +/** + * bluez_adapter1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_adapter1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_adapter1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezAdapter1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezAdapter1 * bluez_adapter1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_ADAPTER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, + "g-object-path", object_path, "g-interface-name", "org.bluez.Adapter1", NULL); + if (ret != NULL) + return BLUEZ_ADAPTER1(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezAdapter1Skeleton: + * + * The #BluezAdapter1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezAdapter1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezAdapter1Skeleton. + */ + +struct _BluezAdapter1SkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_adapter1_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name, const gchar * method_name, + GVariant * parameters, GDBusMethodInvocation * invocation, + gpointer user_data) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_ADAPTER1); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_ADAPTER1); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_adapter1_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_adapter1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean +_bluez_adapter1_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GVariant * variant, GError ** error, gpointer user_data) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_adapter1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_adapter1_skeleton_vtable = { _bluez_adapter1_skeleton_handle_method_call, + _bluez_adapter1_skeleton_handle_get_property, + _bluez_adapter1_skeleton_handle_set_property, + { NULL } }; + +static GDBusInterfaceInfo * bluez_adapter1_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_adapter1_interface_info(); +} + +static GDBusInterfaceVTable * bluez_adapter1_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_adapter1_skeleton_vtable; +} + +static GVariant * bluez_adapter1_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_adapter1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_adapter1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_adapter1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_adapter1_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.bluez.Adapter1", info->name, + NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static gboolean _bluez_adapter1_emit_changed(gpointer user_data); + +static void bluez_adapter1_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy(skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock(&skeleton->priv->lock); + + if (emit_changed) + _bluez_adapter1_emit_changed(skeleton); +} + +static void bluez_adapter1_skeleton_iface_init(BluezAdapter1Iface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezAdapter1Skeleton, bluez_adapter1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezAdapter1Skeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ADAPTER1, bluez_adapter1_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezAdapter1Skeleton, bluez_adapter1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ADAPTER1, bluez_adapter1_skeleton_iface_init)) + +#endif +static void bluez_adapter1_skeleton_finalize(GObject * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + guint n; + for (n = 0; n < 14; n++) + g_value_unset(&skeleton->priv->properties[n]); + g_free(skeleton->priv->properties); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_adapter1_skeleton_parent_class)->finalize(object); +} + +static void bluez_adapter1_skeleton_get_property(GObject * object, guint prop_id, GValue * value, GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 14); + g_mutex_lock(&skeleton->priv->lock); + g_value_copy(&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock(&skeleton->priv->lock); +} + +static gboolean _bluez_adapter1_emit_changed(gpointer user_data) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(user_data); + GList * l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock(&skeleton->priv->lock); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&invalidated_builder, G_VARIANT_TYPE("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty * cp = l->data; + GVariant * variant; + const GValue * cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal(cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant(cur_value, G_VARIANT_TYPE(cp->info->parent_struct.signature)); + g_variant_builder_add(&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref(variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant * signal_variant; + signal_variant = g_variant_ref_sink(g_variant_new("(sa{sv}as)", "org.bluez.Adapter1", &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection * connection = ll->data; + + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); + } + else + { + g_variant_builder_clear(&builder); + g_variant_builder_clear(&invalidated_builder); + } + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock(&skeleton->priv->lock); + return FALSE; +} + +static void _bluez_adapter1_schedule_emit_changed(BluezAdapter1Skeleton * skeleton, const _ExtendedGDBusPropertyInfo * info, + guint prop_id, const GValue * orig_value) +{ + ChangedProperty * cp; + GList * l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty * i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0(ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend(skeleton->priv->changed_properties, cp); + g_value_init(&cp->orig_value, G_VALUE_TYPE(orig_value)); + g_value_copy(orig_value, &cp->orig_value); + } +} + +static void bluez_adapter1_skeleton_notify(GObject * object, GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new(); + g_source_set_priority(skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback(skeleton->priv->changed_properties_idle_source, _bluez_adapter1_emit_changed, g_object_ref(skeleton), + (GDestroyNotify) g_object_unref); + g_source_set_name(skeleton->priv->changed_properties_idle_source, "[generated] _bluez_adapter1_emit_changed"); + g_source_attach(skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref(skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock(&skeleton->priv->lock); +} + +static void bluez_adapter1_skeleton_set_property(GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) +{ + const _ExtendedGDBusPropertyInfo * info; + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 14); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_adapter1_property_info_pointers[prop_id - 1]; + g_mutex_lock(&skeleton->priv->lock); + g_object_freeze_notify(object); + if (!_g_value_equal(value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)) != NULL && info->emits_changed_signal) + _bluez_adapter1_schedule_emit_changed(skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy(value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec(object, pspec); + } + g_mutex_unlock(&skeleton->priv->lock); + g_object_thaw_notify(object); +} + +static void bluez_adapter1_skeleton_init(BluezAdapter1Skeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_adapter1_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_ADAPTER1_SKELETON, BluezAdapter1SkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); + skeleton->priv->properties = g_new0(GValue, 14); + g_value_init(&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[2], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[3], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[4], G_TYPE_UINT); + g_value_init(&skeleton->priv->properties[5], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[6], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[7], G_TYPE_UINT); + g_value_init(&skeleton->priv->properties[8], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[9], G_TYPE_UINT); + g_value_init(&skeleton->priv->properties[10], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[11], G_TYPE_STRV); + g_value_init(&skeleton->priv->properties[12], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[13], G_TYPE_STRV); +} + +static const gchar * bluez_adapter1_skeleton_get_address(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[0])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_adapter1_skeleton_get_address_type(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[1])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_adapter1_skeleton_get_name(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[2])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_adapter1_skeleton_get_alias(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[3])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guint bluez_adapter1_skeleton_get_class(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + guint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uint(&(skeleton->priv->properties[4])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_adapter1_skeleton_get_powered(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[5])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_adapter1_skeleton_get_discoverable(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[6])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guint bluez_adapter1_skeleton_get_discoverable_timeout(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + guint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uint(&(skeleton->priv->properties[7])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_adapter1_skeleton_get_pairable(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[8])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guint bluez_adapter1_skeleton_get_pairable_timeout(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + guint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uint(&(skeleton->priv->properties[9])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_adapter1_skeleton_get_discovering(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[10])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * const * bluez_adapter1_skeleton_get_uuids(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + const gchar * const * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boxed(&(skeleton->priv->properties[11])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_adapter1_skeleton_get_modalias(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[12])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * const * bluez_adapter1_skeleton_get_roles(BluezAdapter1 * object) +{ + BluezAdapter1Skeleton * skeleton = BLUEZ_ADAPTER1_SKELETON(object); + const gchar * const * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boxed(&(skeleton->priv->properties[13])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static void bluez_adapter1_skeleton_class_init(BluezAdapter1SkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_adapter1_skeleton_finalize; + gobject_class->get_property = bluez_adapter1_skeleton_get_property; + gobject_class->set_property = bluez_adapter1_skeleton_set_property; + gobject_class->notify = bluez_adapter1_skeleton_notify; + + bluez_adapter1_override_properties(gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_adapter1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_adapter1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_adapter1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_adapter1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezAdapter1SkeletonPrivate)); +#endif +} + +static void bluez_adapter1_skeleton_iface_init(BluezAdapter1Iface * iface) +{ + iface->get_address = bluez_adapter1_skeleton_get_address; + iface->get_address_type = bluez_adapter1_skeleton_get_address_type; + iface->get_name = bluez_adapter1_skeleton_get_name; + iface->get_alias = bluez_adapter1_skeleton_get_alias; + iface->get_class = bluez_adapter1_skeleton_get_class; + iface->get_powered = bluez_adapter1_skeleton_get_powered; + iface->get_discoverable = bluez_adapter1_skeleton_get_discoverable; + iface->get_discoverable_timeout = bluez_adapter1_skeleton_get_discoverable_timeout; + iface->get_pairable = bluez_adapter1_skeleton_get_pairable; + iface->get_pairable_timeout = bluez_adapter1_skeleton_get_pairable_timeout; + iface->get_discovering = bluez_adapter1_skeleton_get_discovering; + iface->get_uuids = bluez_adapter1_skeleton_get_uuids; + iface->get_modalias = bluez_adapter1_skeleton_get_modalias; + iface->get_roles = bluez_adapter1_skeleton_get_roles; +} + +/** + * bluez_adapter1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.bluez.Adapter1. + * + * Returns: (transfer full) (type BluezAdapter1Skeleton): The skeleton object. + */ +BluezAdapter1 * bluez_adapter1_skeleton_new(void) +{ + return BLUEZ_ADAPTER1(g_object_new(BLUEZ_TYPE_ADAPTER1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.Device1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezDevice1 + * @title: BluezDevice1 + * @short_description: Generated C code for the org.bluez.Device1 D-Bus interface + * + * This section contains code for working with the org.bluez.Device1 D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.Device1 ---- */ + +static const _ExtendedGDBusMethodInfo _bluez_device1_method_info_disconnect = { { -1, (gchar *) "Disconnect", NULL, NULL, NULL }, + "handle-disconnect", + FALSE }; + +static const _ExtendedGDBusMethodInfo _bluez_device1_method_info_connect = { { -1, (gchar *) "Connect", NULL, NULL, NULL }, + "handle-connect", + FALSE }; + +static const _ExtendedGDBusArgInfo _bluez_device1_method_info_connect_profile_IN_ARG_UUID = { + { -1, (gchar *) "UUID", (gchar *) "s", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_device1_method_info_connect_profile_IN_ARG_pointers[] = { + &_bluez_device1_method_info_connect_profile_IN_ARG_UUID.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_device1_method_info_connect_profile = { + { -1, (gchar *) "ConnectProfile", (GDBusArgInfo **) &_bluez_device1_method_info_connect_profile_IN_ARG_pointers, NULL, NULL }, + "handle-connect-profile", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_device1_method_info_disconnect_profile_IN_ARG_UUID = { + { -1, (gchar *) "UUID", (gchar *) "s", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_device1_method_info_disconnect_profile_IN_ARG_pointers[] = { + &_bluez_device1_method_info_disconnect_profile_IN_ARG_UUID.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_device1_method_info_disconnect_profile = { + { -1, (gchar *) "DisconnectProfile", (GDBusArgInfo **) &_bluez_device1_method_info_disconnect_profile_IN_ARG_pointers, NULL, + NULL }, + "handle-disconnect-profile", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _bluez_device1_method_info_pair = { { -1, (gchar *) "Pair", NULL, NULL, NULL }, + "handle-pair", + FALSE }; + +static const _ExtendedGDBusMethodInfo _bluez_device1_method_info_cancel_pairing = { + { -1, (gchar *) "CancelPairing", NULL, NULL, NULL }, "handle-cancel-pairing", FALSE +}; + +static const GDBusMethodInfo * const _bluez_device1_method_info_pointers[] = { + &_bluez_device1_method_info_disconnect.parent_struct, + &_bluez_device1_method_info_connect.parent_struct, + &_bluez_device1_method_info_connect_profile.parent_struct, + &_bluez_device1_method_info_disconnect_profile.parent_struct, + &_bluez_device1_method_info_pair.parent_struct, + &_bluez_device1_method_info_cancel_pairing.parent_struct, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_address = { + { -1, (gchar *) "Address", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "address", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_address_type = { + { -1, (gchar *) "AddressType", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "address-type", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_name = { + { -1, (gchar *) "Name", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "name", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_alias = { + { -1, (gchar *) "Alias", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, + "alias", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_class = { + { -1, (gchar *) "Class", (gchar *) "u", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "class", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_appearance = { + { -1, (gchar *) "Appearance", (gchar *) "q", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "appearance", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_icon = { + { -1, (gchar *) "Icon", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "icon", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_paired = { + { -1, (gchar *) "Paired", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "paired", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_trusted = { + { -1, (gchar *) "Trusted", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, + "trusted", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_blocked = { + { -1, (gchar *) "Blocked", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, + "blocked", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_legacy_pairing = { + { -1, (gchar *) "LegacyPairing", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "legacy-pairing", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_rssi = { + { -1, (gchar *) "RSSI", (gchar *) "n", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "rssi", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_connected = { + { -1, (gchar *) "Connected", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "connected", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_uuids = { + { -1, (gchar *) "UUIDs", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "uuids", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_modalias = { + { -1, (gchar *) "Modalias", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "modalias", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_adapter = { + { -1, (gchar *) "Adapter", (gchar *) "o", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "adapter", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_manufacturer_data = { + { -1, (gchar *) "ManufacturerData", (gchar *) "a{qv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, + "manufacturer-data", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_service_data = { + { -1, (gchar *) "ServiceData", (gchar *) "a{sv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "service-data", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_tx_power = { + { -1, (gchar *) "TxPower", (gchar *) "n", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "tx-power", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_services_resolved = { + { -1, (gchar *) "ServicesResolved", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "services-resolved", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_advertising_flags = { + { -1, (gchar *) "AdvertisingFlags", (gchar *) "ay", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, + "advertising-flags", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_advertising_data = { + { -1, (gchar *) "AdvertisingData", (gchar *) "a{yv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, + "advertising-data", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_device1_property_info_wake_allowed = { + { -1, (gchar *) "WakeAllowed", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE, NULL }, + "wake-allowed", + FALSE, + TRUE +}; + +static const GDBusPropertyInfo * const _bluez_device1_property_info_pointers[] = { + &_bluez_device1_property_info_address.parent_struct, + &_bluez_device1_property_info_address_type.parent_struct, + &_bluez_device1_property_info_name.parent_struct, + &_bluez_device1_property_info_alias.parent_struct, + &_bluez_device1_property_info_class.parent_struct, + &_bluez_device1_property_info_appearance.parent_struct, + &_bluez_device1_property_info_icon.parent_struct, + &_bluez_device1_property_info_paired.parent_struct, + &_bluez_device1_property_info_trusted.parent_struct, + &_bluez_device1_property_info_blocked.parent_struct, + &_bluez_device1_property_info_legacy_pairing.parent_struct, + &_bluez_device1_property_info_rssi.parent_struct, + &_bluez_device1_property_info_connected.parent_struct, + &_bluez_device1_property_info_uuids.parent_struct, + &_bluez_device1_property_info_modalias.parent_struct, + &_bluez_device1_property_info_adapter.parent_struct, + &_bluez_device1_property_info_manufacturer_data.parent_struct, + &_bluez_device1_property_info_service_data.parent_struct, + &_bluez_device1_property_info_tx_power.parent_struct, + &_bluez_device1_property_info_services_resolved.parent_struct, + &_bluez_device1_property_info_advertising_flags.parent_struct, + &_bluez_device1_property_info_advertising_data.parent_struct, + &_bluez_device1_property_info_wake_allowed.parent_struct, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_device1_interface_info = { + { -1, (gchar *) "org.bluez.Device1", (GDBusMethodInfo **) &_bluez_device1_method_info_pointers, NULL, + (GDBusPropertyInfo **) &_bluez_device1_property_info_pointers, NULL }, + "device1", +}; + +/** + * bluez_device1_interface_info: + * + * Gets a machine-readable description of the org.bluez.Device1 + * D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_device1_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_device1_interface_info.parent_struct; +} + +/** + * bluez_device1_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezDevice1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_device1_override_properties(GObjectClass * klass, guint property_id_begin) +{ + g_object_class_override_property(klass, property_id_begin++, "address"); + g_object_class_override_property(klass, property_id_begin++, "address-type"); + g_object_class_override_property(klass, property_id_begin++, "name"); + g_object_class_override_property(klass, property_id_begin++, "alias"); + g_object_class_override_property(klass, property_id_begin++, "class"); + g_object_class_override_property(klass, property_id_begin++, "appearance"); + g_object_class_override_property(klass, property_id_begin++, "icon"); + g_object_class_override_property(klass, property_id_begin++, "paired"); + g_object_class_override_property(klass, property_id_begin++, "trusted"); + g_object_class_override_property(klass, property_id_begin++, "blocked"); + g_object_class_override_property(klass, property_id_begin++, "legacy-pairing"); + g_object_class_override_property(klass, property_id_begin++, "rssi"); + g_object_class_override_property(klass, property_id_begin++, "connected"); + g_object_class_override_property(klass, property_id_begin++, "uuids"); + g_object_class_override_property(klass, property_id_begin++, "modalias"); + g_object_class_override_property(klass, property_id_begin++, "adapter"); + g_object_class_override_property(klass, property_id_begin++, "manufacturer-data"); + g_object_class_override_property(klass, property_id_begin++, "service-data"); + g_object_class_override_property(klass, property_id_begin++, "tx-power"); + g_object_class_override_property(klass, property_id_begin++, "services-resolved"); + g_object_class_override_property(klass, property_id_begin++, "advertising-flags"); + g_object_class_override_property(klass, property_id_begin++, "advertising-data"); + g_object_class_override_property(klass, property_id_begin++, "wake-allowed"); + return property_id_begin - 1; +} + +/** + * BluezDevice1: + * + * Abstract interface type for the D-Bus interface org.bluez.Device1. + */ + +/** + * BluezDevice1Iface: + * @parent_iface: The parent interface. + * @handle_cancel_pairing: Handler for the #BluezDevice1::handle-cancel-pairing signal. + * @handle_connect: Handler for the #BluezDevice1::handle-connect signal. + * @handle_connect_profile: Handler for the #BluezDevice1::handle-connect-profile signal. + * @handle_disconnect: Handler for the #BluezDevice1::handle-disconnect signal. + * @handle_disconnect_profile: Handler for the #BluezDevice1::handle-disconnect-profile signal. + * @handle_pair: Handler for the #BluezDevice1::handle-pair signal. + * @get_adapter: Getter for the #BluezDevice1:adapter property. + * @get_address: Getter for the #BluezDevice1:address property. + * @get_address_type: Getter for the #BluezDevice1:address-type property. + * @get_advertising_data: Getter for the #BluezDevice1:advertising-data property. + * @get_advertising_flags: Getter for the #BluezDevice1:advertising-flags property. + * @get_alias: Getter for the #BluezDevice1:alias property. + * @get_appearance: Getter for the #BluezDevice1:appearance property. + * @get_blocked: Getter for the #BluezDevice1:blocked property. + * @get_class: Getter for the #BluezDevice1:class property. + * @get_connected: Getter for the #BluezDevice1:connected property. + * @get_icon: Getter for the #BluezDevice1:icon property. + * @get_legacy_pairing: Getter for the #BluezDevice1:legacy-pairing property. + * @get_manufacturer_data: Getter for the #BluezDevice1:manufacturer-data property. + * @get_modalias: Getter for the #BluezDevice1:modalias property. + * @get_name: Getter for the #BluezDevice1:name property. + * @get_paired: Getter for the #BluezDevice1:paired property. + * @get_rssi: Getter for the #BluezDevice1:rssi property. + * @get_service_data: Getter for the #BluezDevice1:service-data property. + * @get_services_resolved: Getter for the #BluezDevice1:services-resolved property. + * @get_trusted: Getter for the #BluezDevice1:trusted property. + * @get_tx_power: Getter for the #BluezDevice1:tx-power property. + * @get_uuids: Getter for the #BluezDevice1:uuids property. + * @get_wake_allowed: Getter for the #BluezDevice1:wake-allowed property. + * + * Virtual table for the D-Bus interface org.bluez.Device1. + */ + +typedef BluezDevice1Iface BluezDevice1Interface; +G_DEFINE_INTERFACE(BluezDevice1, bluez_device1, G_TYPE_OBJECT) + +static void bluez_device1_default_init(BluezDevice1Iface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezDevice1::handle-disconnect: + * @object: A #BluezDevice1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the Disconnect() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_device1_complete_disconnect() or e.g. g_dbus_method_invocation_return_error() on it) + * and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is + * returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-disconnect", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezDevice1Iface, handle_disconnect), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * BluezDevice1::handle-connect: + * @object: A #BluezDevice1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the Connect() + * D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_device1_complete_connect() or e.g. g_dbus_method_invocation_return_error() on it) and + * no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is + * returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-connect", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezDevice1Iface, handle_connect), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * BluezDevice1::handle-connect-profile: + * @object: A #BluezDevice1. + * @invocation: A #GDBusMethodInvocation. + * @arg_UUID: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the ConnectProfile() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_device1_complete_connect_profile() or e.g. g_dbus_method_invocation_return_error() on + * it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-connect-profile", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezDevice1Iface, handle_connect_profile), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * BluezDevice1::handle-disconnect-profile: + * @object: A #BluezDevice1. + * @invocation: A #GDBusMethodInvocation. + * @arg_UUID: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the DisconnectProfile() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_device1_complete_disconnect_profile() or e.g. g_dbus_method_invocation_return_error() + * on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-disconnect-profile", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezDevice1Iface, handle_disconnect_profile), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /** + * BluezDevice1::handle-pair: + * @object: A #BluezDevice1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the Pair() D-Bus + * method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_device1_complete_pair() or e.g. g_dbus_method_invocation_return_error() on it) and no + * order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is + * returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-pair", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(BluezDevice1Iface, handle_pair), + g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * BluezDevice1::handle-cancel-pairing: + * @object: A #BluezDevice1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the CancelPairing() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_device1_complete_cancel_pairing() or e.g. g_dbus_method_invocation_return_error() on + * it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-cancel-pairing", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezDevice1Iface, handle_cancel_pairing), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject properties for D-Bus properties: */ + /** + * BluezDevice1:address: + * + * Represents the D-Bus property "Address". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("address", "Address", "Address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:address-type: + * + * Represents the D-Bus property "AddressType". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("address-type", "AddressType", "AddressType", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:name: + * + * Represents the D-Bus property "Name". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("name", "Name", "Name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:alias: + * + * Represents the D-Bus property "Alias". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("alias", "Alias", "Alias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:class: + * + * Represents the D-Bus property "Class". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_uint("class", "Class", "Class", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:appearance: + * + * Represents the D-Bus property "Appearance". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_uint("appearance", "Appearance", "Appearance", 0, G_MAXUINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:icon: + * + * Represents the D-Bus property "Icon". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("icon", "Icon", "Icon", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:paired: + * + * Represents the D-Bus property "Paired". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boolean("paired", "Paired", "Paired", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:trusted: + * + * Represents the D-Bus property "Trusted". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boolean("trusted", "Trusted", "Trusted", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:blocked: + * + * Represents the D-Bus property "Blocked". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boolean("blocked", "Blocked", "Blocked", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:legacy-pairing: + * + * Represents the D-Bus property "LegacyPairing". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_boolean("legacy-pairing", "LegacyPairing", "LegacyPairing", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:rssi: + * + * Represents the D-Bus property "RSSI". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_int("rssi", "RSSI", "RSSI", G_MININT16, G_MAXINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:connected: + * + * Represents the D-Bus property "Connected". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boolean("connected", "Connected", "Connected", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:uuids: + * + * Represents the D-Bus property "UUIDs". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boxed("uuids", "UUIDs", "UUIDs", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:modalias: + * + * Represents the D-Bus property "Modalias". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("modalias", "Modalias", "Modalias", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:adapter: + * + * Represents the D-Bus property "Adapter". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("adapter", "Adapter", "Adapter", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:manufacturer-data: + * + * Represents the D-Bus property "ManufacturerData". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_variant("manufacturer-data", "ManufacturerData", "ManufacturerData", + G_VARIANT_TYPE("a{qv}"), NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:service-data: + * + * Represents the D-Bus property "ServiceData". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_variant("service-data", "ServiceData", "ServiceData", G_VARIANT_TYPE("a{sv}"), + NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:tx-power: + * + * Represents the D-Bus property "TxPower". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_int("tx-power", "TxPower", "TxPower", G_MININT16, G_MAXINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:services-resolved: + * + * Represents the D-Bus property "ServicesResolved". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_boolean("services-resolved", "ServicesResolved", "ServicesResolved", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:advertising-flags: + * + * Represents the D-Bus property "AdvertisingFlags". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_string("advertising-flags", "AdvertisingFlags", "AdvertisingFlags", NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:advertising-data: + * + * Represents the D-Bus property "AdvertisingData". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_variant("advertising-data", "AdvertisingData", "AdvertisingData", + G_VARIANT_TYPE("a{yv}"), NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezDevice1:wake-allowed: + * + * Represents the D-Bus property "WakeAllowed". + * + * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and + * write to it on both the service- and client-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_boolean("wake-allowed", "WakeAllowed", "WakeAllowed", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * bluez_device1_get_address: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Address" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_address() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_device1_get_address(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_address(object); +} + +/** + * bluez_device1_dup_address: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "Address" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_device1_dup_address(BluezDevice1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "address", &value, NULL); + return value; +} + +/** + * bluez_device1_set_address: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Address" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_address(BluezDevice1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "address", value, NULL); +} + +/** + * bluez_device1_get_address_type: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "AddressType" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_address_type() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_device1_get_address_type(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_address_type(object); +} + +/** + * bluez_device1_dup_address_type: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "AddressType" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_device1_dup_address_type(BluezDevice1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "address-type", &value, NULL); + return value; +} + +/** + * bluez_device1_set_address_type: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "AddressType" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_address_type(BluezDevice1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "address-type", value, NULL); +} + +/** + * bluez_device1_get_name: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Name" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_name() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_device1_get_name(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_name(object); +} + +/** + * bluez_device1_dup_name: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "Name" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_device1_dup_name(BluezDevice1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "name", &value, NULL); + return value; +} + +/** + * bluez_device1_set_name: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Name" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_name(BluezDevice1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "name", value, NULL); +} + +/** + * bluez_device1_get_alias: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Alias" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_alias() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_device1_get_alias(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_alias(object); +} + +/** + * bluez_device1_dup_alias: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "Alias" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_device1_dup_alias(BluezDevice1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "alias", &value, NULL); + return value; +} + +/** + * bluez_device1_set_alias: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Alias" D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_device1_set_alias(BluezDevice1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "alias", value, NULL); +} + +/** + * bluez_device1_get_class: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Class" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint bluez_device1_get_class(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_class(object); +} + +/** + * bluez_device1_set_class: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Class" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_class(BluezDevice1 * object, guint value) +{ + g_object_set(G_OBJECT(object), "class", value, NULL); +} + +/** + * bluez_device1_get_appearance: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Appearance" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint16 bluez_device1_get_appearance(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_appearance(object); +} + +/** + * bluez_device1_set_appearance: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Appearance" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_appearance(BluezDevice1 * object, guint16 value) +{ + g_object_set(G_OBJECT(object), "appearance", value, NULL); +} + +/** + * bluez_device1_get_icon: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Icon" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_icon() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_device1_get_icon(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_icon(object); +} + +/** + * bluez_device1_dup_icon: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "Icon" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_device1_dup_icon(BluezDevice1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "icon", &value, NULL); + return value; +} + +/** + * bluez_device1_set_icon: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Icon" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_icon(BluezDevice1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "icon", value, NULL); +} + +/** + * bluez_device1_get_paired: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Paired" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_device1_get_paired(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_paired(object); +} + +/** + * bluez_device1_set_paired: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Paired" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_paired(BluezDevice1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "paired", value, NULL); +} + +/** + * bluez_device1_get_trusted: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Trusted" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: The property value. + */ +gboolean bluez_device1_get_trusted(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_trusted(object); +} + +/** + * bluez_device1_set_trusted: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Trusted" D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_device1_set_trusted(BluezDevice1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "trusted", value, NULL); +} + +/** + * bluez_device1_get_blocked: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Blocked" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: The property value. + */ +gboolean bluez_device1_get_blocked(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_blocked(object); +} + +/** + * bluez_device1_set_blocked: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Blocked" D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_device1_set_blocked(BluezDevice1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "blocked", value, NULL); +} + +/** + * bluez_device1_get_legacy_pairing: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "LegacyPairing" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_device1_get_legacy_pairing(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_legacy_pairing(object); +} + +/** + * bluez_device1_set_legacy_pairing: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "LegacyPairing" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_legacy_pairing(BluezDevice1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "legacy-pairing", value, NULL); +} + +/** + * bluez_device1_get_rssi: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "RSSI" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gint16 bluez_device1_get_rssi(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_rssi(object); +} + +/** + * bluez_device1_set_rssi: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "RSSI" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_rssi(BluezDevice1 * object, gint16 value) +{ + g_object_set(G_OBJECT(object), "rssi", value, NULL); +} + +/** + * bluez_device1_get_connected: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Connected" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_device1_get_connected(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_connected(object); +} + +/** + * bluez_device1_set_connected: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Connected" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_connected(BluezDevice1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "connected", value, NULL); +} + +/** + * bluez_device1_get_uuids: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "UUIDs" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_uuids() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * const * bluez_device1_get_uuids(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_uuids(object); +} + +/** + * bluez_device1_dup_uuids: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "UUIDs" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_strfreev(). + */ +gchar ** bluez_device1_dup_uuids(BluezDevice1 * object) +{ + gchar ** value; + g_object_get(G_OBJECT(object), "uuids", &value, NULL); + return value; +} + +/** + * bluez_device1_set_uuids: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "UUIDs" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_uuids(BluezDevice1 * object, const gchar * const * value) +{ + g_object_set(G_OBJECT(object), "uuids", value, NULL); +} + +/** + * bluez_device1_get_modalias: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Modalias" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_modalias() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_device1_get_modalias(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_modalias(object); +} + +/** + * bluez_device1_dup_modalias: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "Modalias" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_device1_dup_modalias(BluezDevice1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "modalias", &value, NULL); + return value; +} + +/** + * bluez_device1_set_modalias: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Modalias" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_modalias(BluezDevice1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "modalias", value, NULL); +} + +/** + * bluez_device1_get_adapter: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "Adapter" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_adapter() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_device1_get_adapter(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_adapter(object); +} + +/** + * bluez_device1_dup_adapter: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "Adapter" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_device1_dup_adapter(BluezDevice1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "adapter", &value, NULL); + return value; +} + +/** + * bluez_device1_set_adapter: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "Adapter" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_adapter(BluezDevice1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "adapter", value, NULL); +} + +/** + * bluez_device1_get_manufacturer_data: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "ManufacturerData" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_manufacturer_data() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +GVariant * bluez_device1_get_manufacturer_data(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_manufacturer_data(object); +} + +/** + * bluez_device1_dup_manufacturer_data: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "ManufacturerData" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_variant_unref(). + */ +GVariant * bluez_device1_dup_manufacturer_data(BluezDevice1 * object) +{ + GVariant * value; + g_object_get(G_OBJECT(object), "manufacturer-data", &value, NULL); + return value; +} + +/** + * bluez_device1_set_manufacturer_data: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "ManufacturerData" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_manufacturer_data(BluezDevice1 * object, GVariant * value) +{ + g_object_set(G_OBJECT(object), "manufacturer-data", value, NULL); +} + +/** + * bluez_device1_get_service_data: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "ServiceData" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_service_data() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +GVariant * bluez_device1_get_service_data(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_service_data(object); +} + +/** + * bluez_device1_dup_service_data: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "ServiceData" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_variant_unref(). + */ +GVariant * bluez_device1_dup_service_data(BluezDevice1 * object) +{ + GVariant * value; + g_object_get(G_OBJECT(object), "service-data", &value, NULL); + return value; +} + +/** + * bluez_device1_set_service_data: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "ServiceData" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_service_data(BluezDevice1 * object, GVariant * value) +{ + g_object_set(G_OBJECT(object), "service-data", value, NULL); +} + +/** + * bluez_device1_get_tx_power: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "TxPower" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gint16 bluez_device1_get_tx_power(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_tx_power(object); +} + +/** + * bluez_device1_set_tx_power: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "TxPower" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_tx_power(BluezDevice1 * object, gint16 value) +{ + g_object_set(G_OBJECT(object), "tx-power", value, NULL); +} + +/** + * bluez_device1_get_services_resolved: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "ServicesResolved" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_device1_get_services_resolved(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_services_resolved(object); +} + +/** + * bluez_device1_set_services_resolved: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "ServicesResolved" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_services_resolved(BluezDevice1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "services-resolved", value, NULL); +} + +/** + * bluez_device1_get_advertising_flags: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "AdvertisingFlags" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_advertising_flags() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_device1_get_advertising_flags(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_advertising_flags(object); +} + +/** + * bluez_device1_dup_advertising_flags: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "AdvertisingFlags" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_device1_dup_advertising_flags(BluezDevice1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "advertising-flags", &value, NULL); + return value; +} + +/** + * bluez_device1_set_advertising_flags: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "AdvertisingFlags" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_advertising_flags(BluezDevice1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "advertising-flags", value, NULL); +} + +/** + * bluez_device1_get_advertising_data: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "AdvertisingData" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_device1_dup_advertising_data() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +GVariant * bluez_device1_get_advertising_data(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_advertising_data(object); +} + +/** + * bluez_device1_dup_advertising_data: (skip) + * @object: A #BluezDevice1. + * + * Gets a copy of the "AdvertisingData" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_variant_unref(). + */ +GVariant * bluez_device1_dup_advertising_data(BluezDevice1 * object) +{ + GVariant * value; + g_object_get(G_OBJECT(object), "advertising-data", &value, NULL); + return value; +} + +/** + * bluez_device1_set_advertising_data: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "AdvertisingData" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_device1_set_advertising_data(BluezDevice1 * object, GVariant * value) +{ + g_object_set(G_OBJECT(object), "advertising-data", value, NULL); +} + +/** + * bluez_device1_get_wake_allowed: (skip) + * @object: A #BluezDevice1. + * + * Gets the value of the "WakeAllowed" D-Bus property. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + * + * Returns: The property value. + */ +gboolean bluez_device1_get_wake_allowed(BluezDevice1 * object) +{ + return BLUEZ_DEVICE1_GET_IFACE(object)->get_wake_allowed(object); +} + +/** + * bluez_device1_set_wake_allowed: (skip) + * @object: A #BluezDevice1. + * @value: The value to set. + * + * Sets the "WakeAllowed" D-Bus property to @value. + * + * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and + * service-side. + */ +void bluez_device1_set_wake_allowed(BluezDevice1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "wake-allowed", value, NULL); +} + +/** + * bluez_device1_call_disconnect: + * @proxy: A #BluezDevice1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the Disconnect() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_device1_call_disconnect_finish() to get the + * result of the operation. + * + * See bluez_device1_call_disconnect_sync() for the synchronous, blocking version of this method. + */ +void bluez_device1_call_disconnect(BluezDevice1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "Disconnect", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_device1_call_disconnect_finish: + * @proxy: A #BluezDevice1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_device1_call_disconnect(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_device1_call_disconnect(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_disconnect_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_disconnect_sync: + * @proxy: A #BluezDevice1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Disconnect() D-Bus method on @proxy. + * The calling thread is blocked until a reply is received. + * + * See bluez_device1_call_disconnect() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_disconnect_sync(BluezDevice1 * proxy, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "Disconnect", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_connect: + * @proxy: A #BluezDevice1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the Connect() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_device1_call_connect_finish() to get the result + * of the operation. + * + * See bluez_device1_call_connect_sync() for the synchronous, blocking version of this method. + */ +void bluez_device1_call_connect(BluezDevice1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "Connect", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_device1_call_connect_finish: + * @proxy: A #BluezDevice1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_device1_call_connect(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_device1_call_connect(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_connect_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_connect_sync: + * @proxy: A #BluezDevice1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Connect() D-Bus method on @proxy. The + * calling thread is blocked until a reply is received. + * + * See bluez_device1_call_connect() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_connect_sync(BluezDevice1 * proxy, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = + g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "Connect", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_connect_profile: + * @proxy: A #BluezDevice1Proxy. + * @arg_UUID: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the ConnectProfile() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_device1_call_connect_profile_finish() to get + * the result of the operation. + * + * See bluez_device1_call_connect_profile_sync() for the synchronous, blocking version of this method. + */ +void bluez_device1_call_connect_profile(BluezDevice1 * proxy, const gchar * arg_UUID, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "ConnectProfile", g_variant_new("(s)", arg_UUID), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_device1_call_connect_profile_finish: + * @proxy: A #BluezDevice1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_device1_call_connect_profile(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_device1_call_connect_profile(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_connect_profile_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_connect_profile_sync: + * @proxy: A #BluezDevice1Proxy. + * @arg_UUID: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the ConnectProfile() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_device1_call_connect_profile() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_connect_profile_sync(BluezDevice1 * proxy, const gchar * arg_UUID, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "ConnectProfile", g_variant_new("(s)", arg_UUID), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_disconnect_profile: + * @proxy: A #BluezDevice1Proxy. + * @arg_UUID: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the DisconnectProfile() D-Bus + * method on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_device1_call_disconnect_profile_finish() to get the result of the operation. + * + * See bluez_device1_call_disconnect_profile_sync() for the synchronous, blocking version of this method. + */ +void bluez_device1_call_disconnect_profile(BluezDevice1 * proxy, const gchar * arg_UUID, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "DisconnectProfile", g_variant_new("(s)", arg_UUID), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_device1_call_disconnect_profile_finish: + * @proxy: A #BluezDevice1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_device1_call_disconnect_profile(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_device1_call_disconnect_profile(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_disconnect_profile_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_disconnect_profile_sync: + * @proxy: A #BluezDevice1Proxy. + * @arg_UUID: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the DisconnectProfile() D-Bus + * method on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_device1_call_disconnect_profile() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_disconnect_profile_sync(BluezDevice1 * proxy, const gchar * arg_UUID, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "DisconnectProfile", g_variant_new("(s)", arg_UUID), G_DBUS_CALL_FLAGS_NONE, + -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_pair: + * @proxy: A #BluezDevice1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the Pair() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_device1_call_pair_finish() to get the result of + * the operation. + * + * See bluez_device1_call_pair_sync() for the synchronous, blocking version of this method. + */ +void bluez_device1_call_pair(BluezDevice1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "Pair", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_device1_call_pair_finish: + * @proxy: A #BluezDevice1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_device1_call_pair(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_device1_call_pair(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_pair_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_pair_sync: + * @proxy: A #BluezDevice1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Pair() D-Bus method on @proxy. The calling + * thread is blocked until a reply is received. + * + * See bluez_device1_call_pair() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_pair_sync(BluezDevice1 * proxy, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "Pair", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_cancel_pairing: + * @proxy: A #BluezDevice1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the CancelPairing() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_device1_call_cancel_pairing_finish() to get + * the result of the operation. + * + * See bluez_device1_call_cancel_pairing_sync() for the synchronous, blocking version of this method. + */ +void bluez_device1_call_cancel_pairing(BluezDevice1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "CancelPairing", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_device1_call_cancel_pairing_finish: + * @proxy: A #BluezDevice1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_device1_call_cancel_pairing(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_device1_call_cancel_pairing(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_cancel_pairing_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_call_cancel_pairing_sync: + * @proxy: A #BluezDevice1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the CancelPairing() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_device1_call_cancel_pairing() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_device1_call_cancel_pairing_sync(BluezDevice1 * proxy, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "CancelPairing", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_device1_complete_disconnect: + * @object: A #BluezDevice1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Disconnect() D-Bus method. If you instead want to finish handling an + * invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_device1_complete_disconnect(BluezDevice1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_device1_complete_connect: + * @object: A #BluezDevice1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Connect() D-Bus method. If you instead want to finish handling an + * invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_device1_complete_connect(BluezDevice1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_device1_complete_connect_profile: + * @object: A #BluezDevice1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the ConnectProfile() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_device1_complete_connect_profile(BluezDevice1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_device1_complete_disconnect_profile: + * @object: A #BluezDevice1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the DisconnectProfile() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_device1_complete_disconnect_profile(BluezDevice1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_device1_complete_pair: + * @object: A #BluezDevice1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Pair() D-Bus method. If you instead want to finish handling an invocation by + * returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_device1_complete_pair(BluezDevice1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_device1_complete_cancel_pairing: + * @object: A #BluezDevice1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the CancelPairing() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_device1_complete_cancel_pairing(BluezDevice1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezDevice1Proxy: + * + * The #BluezDevice1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezDevice1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezDevice1Proxy. + */ + +struct _BluezDevice1ProxyPrivate +{ + GData * qdata; +}; + +static void bluez_device1_proxy_iface_init(BluezDevice1Iface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezDevice1Proxy, bluez_device1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezDevice1Proxy) G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_DEVICE1, bluez_device1_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezDevice1Proxy, bluez_device1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_DEVICE1, bluez_device1_proxy_iface_init)) + +#endif +static void bluez_device1_proxy_finalize(GObject * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_device1_proxy_parent_class)->finalize(object); +} + +static void bluez_device1_proxy_get_property(GObject * object, guint prop_id, GValue * value, GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 23); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_device1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant(value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue(variant, value); + } + if (variant != NULL) + g_variant_unref(variant); +} + +static void bluez_device1_proxy_set_property_cb(GDBusProxy * proxy, GAsyncResult * res, gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo * info = user_data; + GError * error; + GVariant * _ret; + error = NULL; + _ret = g_dbus_proxy_call_finish(proxy, res, &error); + if (!_ret) + { + g_warning("Error setting property '%s' on interface org.bluez.Device1: %s (%s, %d)", info->parent_struct.name, + error->message, g_quark_to_string(error->domain), error->code); + g_error_free(error); + } + else + { + g_variant_unref(_ret); + } +} + +static void bluez_device1_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 23); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_device1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant(value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_dbus_proxy_call(G_DBUS_PROXY(object), "org.freedesktop.DBus.Properties.Set", + g_variant_new("(ssv)", "org.bluez.Device1", info->parent_struct.name, variant), G_DBUS_CALL_FLAGS_NONE, -1, + NULL, (GAsyncReadyCallback) bluez_device1_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref(variant); +} + +static void bluez_device1_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, const gchar * signal_name, + GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_device1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_DEVICE1); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_DEVICE1); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_device1_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_device1_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_device1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static const gchar * bluez_device1_proxy_get_address(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Address"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_device1_proxy_get_address_type(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "AddressType"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_device1_proxy_get_name(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Name"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_device1_proxy_get_alias(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Alias"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static guint bluez_device1_proxy_get_class(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + guint value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Class"); + if (variant != NULL) + { + value = g_variant_get_uint32(variant); + g_variant_unref(variant); + } + return value; +} + +static guint16 bluez_device1_proxy_get_appearance(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + guint16 value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Appearance"); + if (variant != NULL) + { + value = g_variant_get_uint16(variant); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_device1_proxy_get_icon(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Icon"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_device1_proxy_get_paired(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Paired"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_device1_proxy_get_trusted(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Trusted"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_device1_proxy_get_blocked(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Blocked"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_device1_proxy_get_legacy_pairing(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "LegacyPairing"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static gint16 bluez_device1_proxy_get_rssi(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + gint16 value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "RSSI"); + if (variant != NULL) + { + value = g_variant_get_int16(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_device1_proxy_get_connected(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Connected"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static const gchar * const * bluez_device1_proxy_get_uuids(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + const gchar * const * value = NULL; + value = g_datalist_get_data(&proxy->priv->qdata, "UUIDs"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "UUIDs"); + if (variant != NULL) + { + value = g_variant_get_strv(variant, NULL); + g_datalist_set_data_full(&proxy->priv->qdata, "UUIDs", (gpointer) value, g_free); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_device1_proxy_get_modalias(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Modalias"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_device1_proxy_get_adapter(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Adapter"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static GVariant * bluez_device1_proxy_get_manufacturer_data(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + GVariant * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "ManufacturerData"); + value = variant; + if (variant != NULL) + g_variant_unref(variant); + return value; +} + +static GVariant * bluez_device1_proxy_get_service_data(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + GVariant * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "ServiceData"); + value = variant; + if (variant != NULL) + g_variant_unref(variant); + return value; +} + +static gint16 bluez_device1_proxy_get_tx_power(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + gint16 value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "TxPower"); + if (variant != NULL) + { + value = g_variant_get_int16(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_device1_proxy_get_services_resolved(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "ServicesResolved"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_device1_proxy_get_advertising_flags(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "AdvertisingFlags"); + if (variant != NULL) + { + value = g_variant_get_bytestring(variant); + g_variant_unref(variant); + } + return value; +} + +static GVariant * bluez_device1_proxy_get_advertising_data(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + GVariant * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "AdvertisingData"); + value = variant; + if (variant != NULL) + g_variant_unref(variant); + return value; +} + +static gboolean bluez_device1_proxy_get_wake_allowed(BluezDevice1 * object) +{ + BluezDevice1Proxy * proxy = BLUEZ_DEVICE1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "WakeAllowed"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static void bluez_device1_proxy_init(BluezDevice1Proxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_device1_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_DEVICE1_PROXY, BluezDevice1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_device1_interface_info()); +} + +static void bluez_device1_proxy_class_init(BluezDevice1ProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_device1_proxy_finalize; + gobject_class->get_property = bluez_device1_proxy_get_property; + gobject_class->set_property = bluez_device1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_device1_proxy_g_signal; + proxy_class->g_properties_changed = bluez_device1_proxy_g_properties_changed; + + bluez_device1_override_properties(gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezDevice1ProxyPrivate)); +#endif +} + +static void bluez_device1_proxy_iface_init(BluezDevice1Iface * iface) +{ + iface->get_address = bluez_device1_proxy_get_address; + iface->get_address_type = bluez_device1_proxy_get_address_type; + iface->get_name = bluez_device1_proxy_get_name; + iface->get_alias = bluez_device1_proxy_get_alias; + iface->get_class = bluez_device1_proxy_get_class; + iface->get_appearance = bluez_device1_proxy_get_appearance; + iface->get_icon = bluez_device1_proxy_get_icon; + iface->get_paired = bluez_device1_proxy_get_paired; + iface->get_trusted = bluez_device1_proxy_get_trusted; + iface->get_blocked = bluez_device1_proxy_get_blocked; + iface->get_legacy_pairing = bluez_device1_proxy_get_legacy_pairing; + iface->get_rssi = bluez_device1_proxy_get_rssi; + iface->get_connected = bluez_device1_proxy_get_connected; + iface->get_uuids = bluez_device1_proxy_get_uuids; + iface->get_modalias = bluez_device1_proxy_get_modalias; + iface->get_adapter = bluez_device1_proxy_get_adapter; + iface->get_manufacturer_data = bluez_device1_proxy_get_manufacturer_data; + iface->get_service_data = bluez_device1_proxy_get_service_data; + iface->get_tx_power = bluez_device1_proxy_get_tx_power; + iface->get_services_resolved = bluez_device1_proxy_get_services_resolved; + iface->get_advertising_flags = bluez_device1_proxy_get_advertising_flags; + iface->get_advertising_data = bluez_device1_proxy_get_advertising_data; + iface->get_wake_allowed = bluez_device1_proxy_get_wake_allowed; +} + +/** + * bluez_device1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.bluez.Device1. See g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_device1_proxy_new_finish() to get the result of + * the operation. + * + * See bluez_device1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_device1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_DEVICE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, + "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.bluez.Device1", NULL); +} + +/** + * bluez_device1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_device1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_device1_proxy_new(). + * + * Returns: (transfer full) (type BluezDevice1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezDevice1 * bluez_device1_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_DEVICE1(ret); + else + return NULL; +} + +/** + * bluez_device1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.bluez.Device1. See g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_device1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezDevice1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezDevice1 * bluez_device1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_DEVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, + "g-object-path", object_path, "g-interface-name", "org.bluez.Device1", NULL); + if (ret != NULL) + return BLUEZ_DEVICE1(ret); + else + return NULL; +} + +/** + * bluez_device1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_device1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_device1_proxy_new_for_bus_finish() to get the + * result of the operation. + * + * See bluez_device1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_device1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_DEVICE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, + "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", + "org.bluez.Device1", NULL); +} + +/** + * bluez_device1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_device1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_device1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezDevice1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezDevice1 * bluez_device1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_DEVICE1(ret); + else + return NULL; +} + +/** + * bluez_device1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_device1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_device1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezDevice1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezDevice1 * bluez_device1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_DEVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, + "g-object-path", object_path, "g-interface-name", "org.bluez.Device1", NULL); + if (ret != NULL) + return BLUEZ_DEVICE1(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezDevice1Skeleton: + * + * The #BluezDevice1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezDevice1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezDevice1Skeleton. + */ + +struct _BluezDevice1SkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_device1_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name, const gchar * method_name, + GVariant * parameters, GDBusMethodInvocation * invocation, + gpointer user_data) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_DEVICE1); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_DEVICE1); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_device1_skeleton_handle_get_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_device1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_device1_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, + GVariant * variant, GError ** error, gpointer user_data) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_device1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_device1_skeleton_vtable = { _bluez_device1_skeleton_handle_method_call, + _bluez_device1_skeleton_handle_get_property, + _bluez_device1_skeleton_handle_set_property, + { NULL } }; + +static GDBusInterfaceInfo * bluez_device1_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_device1_interface_info(); +} + +static GDBusInterfaceVTable * bluez_device1_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_device1_skeleton_vtable; +} + +static GVariant * bluez_device1_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_device1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_device1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_device1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_device1_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.bluez.Device1", info->name, + NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static gboolean _bluez_device1_emit_changed(gpointer user_data); + +static void bluez_device1_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy(skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock(&skeleton->priv->lock); + + if (emit_changed) + _bluez_device1_emit_changed(skeleton); +} + +static void bluez_device1_skeleton_iface_init(BluezDevice1Iface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezDevice1Skeleton, bluez_device1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezDevice1Skeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_DEVICE1, bluez_device1_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezDevice1Skeleton, bluez_device1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_DEVICE1, bluez_device1_skeleton_iface_init)) + +#endif +static void bluez_device1_skeleton_finalize(GObject * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + guint n; + for (n = 0; n < 23; n++) + g_value_unset(&skeleton->priv->properties[n]); + g_free(skeleton->priv->properties); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_device1_skeleton_parent_class)->finalize(object); +} + +static void bluez_device1_skeleton_get_property(GObject * object, guint prop_id, GValue * value, GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 23); + g_mutex_lock(&skeleton->priv->lock); + g_value_copy(&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock(&skeleton->priv->lock); +} + +static gboolean _bluez_device1_emit_changed(gpointer user_data) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(user_data); + GList * l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock(&skeleton->priv->lock); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&invalidated_builder, G_VARIANT_TYPE("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty * cp = l->data; + GVariant * variant; + const GValue * cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal(cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant(cur_value, G_VARIANT_TYPE(cp->info->parent_struct.signature)); + g_variant_builder_add(&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref(variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant * signal_variant; + signal_variant = g_variant_ref_sink(g_variant_new("(sa{sv}as)", "org.bluez.Device1", &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection * connection = ll->data; + + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); + } + else + { + g_variant_builder_clear(&builder); + g_variant_builder_clear(&invalidated_builder); + } + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock(&skeleton->priv->lock); + return FALSE; +} + +static void _bluez_device1_schedule_emit_changed(BluezDevice1Skeleton * skeleton, const _ExtendedGDBusPropertyInfo * info, + guint prop_id, const GValue * orig_value) +{ + ChangedProperty * cp; + GList * l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty * i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0(ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend(skeleton->priv->changed_properties, cp); + g_value_init(&cp->orig_value, G_VALUE_TYPE(orig_value)); + g_value_copy(orig_value, &cp->orig_value); + } +} + +static void bluez_device1_skeleton_notify(GObject * object, GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new(); + g_source_set_priority(skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback(skeleton->priv->changed_properties_idle_source, _bluez_device1_emit_changed, g_object_ref(skeleton), + (GDestroyNotify) g_object_unref); + g_source_set_name(skeleton->priv->changed_properties_idle_source, "[generated] _bluez_device1_emit_changed"); + g_source_attach(skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref(skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock(&skeleton->priv->lock); +} + +static void bluez_device1_skeleton_set_property(GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) +{ + const _ExtendedGDBusPropertyInfo * info; + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 23); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_device1_property_info_pointers[prop_id - 1]; + g_mutex_lock(&skeleton->priv->lock); + g_object_freeze_notify(object); + if (!_g_value_equal(value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)) != NULL && info->emits_changed_signal) + _bluez_device1_schedule_emit_changed(skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy(value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec(object, pspec); + } + g_mutex_unlock(&skeleton->priv->lock); + g_object_thaw_notify(object); +} + +static void bluez_device1_skeleton_init(BluezDevice1Skeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_device1_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_DEVICE1_SKELETON, BluezDevice1SkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); + skeleton->priv->properties = g_new0(GValue, 23); + g_value_init(&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[2], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[3], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[4], G_TYPE_UINT); + g_value_init(&skeleton->priv->properties[5], G_TYPE_UINT); + g_value_init(&skeleton->priv->properties[6], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[7], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[8], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[9], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[10], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[11], G_TYPE_INT); + g_value_init(&skeleton->priv->properties[12], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[13], G_TYPE_STRV); + g_value_init(&skeleton->priv->properties[14], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[15], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[16], G_TYPE_VARIANT); + g_value_init(&skeleton->priv->properties[17], G_TYPE_VARIANT); + g_value_init(&skeleton->priv->properties[18], G_TYPE_INT); + g_value_init(&skeleton->priv->properties[19], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[20], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[21], G_TYPE_VARIANT); + g_value_init(&skeleton->priv->properties[22], G_TYPE_BOOLEAN); +} + +static const gchar * bluez_device1_skeleton_get_address(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[0])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_device1_skeleton_get_address_type(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[1])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_device1_skeleton_get_name(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[2])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_device1_skeleton_get_alias(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[3])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guint bluez_device1_skeleton_get_class(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + guint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uint(&(skeleton->priv->properties[4])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guint16 bluez_device1_skeleton_get_appearance(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + guint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uint(&(skeleton->priv->properties[5])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_device1_skeleton_get_icon(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[6])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_device1_skeleton_get_paired(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[7])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_device1_skeleton_get_trusted(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[8])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_device1_skeleton_get_blocked(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[9])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_device1_skeleton_get_legacy_pairing(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[10])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gint16 bluez_device1_skeleton_get_rssi(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + gint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_int(&(skeleton->priv->properties[11])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_device1_skeleton_get_connected(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[12])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * const * bluez_device1_skeleton_get_uuids(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + const gchar * const * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boxed(&(skeleton->priv->properties[13])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_device1_skeleton_get_modalias(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[14])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_device1_skeleton_get_adapter(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[15])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static GVariant * bluez_device1_skeleton_get_manufacturer_data(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + GVariant * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_variant(&(skeleton->priv->properties[16])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static GVariant * bluez_device1_skeleton_get_service_data(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + GVariant * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_variant(&(skeleton->priv->properties[17])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gint16 bluez_device1_skeleton_get_tx_power(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + gint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_int(&(skeleton->priv->properties[18])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_device1_skeleton_get_services_resolved(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[19])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_device1_skeleton_get_advertising_flags(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[20])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static GVariant * bluez_device1_skeleton_get_advertising_data(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + GVariant * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_variant(&(skeleton->priv->properties[21])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_device1_skeleton_get_wake_allowed(BluezDevice1 * object) +{ + BluezDevice1Skeleton * skeleton = BLUEZ_DEVICE1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[22])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static void bluez_device1_skeleton_class_init(BluezDevice1SkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_device1_skeleton_finalize; + gobject_class->get_property = bluez_device1_skeleton_get_property; + gobject_class->set_property = bluez_device1_skeleton_set_property; + gobject_class->notify = bluez_device1_skeleton_notify; + + bluez_device1_override_properties(gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_device1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_device1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_device1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_device1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezDevice1SkeletonPrivate)); +#endif +} + +static void bluez_device1_skeleton_iface_init(BluezDevice1Iface * iface) +{ + iface->get_address = bluez_device1_skeleton_get_address; + iface->get_address_type = bluez_device1_skeleton_get_address_type; + iface->get_name = bluez_device1_skeleton_get_name; + iface->get_alias = bluez_device1_skeleton_get_alias; + iface->get_class = bluez_device1_skeleton_get_class; + iface->get_appearance = bluez_device1_skeleton_get_appearance; + iface->get_icon = bluez_device1_skeleton_get_icon; + iface->get_paired = bluez_device1_skeleton_get_paired; + iface->get_trusted = bluez_device1_skeleton_get_trusted; + iface->get_blocked = bluez_device1_skeleton_get_blocked; + iface->get_legacy_pairing = bluez_device1_skeleton_get_legacy_pairing; + iface->get_rssi = bluez_device1_skeleton_get_rssi; + iface->get_connected = bluez_device1_skeleton_get_connected; + iface->get_uuids = bluez_device1_skeleton_get_uuids; + iface->get_modalias = bluez_device1_skeleton_get_modalias; + iface->get_adapter = bluez_device1_skeleton_get_adapter; + iface->get_manufacturer_data = bluez_device1_skeleton_get_manufacturer_data; + iface->get_service_data = bluez_device1_skeleton_get_service_data; + iface->get_tx_power = bluez_device1_skeleton_get_tx_power; + iface->get_services_resolved = bluez_device1_skeleton_get_services_resolved; + iface->get_advertising_flags = bluez_device1_skeleton_get_advertising_flags; + iface->get_advertising_data = bluez_device1_skeleton_get_advertising_data; + iface->get_wake_allowed = bluez_device1_skeleton_get_wake_allowed; +} + +/** + * bluez_device1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.bluez.Device1. + * + * Returns: (transfer full) (type BluezDevice1Skeleton): The skeleton object. + */ +BluezDevice1 * bluez_device1_skeleton_new(void) +{ + return BLUEZ_DEVICE1(g_object_new(BLUEZ_TYPE_DEVICE1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.GattManager1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezGattManager1 + * @title: BluezGattManager1 + * @short_description: Generated C code for the org.bluez.GattManager1 D-Bus interface + * + * This section contains code for working with the org.bluez.GattManager1 D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.GattManager1 ---- */ + +static const _ExtendedGDBusArgInfo _bluez_gatt_manager1_method_info_register_application_IN_ARG_application = { + { -1, (gchar *) "application", (gchar *) "o", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_manager1_method_info_register_application_IN_ARG_options = { + { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_manager1_method_info_register_application_IN_ARG_pointers[] = { + &_bluez_gatt_manager1_method_info_register_application_IN_ARG_application.parent_struct, + &_bluez_gatt_manager1_method_info_register_application_IN_ARG_options.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_manager1_method_info_register_application = { + { -1, (gchar *) "RegisterApplication", (GDBusArgInfo **) &_bluez_gatt_manager1_method_info_register_application_IN_ARG_pointers, + NULL, NULL }, + "handle-register-application", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_manager1_method_info_unregister_application_IN_ARG_application = { + { -1, (gchar *) "application", (gchar *) "o", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_manager1_method_info_unregister_application_IN_ARG_pointers[] = { + &_bluez_gatt_manager1_method_info_unregister_application_IN_ARG_application.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_manager1_method_info_unregister_application = { + { -1, (gchar *) "UnregisterApplication", + (GDBusArgInfo **) &_bluez_gatt_manager1_method_info_unregister_application_IN_ARG_pointers, NULL, NULL }, + "handle-unregister-application", + FALSE +}; + +static const GDBusMethodInfo * const _bluez_gatt_manager1_method_info_pointers[] = { + &_bluez_gatt_manager1_method_info_register_application.parent_struct, + &_bluez_gatt_manager1_method_info_unregister_application.parent_struct, NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_gatt_manager1_interface_info = { + { -1, (gchar *) "org.bluez.GattManager1", (GDBusMethodInfo **) &_bluez_gatt_manager1_method_info_pointers, NULL, NULL, NULL }, + "gatt-manager1", +}; + +/** + * bluez_gatt_manager1_interface_info: + * + * Gets a machine-readable description of the org.bluez.GattManager1 D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_gatt_manager1_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_gatt_manager1_interface_info.parent_struct; +} + +/** + * bluez_gatt_manager1_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezGattManager1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_gatt_manager1_override_properties(GObjectClass * klass, guint property_id_begin) +{ + return property_id_begin - 1; +} + +/** + * BluezGattManager1: + * + * Abstract interface type for the D-Bus interface org.bluez.GattManager1. + */ + +/** + * BluezGattManager1Iface: + * @parent_iface: The parent interface. + * @handle_register_application: Handler for the #BluezGattManager1::handle-register-application signal. + * @handle_unregister_application: Handler for the #BluezGattManager1::handle-unregister-application signal. + * + * Virtual table for the D-Bus interface org.bluez.GattManager1. + */ + +typedef BluezGattManager1Iface BluezGattManager1Interface; +G_DEFINE_INTERFACE(BluezGattManager1, bluez_gatt_manager1, G_TYPE_OBJECT) + +static void bluez_gatt_manager1_default_init(BluezGattManager1Iface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezGattManager1::handle-register-application: + * @object: A #BluezGattManager1. + * @invocation: A #GDBusMethodInvocation. + * @arg_application: Argument passed by remote caller. + * @arg_options: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the RegisterApplication() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_manager1_complete_register_application() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-register-application", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattManager1Iface, handle_register_application), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 3, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_VARIANT); + + /** + * BluezGattManager1::handle-unregister-application: + * @object: A #BluezGattManager1. + * @invocation: A #GDBusMethodInvocation. + * @arg_application: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the UnregisterApplication() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_manager1_complete_unregister_application() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-unregister-application", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattManager1Iface, handle_unregister_application), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); +} + +/** + * bluez_gatt_manager1_call_register_application: + * @proxy: A #BluezGattManager1Proxy. + * @arg_application: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the RegisterApplication() + * D-Bus method on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread + * you are calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_gatt_manager1_call_register_application_finish() to get the result of the operation. + * + * See bluez_gatt_manager1_call_register_application_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_manager1_call_register_application(BluezGattManager1 * proxy, const gchar * arg_application, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "RegisterApplication", g_variant_new("(o@a{sv})", arg_application, arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); +} + +/** + * bluez_gatt_manager1_call_register_application_finish: + * @proxy: A #BluezGattManager1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_manager1_call_register_application(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_manager1_call_register_application(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_manager1_call_register_application_finish(BluezGattManager1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_manager1_call_register_application_sync: + * @proxy: A #BluezGattManager1Proxy. + * @arg_application: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the RegisterApplication() + * D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_manager1_call_register_application() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_manager1_call_register_application_sync(BluezGattManager1 * proxy, const gchar * arg_application, + GVariant * arg_options, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = + g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "RegisterApplication", g_variant_new("(o@a{sv})", arg_application, arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_manager1_call_unregister_application: + * @proxy: A #BluezGattManager1Proxy. + * @arg_application: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the UnregisterApplication() D-Bus method on @proxy. When + * the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this method + * from (see g_main_context_push_thread_default()). You can then call bluez_gatt_manager1_call_unregister_application_finish() to + * get the result of the operation. + * + * See bluez_gatt_manager1_call_unregister_application_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_manager1_call_unregister_application(BluezGattManager1 * proxy, const gchar * arg_application, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "UnregisterApplication", g_variant_new("(o)", arg_application), G_DBUS_CALL_FLAGS_NONE, + -1, cancellable, callback, user_data); +} + +/** + * bluez_gatt_manager1_call_unregister_application_finish: + * @proxy: A #BluezGattManager1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_manager1_call_unregister_application(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_manager1_call_unregister_application(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_manager1_call_unregister_application_finish(BluezGattManager1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_manager1_call_unregister_application_sync: + * @proxy: A #BluezGattManager1Proxy. + * @arg_application: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the UnregisterApplication() D-Bus method on @proxy. The + * calling thread is blocked until a reply is received. + * + * See bluez_gatt_manager1_call_unregister_application() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_manager1_call_unregister_application_sync(BluezGattManager1 * proxy, const gchar * arg_application, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "UnregisterApplication", g_variant_new("(o)", arg_application), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_manager1_complete_register_application: + * @object: A #BluezGattManager1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the RegisterApplication() D-Bus method. If you instead want + * to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_manager1_complete_register_application(BluezGattManager1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_gatt_manager1_complete_unregister_application: + * @object: A #BluezGattManager1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the UnregisterApplication() D-Bus method. If you instead + * want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_manager1_complete_unregister_application(BluezGattManager1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezGattManager1Proxy: + * + * The #BluezGattManager1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezGattManager1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezGattManager1Proxy. + */ + +struct _BluezGattManager1ProxyPrivate +{ + GData * qdata; +}; + +static void bluez_gatt_manager1_proxy_iface_init(BluezGattManager1Iface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezGattManager1Proxy, bluez_gatt_manager1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezGattManager1Proxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_MANAGER1, bluez_gatt_manager1_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezGattManager1Proxy, bluez_gatt_manager1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_MANAGER1, bluez_gatt_manager1_proxy_iface_init)) + +#endif +static void bluez_gatt_manager1_proxy_finalize(GObject * object) +{ + BluezGattManager1Proxy * proxy = BLUEZ_GATT_MANAGER1_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_gatt_manager1_proxy_parent_class)->finalize(object); +} + +static void bluez_gatt_manager1_proxy_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{} + +static void bluez_gatt_manager1_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{} + +static void bluez_gatt_manager1_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, + const gchar * signal_name, GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_gatt_manager1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_GATT_MANAGER1); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_GATT_MANAGER1); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_gatt_manager1_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezGattManager1Proxy * proxy = BLUEZ_GATT_MANAGER1_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_manager1_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_manager1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static void bluez_gatt_manager1_proxy_init(BluezGattManager1Proxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_gatt_manager1_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_GATT_MANAGER1_PROXY, BluezGattManager1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_gatt_manager1_interface_info()); +} + +static void bluez_gatt_manager1_proxy_class_init(BluezGattManager1ProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_gatt_manager1_proxy_finalize; + gobject_class->get_property = bluez_gatt_manager1_proxy_get_property; + gobject_class->set_property = bluez_gatt_manager1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_gatt_manager1_proxy_g_signal; + proxy_class->g_properties_changed = bluez_gatt_manager1_proxy_g_properties_changed; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezGattManager1ProxyPrivate)); +#endif +} + +static void bluez_gatt_manager1_proxy_iface_init(BluezGattManager1Iface * iface) {} + +/** + * bluez_gatt_manager1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.bluez.GattManager1. See g_dbus_proxy_new() for more + * details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_manager1_proxy_new_finish() to get the + * result of the operation. + * + * See bluez_gatt_manager1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_gatt_manager1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_GATT_MANAGER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.bluez.GattManager1", NULL); +} + +/** + * bluez_gatt_manager1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_manager1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_gatt_manager1_proxy_new(). + * + * Returns: (transfer full) (type BluezGattManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattManager1 * bluez_gatt_manager1_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_GATT_MANAGER1(ret); + else + return NULL; +} + +/** + * bluez_gatt_manager1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.bluez.GattManager1. See g_dbus_proxy_new_sync() for more + * details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_gatt_manager1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezGattManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattManager1 * bluez_gatt_manager1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_GATT_MANAGER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", + connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattManager1", NULL); + if (ret != NULL) + return BLUEZ_GATT_MANAGER1(ret); + else + return NULL; +} + +/** + * bluez_gatt_manager1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_gatt_manager1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_manager1_proxy_new_for_bus_finish() to get + * the result of the operation. + * + * See bluez_gatt_manager1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_gatt_manager1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_GATT_MANAGER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", + "org.bluez.GattManager1", NULL); +} + +/** + * bluez_gatt_manager1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_manager1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_gatt_manager1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezGattManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattManager1 * bluez_gatt_manager1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_GATT_MANAGER1(ret); + else + return NULL; +} + +/** + * bluez_gatt_manager1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_gatt_manager1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_gatt_manager1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezGattManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattManager1 * bluez_gatt_manager1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_GATT_MANAGER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", + bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattManager1", NULL); + if (ret != NULL) + return BLUEZ_GATT_MANAGER1(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezGattManager1Skeleton: + * + * The #BluezGattManager1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezGattManager1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezGattManager1Skeleton. + */ + +struct _BluezGattManager1SkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_gatt_manager1_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, const gchar * interface_name, + const gchar * method_name, GVariant * parameters, + GDBusMethodInvocation * invocation, gpointer user_data) +{ + BluezGattManager1Skeleton * skeleton = BLUEZ_GATT_MANAGER1_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_GATT_MANAGER1); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_GATT_MANAGER1); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_gatt_manager1_skeleton_handle_get_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezGattManager1Skeleton * skeleton = BLUEZ_GATT_MANAGER1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_manager1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_gatt_manager1_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GVariant * variant, GError ** error, + gpointer user_data) +{ + BluezGattManager1Skeleton * skeleton = BLUEZ_GATT_MANAGER1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_manager1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_gatt_manager1_skeleton_vtable = { _bluez_gatt_manager1_skeleton_handle_method_call, + _bluez_gatt_manager1_skeleton_handle_get_property, + _bluez_gatt_manager1_skeleton_handle_set_property, + { NULL } }; + +static GDBusInterfaceInfo * bluez_gatt_manager1_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_gatt_manager1_interface_info(); +} + +static GDBusInterfaceVTable * +bluez_gatt_manager1_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_gatt_manager1_skeleton_vtable; +} + +static GVariant * bluez_gatt_manager1_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezGattManager1Skeleton * skeleton = BLUEZ_GATT_MANAGER1_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_gatt_manager1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_gatt_manager1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_gatt_manager1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_gatt_manager1_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.bluez.GattManager1", + info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static void bluez_gatt_manager1_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) {} + +static void bluez_gatt_manager1_skeleton_iface_init(BluezGattManager1Iface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezGattManager1Skeleton, bluez_gatt_manager1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezGattManager1Skeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_MANAGER1, bluez_gatt_manager1_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezGattManager1Skeleton, bluez_gatt_manager1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_MANAGER1, bluez_gatt_manager1_skeleton_iface_init)) + +#endif +static void bluez_gatt_manager1_skeleton_finalize(GObject * object) +{ + BluezGattManager1Skeleton * skeleton = BLUEZ_GATT_MANAGER1_SKELETON(object); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_gatt_manager1_skeleton_parent_class)->finalize(object); +} + +static void bluez_gatt_manager1_skeleton_init(BluezGattManager1Skeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_gatt_manager1_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_GATT_MANAGER1_SKELETON, BluezGattManager1SkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); +} + +static void bluez_gatt_manager1_skeleton_class_init(BluezGattManager1SkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_gatt_manager1_skeleton_finalize; + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_gatt_manager1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_gatt_manager1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_gatt_manager1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_gatt_manager1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezGattManager1SkeletonPrivate)); +#endif +} + +static void bluez_gatt_manager1_skeleton_iface_init(BluezGattManager1Iface * iface) {} + +/** + * bluez_gatt_manager1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.bluez.GattManager1. + * + * Returns: (transfer full) (type BluezGattManager1Skeleton): The skeleton object. + */ +BluezGattManager1 * bluez_gatt_manager1_skeleton_new(void) +{ + return BLUEZ_GATT_MANAGER1(g_object_new(BLUEZ_TYPE_GATT_MANAGER1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.GattService1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezGattService1 + * @title: BluezGattService1 + * @short_description: Generated C code for the org.bluez.GattService1 D-Bus interface + * + * This section contains code for working with the org.bluez.GattService1 D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.GattService1 ---- */ + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_service1_property_info_uuid = { + { -1, (gchar *) "UUID", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "uuid", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_service1_property_info_device = { + { -1, (gchar *) "Device", (gchar *) "o", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "device", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_service1_property_info_primary = { + { -1, (gchar *) "Primary", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "primary", FALSE, TRUE +}; + +static const GDBusPropertyInfo * const _bluez_gatt_service1_property_info_pointers[] = { + &_bluez_gatt_service1_property_info_uuid.parent_struct, &_bluez_gatt_service1_property_info_device.parent_struct, + &_bluez_gatt_service1_property_info_primary.parent_struct, NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_gatt_service1_interface_info = { + { -1, (gchar *) "org.bluez.GattService1", NULL, NULL, (GDBusPropertyInfo **) &_bluez_gatt_service1_property_info_pointers, + NULL }, + "gatt-service1", +}; + +/** + * bluez_gatt_service1_interface_info: + * + * Gets a machine-readable description of the org.bluez.GattService1 D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_gatt_service1_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_gatt_service1_interface_info.parent_struct; +} + +/** + * bluez_gatt_service1_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezGattService1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_gatt_service1_override_properties(GObjectClass * klass, guint property_id_begin) +{ + g_object_class_override_property(klass, property_id_begin++, "uuid"); + g_object_class_override_property(klass, property_id_begin++, "device"); + g_object_class_override_property(klass, property_id_begin++, "primary"); + return property_id_begin - 1; +} + +/** + * BluezGattService1: + * + * Abstract interface type for the D-Bus interface org.bluez.GattService1. + */ + +/** + * BluezGattService1Iface: + * @parent_iface: The parent interface. + * @get_device: Getter for the #BluezGattService1:device property. + * @get_primary: Getter for the #BluezGattService1:primary property. + * @get_uuid: Getter for the #BluezGattService1:uuid property. + * + * Virtual table for the D-Bus interface org.bluez.GattService1. + */ + +typedef BluezGattService1Iface BluezGattService1Interface; +G_DEFINE_INTERFACE(BluezGattService1, bluez_gatt_service1, G_TYPE_OBJECT) + +static void bluez_gatt_service1_default_init(BluezGattService1Iface * iface) +{ + /* GObject properties for D-Bus properties: */ + /** + * BluezGattService1:uuid: + * + * Represents the D-Bus property "UUID". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("uuid", "UUID", "UUID", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattService1:device: + * + * Represents the D-Bus property "Device". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("device", "Device", "Device", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattService1:primary: + * + * Represents the D-Bus property "Primary". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boolean("primary", "Primary", "Primary", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * bluez_gatt_service1_get_uuid: (skip) + * @object: A #BluezGattService1. + * + * Gets the value of the "UUID" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_gatt_service1_dup_uuid() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_gatt_service1_get_uuid(BluezGattService1 * object) +{ + return BLUEZ_GATT_SERVICE1_GET_IFACE(object)->get_uuid(object); +} + +/** + * bluez_gatt_service1_dup_uuid: (skip) + * @object: A #BluezGattService1. + * + * Gets a copy of the "UUID" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_gatt_service1_dup_uuid(BluezGattService1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "uuid", &value, NULL); + return value; +} + +/** + * bluez_gatt_service1_set_uuid: (skip) + * @object: A #BluezGattService1. + * @value: The value to set. + * + * Sets the "UUID" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_service1_set_uuid(BluezGattService1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "uuid", value, NULL); +} + +/** + * bluez_gatt_service1_get_device: (skip) + * @object: A #BluezGattService1. + * + * Gets the value of the "Device" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_gatt_service1_dup_device() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_gatt_service1_get_device(BluezGattService1 * object) +{ + return BLUEZ_GATT_SERVICE1_GET_IFACE(object)->get_device(object); +} + +/** + * bluez_gatt_service1_dup_device: (skip) + * @object: A #BluezGattService1. + * + * Gets a copy of the "Device" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_gatt_service1_dup_device(BluezGattService1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "device", &value, NULL); + return value; +} + +/** + * bluez_gatt_service1_set_device: (skip) + * @object: A #BluezGattService1. + * @value: The value to set. + * + * Sets the "Device" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_service1_set_device(BluezGattService1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "device", value, NULL); +} + +/** + * bluez_gatt_service1_get_primary: (skip) + * @object: A #BluezGattService1. + * + * Gets the value of the "Primary" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_gatt_service1_get_primary(BluezGattService1 * object) +{ + return BLUEZ_GATT_SERVICE1_GET_IFACE(object)->get_primary(object); +} + +/** + * bluez_gatt_service1_set_primary: (skip) + * @object: A #BluezGattService1. + * @value: The value to set. + * + * Sets the "Primary" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_service1_set_primary(BluezGattService1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "primary", value, NULL); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezGattService1Proxy: + * + * The #BluezGattService1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezGattService1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezGattService1Proxy. + */ + +struct _BluezGattService1ProxyPrivate +{ + GData * qdata; +}; + +static void bluez_gatt_service1_proxy_iface_init(BluezGattService1Iface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezGattService1Proxy, bluez_gatt_service1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezGattService1Proxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_SERVICE1, bluez_gatt_service1_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezGattService1Proxy, bluez_gatt_service1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_SERVICE1, bluez_gatt_service1_proxy_iface_init)) + +#endif +static void bluez_gatt_service1_proxy_finalize(GObject * object) +{ + BluezGattService1Proxy * proxy = BLUEZ_GATT_SERVICE1_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_gatt_service1_proxy_parent_class)->finalize(object); +} + +static void bluez_gatt_service1_proxy_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 3); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_gatt_service1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant(value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue(variant, value); + } + if (variant != NULL) + g_variant_unref(variant); +} + +static void bluez_gatt_service1_proxy_set_property_cb(GDBusProxy * proxy, GAsyncResult * res, gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo * info = user_data; + GError * error; + GVariant * _ret; + error = NULL; + _ret = g_dbus_proxy_call_finish(proxy, res, &error); + if (!_ret) + { + g_warning("Error setting property '%s' on interface org.bluez.GattService1: %s (%s, %d)", info->parent_struct.name, + error->message, g_quark_to_string(error->domain), error->code); + g_error_free(error); + } + else + { + g_variant_unref(_ret); + } +} + +static void bluez_gatt_service1_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 3); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_gatt_service1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant(value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_dbus_proxy_call(G_DBUS_PROXY(object), "org.freedesktop.DBus.Properties.Set", + g_variant_new("(ssv)", "org.bluez.GattService1", info->parent_struct.name, variant), G_DBUS_CALL_FLAGS_NONE, + -1, NULL, (GAsyncReadyCallback) bluez_gatt_service1_proxy_set_property_cb, + (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref(variant); +} + +static void bluez_gatt_service1_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, + const gchar * signal_name, GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_gatt_service1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_GATT_SERVICE1); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_GATT_SERVICE1); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_gatt_service1_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezGattService1Proxy * proxy = BLUEZ_GATT_SERVICE1_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_service1_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_service1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static const gchar * bluez_gatt_service1_proxy_get_uuid(BluezGattService1 * object) +{ + BluezGattService1Proxy * proxy = BLUEZ_GATT_SERVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "UUID"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_gatt_service1_proxy_get_device(BluezGattService1 * object) +{ + BluezGattService1Proxy * proxy = BLUEZ_GATT_SERVICE1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Device"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_gatt_service1_proxy_get_primary(BluezGattService1 * object) +{ + BluezGattService1Proxy * proxy = BLUEZ_GATT_SERVICE1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Primary"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static void bluez_gatt_service1_proxy_init(BluezGattService1Proxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_gatt_service1_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_GATT_SERVICE1_PROXY, BluezGattService1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_gatt_service1_interface_info()); +} + +static void bluez_gatt_service1_proxy_class_init(BluezGattService1ProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_gatt_service1_proxy_finalize; + gobject_class->get_property = bluez_gatt_service1_proxy_get_property; + gobject_class->set_property = bluez_gatt_service1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_gatt_service1_proxy_g_signal; + proxy_class->g_properties_changed = bluez_gatt_service1_proxy_g_properties_changed; + + bluez_gatt_service1_override_properties(gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezGattService1ProxyPrivate)); +#endif +} + +static void bluez_gatt_service1_proxy_iface_init(BluezGattService1Iface * iface) +{ + iface->get_uuid = bluez_gatt_service1_proxy_get_uuid; + iface->get_device = bluez_gatt_service1_proxy_get_device; + iface->get_primary = bluez_gatt_service1_proxy_get_primary; +} + +/** + * bluez_gatt_service1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.bluez.GattService1. See g_dbus_proxy_new() for more + * details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_service1_proxy_new_finish() to get the + * result of the operation. + * + * See bluez_gatt_service1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_gatt_service1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_GATT_SERVICE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.bluez.GattService1", NULL); +} + +/** + * bluez_gatt_service1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_service1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_gatt_service1_proxy_new(). + * + * Returns: (transfer full) (type BluezGattService1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattService1 * bluez_gatt_service1_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_GATT_SERVICE1(ret); + else + return NULL; +} + +/** + * bluez_gatt_service1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.bluez.GattService1. See g_dbus_proxy_new_sync() for more + * details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_gatt_service1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezGattService1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattService1 * bluez_gatt_service1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_GATT_SERVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", + connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattService1", NULL); + if (ret != NULL) + return BLUEZ_GATT_SERVICE1(ret); + else + return NULL; +} + +/** + * bluez_gatt_service1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_gatt_service1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_service1_proxy_new_for_bus_finish() to get + * the result of the operation. + * + * See bluez_gatt_service1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_gatt_service1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_GATT_SERVICE1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", + "org.bluez.GattService1", NULL); +} + +/** + * bluez_gatt_service1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_service1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_gatt_service1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezGattService1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattService1 * bluez_gatt_service1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_GATT_SERVICE1(ret); + else + return NULL; +} + +/** + * bluez_gatt_service1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_gatt_service1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_gatt_service1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezGattService1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattService1 * bluez_gatt_service1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_GATT_SERVICE1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", + bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattService1", NULL); + if (ret != NULL) + return BLUEZ_GATT_SERVICE1(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezGattService1Skeleton: + * + * The #BluezGattService1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezGattService1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezGattService1Skeleton. + */ + +struct _BluezGattService1SkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_gatt_service1_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, const gchar * interface_name, + const gchar * method_name, GVariant * parameters, + GDBusMethodInvocation * invocation, gpointer user_data) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_GATT_SERVICE1); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_GATT_SERVICE1); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_gatt_service1_skeleton_handle_get_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_service1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_gatt_service1_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GVariant * variant, GError ** error, + gpointer user_data) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_service1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_gatt_service1_skeleton_vtable = { _bluez_gatt_service1_skeleton_handle_method_call, + _bluez_gatt_service1_skeleton_handle_get_property, + _bluez_gatt_service1_skeleton_handle_set_property, + { NULL } }; + +static GDBusInterfaceInfo * bluez_gatt_service1_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_gatt_service1_interface_info(); +} + +static GDBusInterfaceVTable * +bluez_gatt_service1_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_gatt_service1_skeleton_vtable; +} + +static GVariant * bluez_gatt_service1_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_gatt_service1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_gatt_service1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_gatt_service1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_gatt_service1_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.bluez.GattService1", + info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static gboolean _bluez_gatt_service1_emit_changed(gpointer user_data); + +static void bluez_gatt_service1_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy(skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock(&skeleton->priv->lock); + + if (emit_changed) + _bluez_gatt_service1_emit_changed(skeleton); +} + +static void bluez_gatt_service1_skeleton_iface_init(BluezGattService1Iface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezGattService1Skeleton, bluez_gatt_service1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezGattService1Skeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_SERVICE1, bluez_gatt_service1_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezGattService1Skeleton, bluez_gatt_service1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_SERVICE1, bluez_gatt_service1_skeleton_iface_init)) + +#endif +static void bluez_gatt_service1_skeleton_finalize(GObject * object) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(object); + guint n; + for (n = 0; n < 3; n++) + g_value_unset(&skeleton->priv->properties[n]); + g_free(skeleton->priv->properties); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_gatt_service1_skeleton_parent_class)->finalize(object); +} + +static void bluez_gatt_service1_skeleton_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 3); + g_mutex_lock(&skeleton->priv->lock); + g_value_copy(&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock(&skeleton->priv->lock); +} + +static gboolean _bluez_gatt_service1_emit_changed(gpointer user_data) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(user_data); + GList * l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock(&skeleton->priv->lock); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&invalidated_builder, G_VARIANT_TYPE("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty * cp = l->data; + GVariant * variant; + const GValue * cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal(cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant(cur_value, G_VARIANT_TYPE(cp->info->parent_struct.signature)); + g_variant_builder_add(&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref(variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant * signal_variant; + signal_variant = g_variant_ref_sink(g_variant_new("(sa{sv}as)", "org.bluez.GattService1", &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection * connection = ll->data; + + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); + } + else + { + g_variant_builder_clear(&builder); + g_variant_builder_clear(&invalidated_builder); + } + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock(&skeleton->priv->lock); + return FALSE; +} + +static void _bluez_gatt_service1_schedule_emit_changed(BluezGattService1Skeleton * skeleton, + const _ExtendedGDBusPropertyInfo * info, guint prop_id, + const GValue * orig_value) +{ + ChangedProperty * cp; + GList * l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty * i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0(ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend(skeleton->priv->changed_properties, cp); + g_value_init(&cp->orig_value, G_VALUE_TYPE(orig_value)); + g_value_copy(orig_value, &cp->orig_value); + } +} + +static void bluez_gatt_service1_skeleton_notify(GObject * object, GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(object); + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new(); + g_source_set_priority(skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback(skeleton->priv->changed_properties_idle_source, _bluez_gatt_service1_emit_changed, + g_object_ref(skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name(skeleton->priv->changed_properties_idle_source, "[generated] _bluez_gatt_service1_emit_changed"); + g_source_attach(skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref(skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock(&skeleton->priv->lock); +} + +static void bluez_gatt_service1_skeleton_set_property(GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) +{ + const _ExtendedGDBusPropertyInfo * info; + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 3); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_gatt_service1_property_info_pointers[prop_id - 1]; + g_mutex_lock(&skeleton->priv->lock); + g_object_freeze_notify(object); + if (!_g_value_equal(value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)) != NULL && info->emits_changed_signal) + _bluez_gatt_service1_schedule_emit_changed(skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy(value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec(object, pspec); + } + g_mutex_unlock(&skeleton->priv->lock); + g_object_thaw_notify(object); +} + +static void bluez_gatt_service1_skeleton_init(BluezGattService1Skeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_gatt_service1_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_GATT_SERVICE1_SKELETON, BluezGattService1SkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); + skeleton->priv->properties = g_new0(GValue, 3); + g_value_init(&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[2], G_TYPE_BOOLEAN); +} + +static const gchar * bluez_gatt_service1_skeleton_get_uuid(BluezGattService1 * object) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[0])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_gatt_service1_skeleton_get_device(BluezGattService1 * object) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[1])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_gatt_service1_skeleton_get_primary(BluezGattService1 * object) +{ + BluezGattService1Skeleton * skeleton = BLUEZ_GATT_SERVICE1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[2])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static void bluez_gatt_service1_skeleton_class_init(BluezGattService1SkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_gatt_service1_skeleton_finalize; + gobject_class->get_property = bluez_gatt_service1_skeleton_get_property; + gobject_class->set_property = bluez_gatt_service1_skeleton_set_property; + gobject_class->notify = bluez_gatt_service1_skeleton_notify; + + bluez_gatt_service1_override_properties(gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_gatt_service1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_gatt_service1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_gatt_service1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_gatt_service1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezGattService1SkeletonPrivate)); +#endif +} + +static void bluez_gatt_service1_skeleton_iface_init(BluezGattService1Iface * iface) +{ + iface->get_uuid = bluez_gatt_service1_skeleton_get_uuid; + iface->get_device = bluez_gatt_service1_skeleton_get_device; + iface->get_primary = bluez_gatt_service1_skeleton_get_primary; +} + +/** + * bluez_gatt_service1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.bluez.GattService1. + * + * Returns: (transfer full) (type BluezGattService1Skeleton): The skeleton object. + */ +BluezGattService1 * bluez_gatt_service1_skeleton_new(void) +{ + return BLUEZ_GATT_SERVICE1(g_object_new(BLUEZ_TYPE_GATT_SERVICE1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.GattCharacteristic1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezGattCharacteristic1 + * @title: BluezGattCharacteristic1 + * @short_description: Generated C code for the org.bluez.GattCharacteristic1 D-Bus interface + * + * This section contains code for working with the org.bluez.GattCharacteristic1 D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.GattCharacteristic1 ---- */ + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_read_value_IN_ARG_options = { + { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_characteristic1_method_info_read_value_IN_ARG_pointers[] = { + &_bluez_gatt_characteristic1_method_info_read_value_IN_ARG_options.parent_struct, NULL +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_read_value_OUT_ARG_value = { + { -1, (gchar *) "value", (gchar *) "ay", NULL }, TRUE +}; + +static const GDBusArgInfo * const _bluez_gatt_characteristic1_method_info_read_value_OUT_ARG_pointers[] = { + &_bluez_gatt_characteristic1_method_info_read_value_OUT_ARG_value.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_characteristic1_method_info_read_value = { + { -1, (gchar *) "ReadValue", (GDBusArgInfo **) &_bluez_gatt_characteristic1_method_info_read_value_IN_ARG_pointers, + (GDBusArgInfo **) &_bluez_gatt_characteristic1_method_info_read_value_OUT_ARG_pointers, NULL }, + "handle-read-value", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_write_value_IN_ARG_value = { + { -1, (gchar *) "value", (gchar *) "ay", NULL }, TRUE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_write_value_IN_ARG_options = { + { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_characteristic1_method_info_write_value_IN_ARG_pointers[] = { + &_bluez_gatt_characteristic1_method_info_write_value_IN_ARG_value.parent_struct, + &_bluez_gatt_characteristic1_method_info_write_value_IN_ARG_options.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_characteristic1_method_info_write_value = { + { -1, (gchar *) "WriteValue", (GDBusArgInfo **) &_bluez_gatt_characteristic1_method_info_write_value_IN_ARG_pointers, NULL, + NULL }, + "handle-write-value", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_acquire_write_IN_ARG_options = { + { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_characteristic1_method_info_acquire_write_IN_ARG_pointers[] = { + &_bluez_gatt_characteristic1_method_info_acquire_write_IN_ARG_options.parent_struct, NULL +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_acquire_write_OUT_ARG_fd = { + { -1, (gchar *) "fd", (gchar *) "h", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_acquire_write_OUT_ARG_mtu = { + { -1, (gchar *) "mtu", (gchar *) "q", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_characteristic1_method_info_acquire_write_OUT_ARG_pointers[] = { + &_bluez_gatt_characteristic1_method_info_acquire_write_OUT_ARG_fd.parent_struct, + &_bluez_gatt_characteristic1_method_info_acquire_write_OUT_ARG_mtu.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_characteristic1_method_info_acquire_write = { + { -1, (gchar *) "AcquireWrite", (GDBusArgInfo **) &_bluez_gatt_characteristic1_method_info_acquire_write_IN_ARG_pointers, + (GDBusArgInfo **) &_bluez_gatt_characteristic1_method_info_acquire_write_OUT_ARG_pointers, NULL }, + "handle-acquire-write", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_acquire_notify_IN_ARG_options = { + { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_characteristic1_method_info_acquire_notify_IN_ARG_pointers[] = { + &_bluez_gatt_characteristic1_method_info_acquire_notify_IN_ARG_options.parent_struct, NULL +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_acquire_notify_OUT_ARG_fd = { + { -1, (gchar *) "fd", (gchar *) "h", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_characteristic1_method_info_acquire_notify_OUT_ARG_mtu = { + { -1, (gchar *) "mtu", (gchar *) "q", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_characteristic1_method_info_acquire_notify_OUT_ARG_pointers[] = { + &_bluez_gatt_characteristic1_method_info_acquire_notify_OUT_ARG_fd.parent_struct, + &_bluez_gatt_characteristic1_method_info_acquire_notify_OUT_ARG_mtu.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_characteristic1_method_info_acquire_notify = { + { -1, (gchar *) "AcquireNotify", (GDBusArgInfo **) &_bluez_gatt_characteristic1_method_info_acquire_notify_IN_ARG_pointers, + (GDBusArgInfo **) &_bluez_gatt_characteristic1_method_info_acquire_notify_OUT_ARG_pointers, NULL }, + "handle-acquire-notify", + FALSE +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_characteristic1_method_info_start_notify = { + { -1, (gchar *) "StartNotify", NULL, NULL, NULL }, "handle-start-notify", FALSE +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_characteristic1_method_info_stop_notify = { + { -1, (gchar *) "StopNotify", NULL, NULL, NULL }, "handle-stop-notify", FALSE +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_characteristic1_method_info_confirm = { + { -1, (gchar *) "Confirm", NULL, NULL, NULL }, "handle-confirm", FALSE +}; + +static const GDBusMethodInfo * const _bluez_gatt_characteristic1_method_info_pointers[] = { + &_bluez_gatt_characteristic1_method_info_read_value.parent_struct, + &_bluez_gatt_characteristic1_method_info_write_value.parent_struct, + &_bluez_gatt_characteristic1_method_info_acquire_write.parent_struct, + &_bluez_gatt_characteristic1_method_info_acquire_notify.parent_struct, + &_bluez_gatt_characteristic1_method_info_start_notify.parent_struct, + &_bluez_gatt_characteristic1_method_info_stop_notify.parent_struct, + &_bluez_gatt_characteristic1_method_info_confirm.parent_struct, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_characteristic1_property_info_uuid = { + { -1, (gchar *) "UUID", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "uuid", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_characteristic1_property_info_service = { + { -1, (gchar *) "Service", (gchar *) "o", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "service", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_characteristic1_property_info_value = { + { -1, (gchar *) "Value", (gchar *) "ay", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "value", TRUE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_characteristic1_property_info_notifying = { + { -1, (gchar *) "Notifying", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "notifying", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_characteristic1_property_info_flags = { + { -1, (gchar *) "Flags", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "flags", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_characteristic1_property_info_write_acquired = { + { -1, (gchar *) "WriteAcquired", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "write-acquired", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_characteristic1_property_info_notify_acquired = { + { -1, (gchar *) "NotifyAcquired", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "notify-acquired", FALSE, TRUE +}; + +static const GDBusPropertyInfo * const _bluez_gatt_characteristic1_property_info_pointers[] = { + &_bluez_gatt_characteristic1_property_info_uuid.parent_struct, + &_bluez_gatt_characteristic1_property_info_service.parent_struct, + &_bluez_gatt_characteristic1_property_info_value.parent_struct, + &_bluez_gatt_characteristic1_property_info_notifying.parent_struct, + &_bluez_gatt_characteristic1_property_info_flags.parent_struct, + &_bluez_gatt_characteristic1_property_info_write_acquired.parent_struct, + &_bluez_gatt_characteristic1_property_info_notify_acquired.parent_struct, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_gatt_characteristic1_interface_info = { + { -1, (gchar *) "org.bluez.GattCharacteristic1", (GDBusMethodInfo **) &_bluez_gatt_characteristic1_method_info_pointers, NULL, + (GDBusPropertyInfo **) &_bluez_gatt_characteristic1_property_info_pointers, NULL }, + "gatt-characteristic1", +}; + +/** + * bluez_gatt_characteristic1_interface_info: + * + * Gets a machine-readable description of the org.bluez.GattCharacteristic1 D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_gatt_characteristic1_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_gatt_characteristic1_interface_info.parent_struct; +} + +/** + * bluez_gatt_characteristic1_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezGattCharacteristic1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_gatt_characteristic1_override_properties(GObjectClass * klass, guint property_id_begin) +{ + g_object_class_override_property(klass, property_id_begin++, "uuid"); + g_object_class_override_property(klass, property_id_begin++, "service"); + g_object_class_override_property(klass, property_id_begin++, "value"); + g_object_class_override_property(klass, property_id_begin++, "notifying"); + g_object_class_override_property(klass, property_id_begin++, "flags"); + g_object_class_override_property(klass, property_id_begin++, "write-acquired"); + g_object_class_override_property(klass, property_id_begin++, "notify-acquired"); + return property_id_begin - 1; +} + +/** + * BluezGattCharacteristic1: + * + * Abstract interface type for the D-Bus interface org.bluez.GattCharacteristic1. + */ + +/** + * BluezGattCharacteristic1Iface: + * @parent_iface: The parent interface. + * @handle_acquire_notify: Handler for the #BluezGattCharacteristic1::handle-acquire-notify signal. + * @handle_acquire_write: Handler for the #BluezGattCharacteristic1::handle-acquire-write signal. + * @handle_confirm: Handler for the #BluezGattCharacteristic1::handle-confirm signal. + * @handle_read_value: Handler for the #BluezGattCharacteristic1::handle-read-value signal. + * @handle_start_notify: Handler for the #BluezGattCharacteristic1::handle-start-notify signal. + * @handle_stop_notify: Handler for the #BluezGattCharacteristic1::handle-stop-notify signal. + * @handle_write_value: Handler for the #BluezGattCharacteristic1::handle-write-value signal. + * @get_flags: Getter for the #BluezGattCharacteristic1:flags property. + * @get_notify_acquired: Getter for the #BluezGattCharacteristic1:notify-acquired property. + * @get_notifying: Getter for the #BluezGattCharacteristic1:notifying property. + * @get_service: Getter for the #BluezGattCharacteristic1:service property. + * @get_uuid: Getter for the #BluezGattCharacteristic1:uuid property. + * @get_value: Getter for the #BluezGattCharacteristic1:value property. + * @get_write_acquired: Getter for the #BluezGattCharacteristic1:write-acquired property. + * + * Virtual table for the D-Bus interface org.bluez.GattCharacteristic1. + */ + +typedef BluezGattCharacteristic1Iface BluezGattCharacteristic1Interface; +G_DEFINE_INTERFACE(BluezGattCharacteristic1, bluez_gatt_characteristic1, G_TYPE_OBJECT) + +static void bluez_gatt_characteristic1_default_init(BluezGattCharacteristic1Iface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezGattCharacteristic1::handle-read-value: + * @object: A #BluezGattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * @arg_options: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the ReadValue() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_characteristic1_complete_read_value() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-read-value", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattCharacteristic1Iface, handle_read_value), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); + + /** + * BluezGattCharacteristic1::handle-write-value: + * @object: A #BluezGattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * @arg_value: Argument passed by remote caller. + * @arg_options: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the WriteValue() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_characteristic1_complete_write_value() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-write-value", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattCharacteristic1Iface, handle_write_value), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 3, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_VARIANT); + + /** + * BluezGattCharacteristic1::handle-acquire-write: + * @object: A #BluezGattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * @arg_options: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the AcquireWrite() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_characteristic1_complete_acquire_write() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-acquire-write", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattCharacteristic1Iface, handle_acquire_write), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); + + /** + * BluezGattCharacteristic1::handle-acquire-notify: + * @object: A #BluezGattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * @arg_options: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the AcquireNotify() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_characteristic1_complete_acquire_notify() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-acquire-notify", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattCharacteristic1Iface, handle_acquire_notify), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); + + /** + * BluezGattCharacteristic1::handle-start-notify: + * @object: A #BluezGattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the StartNotify() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_characteristic1_complete_start_notify() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-start-notify", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattCharacteristic1Iface, handle_start_notify), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * BluezGattCharacteristic1::handle-stop-notify: + * @object: A #BluezGattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the StopNotify() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_characteristic1_complete_stop_notify() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-stop-notify", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattCharacteristic1Iface, handle_stop_notify), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /** + * BluezGattCharacteristic1::handle-confirm: + * @object: A #BluezGattCharacteristic1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the Confirm() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_characteristic1_complete_confirm() or e.g. g_dbus_method_invocation_return_error() + * on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-confirm", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattCharacteristic1Iface, handle_confirm), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject properties for D-Bus properties: */ + /** + * BluezGattCharacteristic1:uuid: + * + * Represents the D-Bus property "UUID". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("uuid", "UUID", "UUID", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattCharacteristic1:service: + * + * Represents the D-Bus property "Service". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("service", "Service", "Service", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattCharacteristic1:value: + * + * Represents the D-Bus property "Value". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_variant("value", "Value", "Value", G_VARIANT_TYPE("ay"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattCharacteristic1:notifying: + * + * Represents the D-Bus property "Notifying". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boolean("notifying", "Notifying", "Notifying", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattCharacteristic1:flags: + * + * Represents the D-Bus property "Flags". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boxed("flags", "Flags", "Flags", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattCharacteristic1:write-acquired: + * + * Represents the D-Bus property "WriteAcquired". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_boolean("write-acquired", "WriteAcquired", "WriteAcquired", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattCharacteristic1:notify-acquired: + * + * Represents the D-Bus property "NotifyAcquired". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_boolean("notify-acquired", "NotifyAcquired", "NotifyAcquired", FALSE, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * bluez_gatt_characteristic1_get_uuid: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets the value of the "UUID" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_gatt_characteristic1_dup_uuid() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_gatt_characteristic1_get_uuid(BluezGattCharacteristic1 * object) +{ + return BLUEZ_GATT_CHARACTERISTIC1_GET_IFACE(object)->get_uuid(object); +} + +/** + * bluez_gatt_characteristic1_dup_uuid: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets a copy of the "UUID" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_gatt_characteristic1_dup_uuid(BluezGattCharacteristic1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "uuid", &value, NULL); + return value; +} + +/** + * bluez_gatt_characteristic1_set_uuid: (skip) + * @object: A #BluezGattCharacteristic1. + * @value: The value to set. + * + * Sets the "UUID" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_characteristic1_set_uuid(BluezGattCharacteristic1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "uuid", value, NULL); +} + +/** + * bluez_gatt_characteristic1_get_service: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets the value of the "Service" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_gatt_characteristic1_dup_service() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_gatt_characteristic1_get_service(BluezGattCharacteristic1 * object) +{ + return BLUEZ_GATT_CHARACTERISTIC1_GET_IFACE(object)->get_service(object); +} + +/** + * bluez_gatt_characteristic1_dup_service: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets a copy of the "Service" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_gatt_characteristic1_dup_service(BluezGattCharacteristic1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "service", &value, NULL); + return value; +} + +/** + * bluez_gatt_characteristic1_set_service: (skip) + * @object: A #BluezGattCharacteristic1. + * @value: The value to set. + * + * Sets the "Service" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_characteristic1_set_service(BluezGattCharacteristic1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "service", value, NULL); +} + +/** + * bluez_gatt_characteristic1_get_value: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets the value of the "Value" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_gatt_characteristic1_dup_value() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +GVariant * bluez_gatt_characteristic1_get_value(BluezGattCharacteristic1 * object) +{ + return BLUEZ_GATT_CHARACTERISTIC1_GET_IFACE(object)->get_value(object); +} + +/** + * bluez_gatt_characteristic1_dup_value: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets a copy of the "Value" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_variant_unref(). + */ +GVariant * bluez_gatt_characteristic1_dup_value(BluezGattCharacteristic1 * object) +{ + GVariant * value; + g_object_get(G_OBJECT(object), "value", &value, NULL); + return value; +} + +/** + * bluez_gatt_characteristic1_set_value: (skip) + * @object: A #BluezGattCharacteristic1. + * @value: The value to set. + * + * Sets the "Value" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_characteristic1_set_value(BluezGattCharacteristic1 * object, GVariant * value) +{ + g_object_set(G_OBJECT(object), "value", value, NULL); +} + +/** + * bluez_gatt_characteristic1_get_notifying: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets the value of the "Notifying" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_gatt_characteristic1_get_notifying(BluezGattCharacteristic1 * object) +{ + return BLUEZ_GATT_CHARACTERISTIC1_GET_IFACE(object)->get_notifying(object); +} + +/** + * bluez_gatt_characteristic1_set_notifying: (skip) + * @object: A #BluezGattCharacteristic1. + * @value: The value to set. + * + * Sets the "Notifying" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_characteristic1_set_notifying(BluezGattCharacteristic1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "notifying", value, NULL); +} + +/** + * bluez_gatt_characteristic1_get_flags: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets the value of the "Flags" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_gatt_characteristic1_dup_flags() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * const * bluez_gatt_characteristic1_get_flags(BluezGattCharacteristic1 * object) +{ + return BLUEZ_GATT_CHARACTERISTIC1_GET_IFACE(object)->get_flags(object); +} + +/** + * bluez_gatt_characteristic1_dup_flags: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets a copy of the "Flags" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_strfreev(). + */ +gchar ** bluez_gatt_characteristic1_dup_flags(BluezGattCharacteristic1 * object) +{ + gchar ** value; + g_object_get(G_OBJECT(object), "flags", &value, NULL); + return value; +} + +/** + * bluez_gatt_characteristic1_set_flags: (skip) + * @object: A #BluezGattCharacteristic1. + * @value: The value to set. + * + * Sets the "Flags" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_characteristic1_set_flags(BluezGattCharacteristic1 * object, const gchar * const * value) +{ + g_object_set(G_OBJECT(object), "flags", value, NULL); +} + +/** + * bluez_gatt_characteristic1_get_write_acquired: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets the value of the "WriteAcquired" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_gatt_characteristic1_get_write_acquired(BluezGattCharacteristic1 * object) +{ + return BLUEZ_GATT_CHARACTERISTIC1_GET_IFACE(object)->get_write_acquired(object); +} + +/** + * bluez_gatt_characteristic1_set_write_acquired: (skip) + * @object: A #BluezGattCharacteristic1. + * @value: The value to set. + * + * Sets the "WriteAcquired" D-Bus property to + * @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_characteristic1_set_write_acquired(BluezGattCharacteristic1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "write-acquired", value, NULL); +} + +/** + * bluez_gatt_characteristic1_get_notify_acquired: (skip) + * @object: A #BluezGattCharacteristic1. + * + * Gets the value of the "NotifyAcquired" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_gatt_characteristic1_get_notify_acquired(BluezGattCharacteristic1 * object) +{ + return BLUEZ_GATT_CHARACTERISTIC1_GET_IFACE(object)->get_notify_acquired(object); +} + +/** + * bluez_gatt_characteristic1_set_notify_acquired: (skip) + * @object: A #BluezGattCharacteristic1. + * @value: The value to set. + * + * Sets the "NotifyAcquired" D-Bus property to + * @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_characteristic1_set_notify_acquired(BluezGattCharacteristic1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "notify-acquired", value, NULL); +} + +/** + * bluez_gatt_characteristic1_call_read_value: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the ReadValue() D-Bus method + * on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_gatt_characteristic1_call_read_value_finish() to get the result of the operation. + * + * See bluez_gatt_characteristic1_call_read_value_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_characteristic1_call_read_value(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "ReadValue", g_variant_new("(@a{sv})", arg_options), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_gatt_characteristic1_call_read_value_finish: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_characteristic1_call_read_value(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_characteristic1_call_read_value(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_read_value_finish(BluezGattCharacteristic1 * proxy, GVariant ** out_value, + GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@ay)", out_value); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_read_value_sync: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @arg_options: Argument to pass with the method invocation. + * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the ReadValue() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_characteristic1_call_read_value() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_read_value_sync(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GVariant ** out_value, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "ReadValue", g_variant_new("(@a{sv})", arg_options), G_DBUS_CALL_FLAGS_NONE, + -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@ay)", out_value); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_write_value: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @arg_value: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the WriteValue() D-Bus method + * on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_gatt_characteristic1_call_write_value_finish() to get the result of the operation. + * + * See bluez_gatt_characteristic1_call_write_value_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_characteristic1_call_write_value(BluezGattCharacteristic1 * proxy, GVariant * arg_value, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "WriteValue", g_variant_new("(@ay@a{sv})", arg_value, arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); +} + +/** + * bluez_gatt_characteristic1_call_write_value_finish: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_characteristic1_call_write_value(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_characteristic1_call_write_value(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_write_value_finish(BluezGattCharacteristic1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_write_value_sync: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @arg_value: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the WriteValue() D-Bus method + * on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_characteristic1_call_write_value() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_write_value_sync(BluezGattCharacteristic1 * proxy, GVariant * arg_value, + GVariant * arg_options, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "WriteValue", g_variant_new("(@ay@a{sv})", arg_value, arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_acquire_write: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the AcquireWrite() D-Bus + * method on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_gatt_characteristic1_call_acquire_write_finish() to get the result of the operation. + * + * See bluez_gatt_characteristic1_call_acquire_write_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_characteristic1_call_acquire_write(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "AcquireWrite", g_variant_new("(@a{sv})", arg_options), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_gatt_characteristic1_call_acquire_write_finish: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @out_fd: (out) (optional): Return location for return parameter or %NULL to ignore. + * @out_mtu: (out) (optional): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_characteristic1_call_acquire_write(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_characteristic1_call_acquire_write(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_acquire_write_finish(BluezGattCharacteristic1 * proxy, GVariant ** out_fd, + guint16 * out_mtu, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@hq)", out_fd, out_mtu); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_acquire_write_sync: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @arg_options: Argument to pass with the method invocation. + * @out_fd: (out) (optional): Return location for return parameter or %NULL to ignore. + * @out_mtu: (out) (optional): Return location for return parameter or %NULL to ignore. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the AcquireWrite() D-Bus + * method on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_characteristic1_call_acquire_write() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_acquire_write_sync(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GVariant ** out_fd, guint16 * out_mtu, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "AcquireWrite", g_variant_new("(@a{sv})", arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@hq)", out_fd, out_mtu); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_acquire_notify: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the AcquireNotify() D-Bus + * method on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_gatt_characteristic1_call_acquire_notify_finish() to get the result of the operation. + * + * See bluez_gatt_characteristic1_call_acquire_notify_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_characteristic1_call_acquire_notify(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "AcquireNotify", g_variant_new("(@a{sv})", arg_options), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_gatt_characteristic1_call_acquire_notify_finish: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @out_fd: (out) (optional): Return location for return parameter or %NULL to ignore. + * @out_mtu: (out) (optional): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_characteristic1_call_acquire_notify(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_characteristic1_call_acquire_notify(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_acquire_notify_finish(BluezGattCharacteristic1 * proxy, GVariant ** out_fd, + guint16 * out_mtu, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@hq)", out_fd, out_mtu); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_acquire_notify_sync: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @arg_options: Argument to pass with the method invocation. + * @out_fd: (out) (optional): Return location for return parameter or %NULL to ignore. + * @out_mtu: (out) (optional): Return location for return parameter or %NULL to ignore. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the AcquireNotify() D-Bus + * method on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_characteristic1_call_acquire_notify() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_acquire_notify_sync(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GVariant ** out_fd, guint16 * out_mtu, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "AcquireNotify", g_variant_new("(@a{sv})", arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@hq)", out_fd, out_mtu); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_start_notify: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the StartNotify() D-Bus + * method on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_gatt_characteristic1_call_start_notify_finish() to get the result of the operation. + * + * See bluez_gatt_characteristic1_call_start_notify_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_characteristic1_call_start_notify(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "StartNotify", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_gatt_characteristic1_call_start_notify_finish: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_characteristic1_call_start_notify(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_characteristic1_call_start_notify(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_start_notify_finish(BluezGattCharacteristic1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_start_notify_sync: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the StartNotify() D-Bus + * method on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_characteristic1_call_start_notify() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_start_notify_sync(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "StartNotify", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_stop_notify: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the StopNotify() D-Bus method + * on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_gatt_characteristic1_call_stop_notify_finish() to get the result of the operation. + * + * See bluez_gatt_characteristic1_call_stop_notify_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_characteristic1_call_stop_notify(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "StopNotify", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_gatt_characteristic1_call_stop_notify_finish: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_characteristic1_call_stop_notify(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_characteristic1_call_stop_notify(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_stop_notify_finish(BluezGattCharacteristic1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_stop_notify_sync: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the StopNotify() D-Bus method + * on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_characteristic1_call_stop_notify() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_stop_notify_sync(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "StopNotify", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, + error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_confirm: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the Confirm() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_characteristic1_call_confirm_finish() + * to get the result of the operation. + * + * See bluez_gatt_characteristic1_call_confirm_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_characteristic1_call_confirm(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "Confirm", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_gatt_characteristic1_call_confirm_finish: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_characteristic1_call_confirm(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_characteristic1_call_confirm(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_confirm_finish(BluezGattCharacteristic1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_call_confirm_sync: + * @proxy: A #BluezGattCharacteristic1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Confirm() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_characteristic1_call_confirm() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_characteristic1_call_confirm_sync(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = + g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "Confirm", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_characteristic1_complete_read_value: + * @object: A #BluezGattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @value: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the ReadValue() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_characteristic1_complete_read_value(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, + GVariant * value) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("(@ay)", value)); +} + +/** + * bluez_gatt_characteristic1_complete_write_value: + * @object: A #BluezGattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the WriteValue() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_characteristic1_complete_write_value(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_gatt_characteristic1_complete_acquire_write: + * @object: A #BluezGattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @fd: Parameter to return. + * @mtu: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the AcquireWrite() D-Bus method. If you instead want to + * finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_characteristic1_complete_acquire_write(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, + GVariant * fd, guint16 mtu) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("(@hq)", fd, mtu)); +} + +/** + * bluez_gatt_characteristic1_complete_acquire_notify: + * @object: A #BluezGattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @fd: Parameter to return. + * @mtu: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the AcquireNotify() D-Bus method. If you instead want to + * finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_characteristic1_complete_acquire_notify(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, + GVariant * fd, guint16 mtu) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("(@hq)", fd, mtu)); +} + +/** + * bluez_gatt_characteristic1_complete_start_notify: + * @object: A #BluezGattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the StartNotify() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_characteristic1_complete_start_notify(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_gatt_characteristic1_complete_stop_notify: + * @object: A #BluezGattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the StopNotify() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_characteristic1_complete_stop_notify(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_gatt_characteristic1_complete_confirm: + * @object: A #BluezGattCharacteristic1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Confirm() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_characteristic1_complete_confirm(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezGattCharacteristic1Proxy: + * + * The #BluezGattCharacteristic1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezGattCharacteristic1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezGattCharacteristic1Proxy. + */ + +struct _BluezGattCharacteristic1ProxyPrivate +{ + GData * qdata; +}; + +static void bluez_gatt_characteristic1_proxy_iface_init(BluezGattCharacteristic1Iface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezGattCharacteristic1Proxy, bluez_gatt_characteristic1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezGattCharacteristic1Proxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_CHARACTERISTIC1, bluez_gatt_characteristic1_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezGattCharacteristic1Proxy, bluez_gatt_characteristic1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_CHARACTERISTIC1, bluez_gatt_characteristic1_proxy_iface_init)) + +#endif +static void bluez_gatt_characteristic1_proxy_finalize(GObject * object) +{ + BluezGattCharacteristic1Proxy * proxy = BLUEZ_GATT_CHARACTERISTIC1_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_gatt_characteristic1_proxy_parent_class)->finalize(object); +} + +static void bluez_gatt_characteristic1_proxy_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 7); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_gatt_characteristic1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant(value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue(variant, value); + } + if (variant != NULL) + g_variant_unref(variant); +} + +static void bluez_gatt_characteristic1_proxy_set_property_cb(GDBusProxy * proxy, GAsyncResult * res, gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo * info = user_data; + GError * error; + GVariant * _ret; + error = NULL; + _ret = g_dbus_proxy_call_finish(proxy, res, &error); + if (!_ret) + { + g_warning("Error setting property '%s' on interface org.bluez.GattCharacteristic1: %s (%s, %d)", info->parent_struct.name, + error->message, g_quark_to_string(error->domain), error->code); + g_error_free(error); + } + else + { + g_variant_unref(_ret); + } +} + +static void bluez_gatt_characteristic1_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 7); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_gatt_characteristic1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant(value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_dbus_proxy_call(G_DBUS_PROXY(object), "org.freedesktop.DBus.Properties.Set", + g_variant_new("(ssv)", "org.bluez.GattCharacteristic1", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) bluez_gatt_characteristic1_proxy_set_property_cb, + (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref(variant); +} + +static void bluez_gatt_characteristic1_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, + const gchar * signal_name, GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_gatt_characteristic1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_GATT_CHARACTERISTIC1); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_GATT_CHARACTERISTIC1); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_gatt_characteristic1_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezGattCharacteristic1Proxy * proxy = BLUEZ_GATT_CHARACTERISTIC1_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_characteristic1_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_characteristic1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static const gchar * bluez_gatt_characteristic1_proxy_get_uuid(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Proxy * proxy = BLUEZ_GATT_CHARACTERISTIC1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "UUID"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_gatt_characteristic1_proxy_get_service(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Proxy * proxy = BLUEZ_GATT_CHARACTERISTIC1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Service"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static GVariant * bluez_gatt_characteristic1_proxy_get_value(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Proxy * proxy = BLUEZ_GATT_CHARACTERISTIC1_PROXY(object); + GVariant * variant; + GVariant * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Value"); + value = variant; + if (variant != NULL) + g_variant_unref(variant); + return value; +} + +static gboolean bluez_gatt_characteristic1_proxy_get_notifying(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Proxy * proxy = BLUEZ_GATT_CHARACTERISTIC1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Notifying"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static const gchar * const * bluez_gatt_characteristic1_proxy_get_flags(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Proxy * proxy = BLUEZ_GATT_CHARACTERISTIC1_PROXY(object); + GVariant * variant; + const gchar * const * value = NULL; + value = g_datalist_get_data(&proxy->priv->qdata, "Flags"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Flags"); + if (variant != NULL) + { + value = g_variant_get_strv(variant, NULL); + g_datalist_set_data_full(&proxy->priv->qdata, "Flags", (gpointer) value, g_free); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_gatt_characteristic1_proxy_get_write_acquired(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Proxy * proxy = BLUEZ_GATT_CHARACTERISTIC1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "WriteAcquired"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static gboolean bluez_gatt_characteristic1_proxy_get_notify_acquired(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Proxy * proxy = BLUEZ_GATT_CHARACTERISTIC1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "NotifyAcquired"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static void bluez_gatt_characteristic1_proxy_init(BluezGattCharacteristic1Proxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_gatt_characteristic1_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY, BluezGattCharacteristic1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_gatt_characteristic1_interface_info()); +} + +static void bluez_gatt_characteristic1_proxy_class_init(BluezGattCharacteristic1ProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_gatt_characteristic1_proxy_finalize; + gobject_class->get_property = bluez_gatt_characteristic1_proxy_get_property; + gobject_class->set_property = bluez_gatt_characteristic1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_gatt_characteristic1_proxy_g_signal; + proxy_class->g_properties_changed = bluez_gatt_characteristic1_proxy_g_properties_changed; + + bluez_gatt_characteristic1_override_properties(gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezGattCharacteristic1ProxyPrivate)); +#endif +} + +static void bluez_gatt_characteristic1_proxy_iface_init(BluezGattCharacteristic1Iface * iface) +{ + iface->get_uuid = bluez_gatt_characteristic1_proxy_get_uuid; + iface->get_service = bluez_gatt_characteristic1_proxy_get_service; + iface->get_value = bluez_gatt_characteristic1_proxy_get_value; + iface->get_notifying = bluez_gatt_characteristic1_proxy_get_notifying; + iface->get_flags = bluez_gatt_characteristic1_proxy_get_flags; + iface->get_write_acquired = bluez_gatt_characteristic1_proxy_get_write_acquired; + iface->get_notify_acquired = bluez_gatt_characteristic1_proxy_get_notify_acquired; +} + +/** + * bluez_gatt_characteristic1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.bluez.GattCharacteristic1. See g_dbus_proxy_new() + * for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_characteristic1_proxy_new_finish() to get + * the result of the operation. + * + * See bluez_gatt_characteristic1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_gatt_characteristic1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, + "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, + "g-interface-name", "org.bluez.GattCharacteristic1", NULL); +} + +/** + * bluez_gatt_characteristic1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_characteristic1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_gatt_characteristic1_proxy_new(). + * + * Returns: (transfer full) (type BluezGattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattCharacteristic1 * bluez_gatt_characteristic1_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_GATT_CHARACTERISTIC1(ret); + else + return NULL; +} + +/** + * bluez_gatt_characteristic1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.bluez.GattCharacteristic1. See + * g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_gatt_characteristic1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezGattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattCharacteristic1 * bluez_gatt_characteristic1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = + g_initable_new(BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", + connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattCharacteristic1", NULL); + if (ret != NULL) + return BLUEZ_GATT_CHARACTERISTIC1(ret); + else + return NULL; +} + +/** + * bluez_gatt_characteristic1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_gatt_characteristic1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_characteristic1_proxy_new_for_bus_finish() + * to get the result of the operation. + * + * See bluez_gatt_characteristic1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_gatt_characteristic1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, + "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, + "g-interface-name", "org.bluez.GattCharacteristic1", NULL); +} + +/** + * bluez_gatt_characteristic1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_characteristic1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_gatt_characteristic1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezGattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattCharacteristic1 * bluez_gatt_characteristic1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_GATT_CHARACTERISTIC1(ret); + else + return NULL; +} + +/** + * bluez_gatt_characteristic1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_gatt_characteristic1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_gatt_characteristic1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezGattCharacteristic1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattCharacteristic1 * bluez_gatt_characteristic1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", + bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattCharacteristic1", NULL); + if (ret != NULL) + return BLUEZ_GATT_CHARACTERISTIC1(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezGattCharacteristic1Skeleton: + * + * The #BluezGattCharacteristic1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezGattCharacteristic1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezGattCharacteristic1Skeleton. + */ + +struct _BluezGattCharacteristic1SkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_gatt_characteristic1_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name, const gchar * method_name, + GVariant * parameters, GDBusMethodInvocation * invocation, + gpointer user_data) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_GATT_CHARACTERISTIC1); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_GATT_CHARACTERISTIC1); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_gatt_characteristic1_skeleton_handle_get_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_characteristic1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_gatt_characteristic1_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GVariant * variant, + GError ** error, gpointer user_data) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_characteristic1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_gatt_characteristic1_skeleton_vtable = { + _bluez_gatt_characteristic1_skeleton_handle_method_call, + _bluez_gatt_characteristic1_skeleton_handle_get_property, + _bluez_gatt_characteristic1_skeleton_handle_set_property, + { NULL } +}; + +static GDBusInterfaceInfo * +bluez_gatt_characteristic1_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_gatt_characteristic1_interface_info(); +} + +static GDBusInterfaceVTable * +bluez_gatt_characteristic1_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_gatt_characteristic1_skeleton_vtable; +} + +static GVariant * bluez_gatt_characteristic1_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_gatt_characteristic1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_gatt_characteristic1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_gatt_characteristic1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_gatt_characteristic1_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.bluez.GattCharacteristic1", + info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static gboolean _bluez_gatt_characteristic1_emit_changed(gpointer user_data); + +static void bluez_gatt_characteristic1_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy(skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock(&skeleton->priv->lock); + + if (emit_changed) + _bluez_gatt_characteristic1_emit_changed(skeleton); +} + +static void bluez_gatt_characteristic1_skeleton_iface_init(BluezGattCharacteristic1Iface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezGattCharacteristic1Skeleton, bluez_gatt_characteristic1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezGattCharacteristic1Skeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_CHARACTERISTIC1, bluez_gatt_characteristic1_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezGattCharacteristic1Skeleton, bluez_gatt_characteristic1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_CHARACTERISTIC1, bluez_gatt_characteristic1_skeleton_iface_init)) + +#endif +static void bluez_gatt_characteristic1_skeleton_finalize(GObject * object) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + guint n; + for (n = 0; n < 7; n++) + g_value_unset(&skeleton->priv->properties[n]); + g_free(skeleton->priv->properties); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_gatt_characteristic1_skeleton_parent_class)->finalize(object); +} + +static void bluez_gatt_characteristic1_skeleton_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 7); + g_mutex_lock(&skeleton->priv->lock); + g_value_copy(&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock(&skeleton->priv->lock); +} + +static gboolean _bluez_gatt_characteristic1_emit_changed(gpointer user_data) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(user_data); + GList * l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock(&skeleton->priv->lock); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&invalidated_builder, G_VARIANT_TYPE("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty * cp = l->data; + GVariant * variant; + const GValue * cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal(cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant(cur_value, G_VARIANT_TYPE(cp->info->parent_struct.signature)); + g_variant_builder_add(&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref(variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant * signal_variant; + signal_variant = + g_variant_ref_sink(g_variant_new("(sa{sv}as)", "org.bluez.GattCharacteristic1", &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection * connection = ll->data; + + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); + } + else + { + g_variant_builder_clear(&builder); + g_variant_builder_clear(&invalidated_builder); + } + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock(&skeleton->priv->lock); + return FALSE; +} + +static void _bluez_gatt_characteristic1_schedule_emit_changed(BluezGattCharacteristic1Skeleton * skeleton, + const _ExtendedGDBusPropertyInfo * info, guint prop_id, + const GValue * orig_value) +{ + ChangedProperty * cp; + GList * l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty * i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0(ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend(skeleton->priv->changed_properties, cp); + g_value_init(&cp->orig_value, G_VALUE_TYPE(orig_value)); + g_value_copy(orig_value, &cp->orig_value); + } +} + +static void bluez_gatt_characteristic1_skeleton_notify(GObject * object, GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new(); + g_source_set_priority(skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback(skeleton->priv->changed_properties_idle_source, _bluez_gatt_characteristic1_emit_changed, + g_object_ref(skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name(skeleton->priv->changed_properties_idle_source, "[generated] _bluez_gatt_characteristic1_emit_changed"); + g_source_attach(skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref(skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock(&skeleton->priv->lock); +} + +static void bluez_gatt_characteristic1_skeleton_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec) +{ + const _ExtendedGDBusPropertyInfo * info; + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 7); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_gatt_characteristic1_property_info_pointers[prop_id - 1]; + g_mutex_lock(&skeleton->priv->lock); + g_object_freeze_notify(object); + if (!_g_value_equal(value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)) != NULL && info->emits_changed_signal) + _bluez_gatt_characteristic1_schedule_emit_changed(skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy(value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec(object, pspec); + } + g_mutex_unlock(&skeleton->priv->lock); + g_object_thaw_notify(object); +} + +static void bluez_gatt_characteristic1_skeleton_init(BluezGattCharacteristic1Skeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_gatt_characteristic1_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = + G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_GATT_CHARACTERISTIC1_SKELETON, BluezGattCharacteristic1SkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); + skeleton->priv->properties = g_new0(GValue, 7); + g_value_init(&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[2], G_TYPE_VARIANT); + g_value_init(&skeleton->priv->properties[3], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[4], G_TYPE_STRV); + g_value_init(&skeleton->priv->properties[5], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[6], G_TYPE_BOOLEAN); +} + +static const gchar * bluez_gatt_characteristic1_skeleton_get_uuid(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[0])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_gatt_characteristic1_skeleton_get_service(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[1])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static GVariant * bluez_gatt_characteristic1_skeleton_get_value(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + GVariant * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_variant(&(skeleton->priv->properties[2])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_gatt_characteristic1_skeleton_get_notifying(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[3])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * const * bluez_gatt_characteristic1_skeleton_get_flags(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + const gchar * const * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boxed(&(skeleton->priv->properties[4])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_gatt_characteristic1_skeleton_get_write_acquired(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[5])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_gatt_characteristic1_skeleton_get_notify_acquired(BluezGattCharacteristic1 * object) +{ + BluezGattCharacteristic1Skeleton * skeleton = BLUEZ_GATT_CHARACTERISTIC1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[6])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static void bluez_gatt_characteristic1_skeleton_class_init(BluezGattCharacteristic1SkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_gatt_characteristic1_skeleton_finalize; + gobject_class->get_property = bluez_gatt_characteristic1_skeleton_get_property; + gobject_class->set_property = bluez_gatt_characteristic1_skeleton_set_property; + gobject_class->notify = bluez_gatt_characteristic1_skeleton_notify; + + bluez_gatt_characteristic1_override_properties(gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_gatt_characteristic1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_gatt_characteristic1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_gatt_characteristic1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_gatt_characteristic1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezGattCharacteristic1SkeletonPrivate)); +#endif +} + +static void bluez_gatt_characteristic1_skeleton_iface_init(BluezGattCharacteristic1Iface * iface) +{ + iface->get_uuid = bluez_gatt_characteristic1_skeleton_get_uuid; + iface->get_service = bluez_gatt_characteristic1_skeleton_get_service; + iface->get_value = bluez_gatt_characteristic1_skeleton_get_value; + iface->get_notifying = bluez_gatt_characteristic1_skeleton_get_notifying; + iface->get_flags = bluez_gatt_characteristic1_skeleton_get_flags; + iface->get_write_acquired = bluez_gatt_characteristic1_skeleton_get_write_acquired; + iface->get_notify_acquired = bluez_gatt_characteristic1_skeleton_get_notify_acquired; +} + +/** + * bluez_gatt_characteristic1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.bluez.GattCharacteristic1. + * + * Returns: (transfer full) (type BluezGattCharacteristic1Skeleton): The skeleton object. + */ +BluezGattCharacteristic1 * bluez_gatt_characteristic1_skeleton_new(void) +{ + return BLUEZ_GATT_CHARACTERISTIC1(g_object_new(BLUEZ_TYPE_GATT_CHARACTERISTIC1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.GattDescriptor1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezGattDescriptor1 + * @title: BluezGattDescriptor1 + * @short_description: Generated C code for the org.bluez.GattDescriptor1 D-Bus interface + * + * This section contains code for working with the org.bluez.GattDescriptor1 D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.GattDescriptor1 ---- */ + +static const _ExtendedGDBusArgInfo _bluez_gatt_descriptor1_method_info_read_value_IN_ARG_options = { + { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_descriptor1_method_info_read_value_IN_ARG_pointers[] = { + &_bluez_gatt_descriptor1_method_info_read_value_IN_ARG_options.parent_struct, NULL +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_descriptor1_method_info_read_value_OUT_ARG_value = { + { -1, (gchar *) "value", (gchar *) "ay", NULL }, TRUE +}; + +static const GDBusArgInfo * const _bluez_gatt_descriptor1_method_info_read_value_OUT_ARG_pointers[] = { + &_bluez_gatt_descriptor1_method_info_read_value_OUT_ARG_value.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_descriptor1_method_info_read_value = { + { -1, (gchar *) "ReadValue", (GDBusArgInfo **) &_bluez_gatt_descriptor1_method_info_read_value_IN_ARG_pointers, + (GDBusArgInfo **) &_bluez_gatt_descriptor1_method_info_read_value_OUT_ARG_pointers, NULL }, + "handle-read-value", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_descriptor1_method_info_write_value_IN_ARG_value = { + { -1, (gchar *) "value", (gchar *) "ay", NULL }, TRUE +}; + +static const _ExtendedGDBusArgInfo _bluez_gatt_descriptor1_method_info_write_value_IN_ARG_options = { + { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_gatt_descriptor1_method_info_write_value_IN_ARG_pointers[] = { + &_bluez_gatt_descriptor1_method_info_write_value_IN_ARG_value.parent_struct, + &_bluez_gatt_descriptor1_method_info_write_value_IN_ARG_options.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_gatt_descriptor1_method_info_write_value = { + { -1, (gchar *) "WriteValue", (GDBusArgInfo **) &_bluez_gatt_descriptor1_method_info_write_value_IN_ARG_pointers, NULL, NULL }, + "handle-write-value", + FALSE +}; + +static const GDBusMethodInfo * const _bluez_gatt_descriptor1_method_info_pointers[] = { + &_bluez_gatt_descriptor1_method_info_read_value.parent_struct, &_bluez_gatt_descriptor1_method_info_write_value.parent_struct, + NULL +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_descriptor1_property_info_uuid = { + { -1, (gchar *) "UUID", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "uuid", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_descriptor1_property_info_characteristic = { + { -1, (gchar *) "Characteristic", (gchar *) "o", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "characteristic", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_gatt_descriptor1_property_info_value = { + { -1, (gchar *) "Value", (gchar *) "ay", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "value", TRUE, TRUE +}; + +static const GDBusPropertyInfo * const _bluez_gatt_descriptor1_property_info_pointers[] = { + &_bluez_gatt_descriptor1_property_info_uuid.parent_struct, &_bluez_gatt_descriptor1_property_info_characteristic.parent_struct, + &_bluez_gatt_descriptor1_property_info_value.parent_struct, NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_gatt_descriptor1_interface_info = { + { -1, (gchar *) "org.bluez.GattDescriptor1", (GDBusMethodInfo **) &_bluez_gatt_descriptor1_method_info_pointers, NULL, + (GDBusPropertyInfo **) &_bluez_gatt_descriptor1_property_info_pointers, NULL }, + "gatt-descriptor1", +}; + +/** + * bluez_gatt_descriptor1_interface_info: + * + * Gets a machine-readable description of the org.bluez.GattDescriptor1 D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_gatt_descriptor1_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_gatt_descriptor1_interface_info.parent_struct; +} + +/** + * bluez_gatt_descriptor1_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezGattDescriptor1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_gatt_descriptor1_override_properties(GObjectClass * klass, guint property_id_begin) +{ + g_object_class_override_property(klass, property_id_begin++, "uuid"); + g_object_class_override_property(klass, property_id_begin++, "characteristic"); + g_object_class_override_property(klass, property_id_begin++, "value"); + return property_id_begin - 1; +} + +/** + * BluezGattDescriptor1: + * + * Abstract interface type for the D-Bus interface org.bluez.GattDescriptor1. + */ + +/** + * BluezGattDescriptor1Iface: + * @parent_iface: The parent interface. + * @handle_read_value: Handler for the #BluezGattDescriptor1::handle-read-value signal. + * @handle_write_value: Handler for the #BluezGattDescriptor1::handle-write-value signal. + * @get_characteristic: Getter for the #BluezGattDescriptor1:characteristic property. + * @get_uuid: Getter for the #BluezGattDescriptor1:uuid property. + * @get_value: Getter for the #BluezGattDescriptor1:value property. + * + * Virtual table for the D-Bus interface org.bluez.GattDescriptor1. + */ + +typedef BluezGattDescriptor1Iface BluezGattDescriptor1Interface; +G_DEFINE_INTERFACE(BluezGattDescriptor1, bluez_gatt_descriptor1, G_TYPE_OBJECT) + +static void bluez_gatt_descriptor1_default_init(BluezGattDescriptor1Iface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezGattDescriptor1::handle-read-value: + * @object: A #BluezGattDescriptor1. + * @invocation: A #GDBusMethodInvocation. + * @arg_options: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the ReadValue() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_descriptor1_complete_read_value() or e.g. g_dbus_method_invocation_return_error() + * on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-read-value", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattDescriptor1Iface, handle_read_value), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT); + + /** + * BluezGattDescriptor1::handle-write-value: + * @object: A #BluezGattDescriptor1. + * @invocation: A #GDBusMethodInvocation. + * @arg_value: Argument passed by remote caller. + * @arg_options: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the WriteValue() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_gatt_descriptor1_complete_write_value() or e.g. g_dbus_method_invocation_return_error() + * on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-write-value", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezGattDescriptor1Iface, handle_write_value), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 3, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT, G_TYPE_VARIANT); + + /* GObject properties for D-Bus properties: */ + /** + * BluezGattDescriptor1:uuid: + * + * Represents the D-Bus property "UUID". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("uuid", "UUID", "UUID", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattDescriptor1:characteristic: + * + * Represents the D-Bus property "Characteristic". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_string("characteristic", "Characteristic", "Characteristic", NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezGattDescriptor1:value: + * + * Represents the D-Bus property "Value". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_variant("value", "Value", "Value", G_VARIANT_TYPE("ay"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * bluez_gatt_descriptor1_get_uuid: (skip) + * @object: A #BluezGattDescriptor1. + * + * Gets the value of the "UUID" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_gatt_descriptor1_dup_uuid() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_gatt_descriptor1_get_uuid(BluezGattDescriptor1 * object) +{ + return BLUEZ_GATT_DESCRIPTOR1_GET_IFACE(object)->get_uuid(object); +} + +/** + * bluez_gatt_descriptor1_dup_uuid: (skip) + * @object: A #BluezGattDescriptor1. + * + * Gets a copy of the "UUID" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_gatt_descriptor1_dup_uuid(BluezGattDescriptor1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "uuid", &value, NULL); + return value; +} + +/** + * bluez_gatt_descriptor1_set_uuid: (skip) + * @object: A #BluezGattDescriptor1. + * @value: The value to set. + * + * Sets the "UUID" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_descriptor1_set_uuid(BluezGattDescriptor1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "uuid", value, NULL); +} + +/** + * bluez_gatt_descriptor1_get_characteristic: (skip) + * @object: A #BluezGattDescriptor1. + * + * Gets the value of the "Characteristic" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_gatt_descriptor1_dup_characteristic() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_gatt_descriptor1_get_characteristic(BluezGattDescriptor1 * object) +{ + return BLUEZ_GATT_DESCRIPTOR1_GET_IFACE(object)->get_characteristic(object); +} + +/** + * bluez_gatt_descriptor1_dup_characteristic: (skip) + * @object: A #BluezGattDescriptor1. + * + * Gets a copy of the "Characteristic" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_gatt_descriptor1_dup_characteristic(BluezGattDescriptor1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "characteristic", &value, NULL); + return value; +} + +/** + * bluez_gatt_descriptor1_set_characteristic: (skip) + * @object: A #BluezGattDescriptor1. + * @value: The value to set. + * + * Sets the "Characteristic" D-Bus property to + * @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_descriptor1_set_characteristic(BluezGattDescriptor1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "characteristic", value, NULL); +} + +/** + * bluez_gatt_descriptor1_get_value: (skip) + * @object: A #BluezGattDescriptor1. + * + * Gets the value of the "Value" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_gatt_descriptor1_dup_value() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +GVariant * bluez_gatt_descriptor1_get_value(BluezGattDescriptor1 * object) +{ + return BLUEZ_GATT_DESCRIPTOR1_GET_IFACE(object)->get_value(object); +} + +/** + * bluez_gatt_descriptor1_dup_value: (skip) + * @object: A #BluezGattDescriptor1. + * + * Gets a copy of the "Value" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_variant_unref(). + */ +GVariant * bluez_gatt_descriptor1_dup_value(BluezGattDescriptor1 * object) +{ + GVariant * value; + g_object_get(G_OBJECT(object), "value", &value, NULL); + return value; +} + +/** + * bluez_gatt_descriptor1_set_value: (skip) + * @object: A #BluezGattDescriptor1. + * @value: The value to set. + * + * Sets the "Value" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_gatt_descriptor1_set_value(BluezGattDescriptor1 * object, GVariant * value) +{ + g_object_set(G_OBJECT(object), "value", value, NULL); +} + +/** + * bluez_gatt_descriptor1_call_read_value: + * @proxy: A #BluezGattDescriptor1Proxy. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the ReadValue() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_descriptor1_call_read_value_finish() to + * get the result of the operation. + * + * See bluez_gatt_descriptor1_call_read_value_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_descriptor1_call_read_value(BluezGattDescriptor1 * proxy, GVariant * arg_options, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "ReadValue", g_variant_new("(@a{sv})", arg_options), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_gatt_descriptor1_call_read_value_finish: + * @proxy: A #BluezGattDescriptor1Proxy. + * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_descriptor1_call_read_value(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_descriptor1_call_read_value(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_descriptor1_call_read_value_finish(BluezGattDescriptor1 * proxy, GVariant ** out_value, GAsyncResult * res, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@ay)", out_value); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_descriptor1_call_read_value_sync: + * @proxy: A #BluezGattDescriptor1Proxy. + * @arg_options: Argument to pass with the method invocation. + * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the ReadValue() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_descriptor1_call_read_value() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_descriptor1_call_read_value_sync(BluezGattDescriptor1 * proxy, GVariant * arg_options, GVariant ** out_value, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "ReadValue", g_variant_new("(@a{sv})", arg_options), G_DBUS_CALL_FLAGS_NONE, + -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@ay)", out_value); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_descriptor1_call_write_value: + * @proxy: A #BluezGattDescriptor1Proxy. + * @arg_value: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the WriteValue() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_descriptor1_call_write_value_finish() + * to get the result of the operation. + * + * See bluez_gatt_descriptor1_call_write_value_sync() for the synchronous, blocking version of this method. + */ +void bluez_gatt_descriptor1_call_write_value(BluezGattDescriptor1 * proxy, GVariant * arg_value, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "WriteValue", g_variant_new("(@ay@a{sv})", arg_value, arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); +} + +/** + * bluez_gatt_descriptor1_call_write_value_finish: + * @proxy: A #BluezGattDescriptor1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_descriptor1_call_write_value(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_gatt_descriptor1_call_write_value(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_descriptor1_call_write_value_finish(BluezGattDescriptor1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_descriptor1_call_write_value_sync: + * @proxy: A #BluezGattDescriptor1Proxy. + * @arg_value: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the WriteValue() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_gatt_descriptor1_call_write_value() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_gatt_descriptor1_call_write_value_sync(BluezGattDescriptor1 * proxy, GVariant * arg_value, GVariant * arg_options, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "WriteValue", g_variant_new("(@ay@a{sv})", arg_value, arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_gatt_descriptor1_complete_read_value: + * @object: A #BluezGattDescriptor1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @value: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the ReadValue() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_descriptor1_complete_read_value(BluezGattDescriptor1 * object, GDBusMethodInvocation * invocation, GVariant * value) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("(@ay)", value)); +} + +/** + * bluez_gatt_descriptor1_complete_write_value: + * @object: A #BluezGattDescriptor1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the WriteValue() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_gatt_descriptor1_complete_write_value(BluezGattDescriptor1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezGattDescriptor1Proxy: + * + * The #BluezGattDescriptor1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezGattDescriptor1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezGattDescriptor1Proxy. + */ + +struct _BluezGattDescriptor1ProxyPrivate +{ + GData * qdata; +}; + +static void bluez_gatt_descriptor1_proxy_iface_init(BluezGattDescriptor1Iface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezGattDescriptor1Proxy, bluez_gatt_descriptor1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezGattDescriptor1Proxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_DESCRIPTOR1, bluez_gatt_descriptor1_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezGattDescriptor1Proxy, bluez_gatt_descriptor1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_DESCRIPTOR1, bluez_gatt_descriptor1_proxy_iface_init)) + +#endif +static void bluez_gatt_descriptor1_proxy_finalize(GObject * object) +{ + BluezGattDescriptor1Proxy * proxy = BLUEZ_GATT_DESCRIPTOR1_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_gatt_descriptor1_proxy_parent_class)->finalize(object); +} + +static void bluez_gatt_descriptor1_proxy_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 3); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_gatt_descriptor1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant(value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue(variant, value); + } + if (variant != NULL) + g_variant_unref(variant); +} + +static void bluez_gatt_descriptor1_proxy_set_property_cb(GDBusProxy * proxy, GAsyncResult * res, gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo * info = user_data; + GError * error; + GVariant * _ret; + error = NULL; + _ret = g_dbus_proxy_call_finish(proxy, res, &error); + if (!_ret) + { + g_warning("Error setting property '%s' on interface org.bluez.GattDescriptor1: %s (%s, %d)", info->parent_struct.name, + error->message, g_quark_to_string(error->domain), error->code); + g_error_free(error); + } + else + { + g_variant_unref(_ret); + } +} + +static void bluez_gatt_descriptor1_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 3); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_gatt_descriptor1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant(value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_dbus_proxy_call(G_DBUS_PROXY(object), "org.freedesktop.DBus.Properties.Set", + g_variant_new("(ssv)", "org.bluez.GattDescriptor1", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) bluez_gatt_descriptor1_proxy_set_property_cb, + (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref(variant); +} + +static void bluez_gatt_descriptor1_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, + const gchar * signal_name, GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_gatt_descriptor1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_GATT_DESCRIPTOR1); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_GATT_DESCRIPTOR1); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_gatt_descriptor1_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezGattDescriptor1Proxy * proxy = BLUEZ_GATT_DESCRIPTOR1_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_descriptor1_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_descriptor1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static const gchar * bluez_gatt_descriptor1_proxy_get_uuid(BluezGattDescriptor1 * object) +{ + BluezGattDescriptor1Proxy * proxy = BLUEZ_GATT_DESCRIPTOR1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "UUID"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_gatt_descriptor1_proxy_get_characteristic(BluezGattDescriptor1 * object) +{ + BluezGattDescriptor1Proxy * proxy = BLUEZ_GATT_DESCRIPTOR1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Characteristic"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static GVariant * bluez_gatt_descriptor1_proxy_get_value(BluezGattDescriptor1 * object) +{ + BluezGattDescriptor1Proxy * proxy = BLUEZ_GATT_DESCRIPTOR1_PROXY(object); + GVariant * variant; + GVariant * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Value"); + value = variant; + if (variant != NULL) + g_variant_unref(variant); + return value; +} + +static void bluez_gatt_descriptor1_proxy_init(BluezGattDescriptor1Proxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_gatt_descriptor1_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY, BluezGattDescriptor1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_gatt_descriptor1_interface_info()); +} + +static void bluez_gatt_descriptor1_proxy_class_init(BluezGattDescriptor1ProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_gatt_descriptor1_proxy_finalize; + gobject_class->get_property = bluez_gatt_descriptor1_proxy_get_property; + gobject_class->set_property = bluez_gatt_descriptor1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_gatt_descriptor1_proxy_g_signal; + proxy_class->g_properties_changed = bluez_gatt_descriptor1_proxy_g_properties_changed; + + bluez_gatt_descriptor1_override_properties(gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezGattDescriptor1ProxyPrivate)); +#endif +} + +static void bluez_gatt_descriptor1_proxy_iface_init(BluezGattDescriptor1Iface * iface) +{ + iface->get_uuid = bluez_gatt_descriptor1_proxy_get_uuid; + iface->get_characteristic = bluez_gatt_descriptor1_proxy_get_characteristic; + iface->get_value = bluez_gatt_descriptor1_proxy_get_value; +} + +/** + * bluez_gatt_descriptor1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.bluez.GattDescriptor1. See g_dbus_proxy_new() for more + * details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_descriptor1_proxy_new_finish() to get the + * result of the operation. + * + * See bluez_gatt_descriptor1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_gatt_descriptor1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.bluez.GattDescriptor1", NULL); +} + +/** + * bluez_gatt_descriptor1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_descriptor1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_gatt_descriptor1_proxy_new(). + * + * Returns: (transfer full) (type BluezGattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattDescriptor1 * bluez_gatt_descriptor1_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_GATT_DESCRIPTOR1(ret); + else + return NULL; +} + +/** + * bluez_gatt_descriptor1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.bluez.GattDescriptor1. See g_dbus_proxy_new_sync() for + * more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_gatt_descriptor1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezGattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattDescriptor1 * bluez_gatt_descriptor1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", + connection, "g-object-path", object_path, "g-interface-name", "org.bluez.GattDescriptor1", NULL); + if (ret != NULL) + return BLUEZ_GATT_DESCRIPTOR1(ret); + else + return NULL; +} + +/** + * bluez_gatt_descriptor1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_gatt_descriptor1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_gatt_descriptor1_proxy_new_for_bus_finish() to + * get the result of the operation. + * + * See bluez_gatt_descriptor1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_gatt_descriptor1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", + "org.bluez.GattDescriptor1", NULL); +} + +/** + * bluez_gatt_descriptor1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_gatt_descriptor1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_gatt_descriptor1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezGattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattDescriptor1 * bluez_gatt_descriptor1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_GATT_DESCRIPTOR1(ret); + else + return NULL; +} + +/** + * bluez_gatt_descriptor1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_gatt_descriptor1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_gatt_descriptor1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezGattDescriptor1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezGattDescriptor1 * bluez_gatt_descriptor1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", + bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.GattDescriptor1", NULL); + if (ret != NULL) + return BLUEZ_GATT_DESCRIPTOR1(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezGattDescriptor1Skeleton: + * + * The #BluezGattDescriptor1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezGattDescriptor1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezGattDescriptor1Skeleton. + */ + +struct _BluezGattDescriptor1SkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_gatt_descriptor1_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name, const gchar * method_name, + GVariant * parameters, GDBusMethodInvocation * invocation, + gpointer user_data) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_GATT_DESCRIPTOR1); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_GATT_DESCRIPTOR1); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_gatt_descriptor1_skeleton_handle_get_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_descriptor1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_gatt_descriptor1_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GVariant * variant, + GError ** error, gpointer user_data) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_gatt_descriptor1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_gatt_descriptor1_skeleton_vtable = { _bluez_gatt_descriptor1_skeleton_handle_method_call, + _bluez_gatt_descriptor1_skeleton_handle_get_property, + _bluez_gatt_descriptor1_skeleton_handle_set_property, + { NULL } }; + +static GDBusInterfaceInfo * bluez_gatt_descriptor1_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_gatt_descriptor1_interface_info(); +} + +static GDBusInterfaceVTable * +bluez_gatt_descriptor1_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_gatt_descriptor1_skeleton_vtable; +} + +static GVariant * bluez_gatt_descriptor1_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_gatt_descriptor1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_gatt_descriptor1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_gatt_descriptor1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_gatt_descriptor1_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.bluez.GattDescriptor1", + info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static gboolean _bluez_gatt_descriptor1_emit_changed(gpointer user_data); + +static void bluez_gatt_descriptor1_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy(skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock(&skeleton->priv->lock); + + if (emit_changed) + _bluez_gatt_descriptor1_emit_changed(skeleton); +} + +static void bluez_gatt_descriptor1_skeleton_iface_init(BluezGattDescriptor1Iface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezGattDescriptor1Skeleton, bluez_gatt_descriptor1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezGattDescriptor1Skeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_DESCRIPTOR1, bluez_gatt_descriptor1_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezGattDescriptor1Skeleton, bluez_gatt_descriptor1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_GATT_DESCRIPTOR1, bluez_gatt_descriptor1_skeleton_iface_init)) + +#endif +static void bluez_gatt_descriptor1_skeleton_finalize(GObject * object) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(object); + guint n; + for (n = 0; n < 3; n++) + g_value_unset(&skeleton->priv->properties[n]); + g_free(skeleton->priv->properties); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_gatt_descriptor1_skeleton_parent_class)->finalize(object); +} + +static void bluez_gatt_descriptor1_skeleton_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 3); + g_mutex_lock(&skeleton->priv->lock); + g_value_copy(&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock(&skeleton->priv->lock); +} + +static gboolean _bluez_gatt_descriptor1_emit_changed(gpointer user_data) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(user_data); + GList * l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock(&skeleton->priv->lock); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&invalidated_builder, G_VARIANT_TYPE("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty * cp = l->data; + GVariant * variant; + const GValue * cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal(cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant(cur_value, G_VARIANT_TYPE(cp->info->parent_struct.signature)); + g_variant_builder_add(&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref(variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant * signal_variant; + signal_variant = + g_variant_ref_sink(g_variant_new("(sa{sv}as)", "org.bluez.GattDescriptor1", &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection * connection = ll->data; + + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); + } + else + { + g_variant_builder_clear(&builder); + g_variant_builder_clear(&invalidated_builder); + } + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock(&skeleton->priv->lock); + return FALSE; +} + +static void _bluez_gatt_descriptor1_schedule_emit_changed(BluezGattDescriptor1Skeleton * skeleton, + const _ExtendedGDBusPropertyInfo * info, guint prop_id, + const GValue * orig_value) +{ + ChangedProperty * cp; + GList * l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty * i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0(ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend(skeleton->priv->changed_properties, cp); + g_value_init(&cp->orig_value, G_VALUE_TYPE(orig_value)); + g_value_copy(orig_value, &cp->orig_value); + } +} + +static void bluez_gatt_descriptor1_skeleton_notify(GObject * object, GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(object); + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new(); + g_source_set_priority(skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback(skeleton->priv->changed_properties_idle_source, _bluez_gatt_descriptor1_emit_changed, + g_object_ref(skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name(skeleton->priv->changed_properties_idle_source, "[generated] _bluez_gatt_descriptor1_emit_changed"); + g_source_attach(skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref(skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock(&skeleton->priv->lock); +} + +static void bluez_gatt_descriptor1_skeleton_set_property(GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) +{ + const _ExtendedGDBusPropertyInfo * info; + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 3); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_gatt_descriptor1_property_info_pointers[prop_id - 1]; + g_mutex_lock(&skeleton->priv->lock); + g_object_freeze_notify(object); + if (!_g_value_equal(value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)) != NULL && info->emits_changed_signal) + _bluez_gatt_descriptor1_schedule_emit_changed(skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy(value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec(object, pspec); + } + g_mutex_unlock(&skeleton->priv->lock); + g_object_thaw_notify(object); +} + +static void bluez_gatt_descriptor1_skeleton_init(BluezGattDescriptor1Skeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_gatt_descriptor1_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = + G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_GATT_DESCRIPTOR1_SKELETON, BluezGattDescriptor1SkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); + skeleton->priv->properties = g_new0(GValue, 3); + g_value_init(&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[1], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[2], G_TYPE_VARIANT); +} + +static const gchar * bluez_gatt_descriptor1_skeleton_get_uuid(BluezGattDescriptor1 * object) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[0])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_gatt_descriptor1_skeleton_get_characteristic(BluezGattDescriptor1 * object) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[1])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static GVariant * bluez_gatt_descriptor1_skeleton_get_value(BluezGattDescriptor1 * object) +{ + BluezGattDescriptor1Skeleton * skeleton = BLUEZ_GATT_DESCRIPTOR1_SKELETON(object); + GVariant * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_variant(&(skeleton->priv->properties[2])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static void bluez_gatt_descriptor1_skeleton_class_init(BluezGattDescriptor1SkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_gatt_descriptor1_skeleton_finalize; + gobject_class->get_property = bluez_gatt_descriptor1_skeleton_get_property; + gobject_class->set_property = bluez_gatt_descriptor1_skeleton_set_property; + gobject_class->notify = bluez_gatt_descriptor1_skeleton_notify; + + bluez_gatt_descriptor1_override_properties(gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_gatt_descriptor1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_gatt_descriptor1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_gatt_descriptor1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_gatt_descriptor1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezGattDescriptor1SkeletonPrivate)); +#endif +} + +static void bluez_gatt_descriptor1_skeleton_iface_init(BluezGattDescriptor1Iface * iface) +{ + iface->get_uuid = bluez_gatt_descriptor1_skeleton_get_uuid; + iface->get_characteristic = bluez_gatt_descriptor1_skeleton_get_characteristic; + iface->get_value = bluez_gatt_descriptor1_skeleton_get_value; +} + +/** + * bluez_gatt_descriptor1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.bluez.GattDescriptor1. + * + * Returns: (transfer full) (type BluezGattDescriptor1Skeleton): The skeleton object. + */ +BluezGattDescriptor1 * bluez_gatt_descriptor1_skeleton_new(void) +{ + return BLUEZ_GATT_DESCRIPTOR1(g_object_new(BLUEZ_TYPE_GATT_DESCRIPTOR1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.LEAdvertisement1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezLEAdvertisement1 + * @title: BluezLEAdvertisement1 + * @short_description: Generated C code for the org.bluez.LEAdvertisement1 D-Bus interface + * + * This section contains code for working with the org.bluez.LEAdvertisement1 D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.LEAdvertisement1 ---- */ + +static const _ExtendedGDBusMethodInfo _bluez_leadvertisement1_method_info_release = { { -1, (gchar *) "Release", NULL, NULL, NULL }, + "handle-release", + FALSE }; + +static const GDBusMethodInfo * const _bluez_leadvertisement1_method_info_pointers[] = { + &_bluez_leadvertisement1_method_info_release.parent_struct, NULL +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_type_ = { + { -1, (gchar *) "Type", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "type", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_service_uuids = { + { -1, (gchar *) "ServiceUUIDs", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "service-uuids", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_manufacturer_data = { + { -1, (gchar *) "ManufacturerData", (gchar *) "a{qv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, + "manufacturer-data", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_solicit_uuids = { + { -1, (gchar *) "SolicitUUIDs", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "solicit-uuids", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_service_data = { + { -1, (gchar *) "ServiceData", (gchar *) "a{sv}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "service-data", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_data = { + { -1, (gchar *) "Data", (gchar *) "a{yay}", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "data", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_discoverable = { + { -1, (gchar *) "Discoverable", (gchar *) "b", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "discoverable", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_discoverable_timeout = { + { -1, (gchar *) "DiscoverableTimeout", (gchar *) "q", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, + "discoverable-timeout", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_includes = { + { -1, (gchar *) "Includes", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "includes", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_local_name = { + { -1, (gchar *) "LocalName", (gchar *) "s", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "local-name", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_appearance = { + { -1, (gchar *) "Appearance", (gchar *) "q", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "appearance", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_duration = { + { -1, (gchar *) "Duration", (gchar *) "q", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "duration", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertisement1_property_info_timeout = { + { -1, (gchar *) "Timeout", (gchar *) "q", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "timeout", FALSE, TRUE +}; + +static const GDBusPropertyInfo * const _bluez_leadvertisement1_property_info_pointers[] = { + &_bluez_leadvertisement1_property_info_type_.parent_struct, + &_bluez_leadvertisement1_property_info_service_uuids.parent_struct, + &_bluez_leadvertisement1_property_info_manufacturer_data.parent_struct, + &_bluez_leadvertisement1_property_info_solicit_uuids.parent_struct, + &_bluez_leadvertisement1_property_info_service_data.parent_struct, + &_bluez_leadvertisement1_property_info_data.parent_struct, + &_bluez_leadvertisement1_property_info_discoverable.parent_struct, + &_bluez_leadvertisement1_property_info_discoverable_timeout.parent_struct, + &_bluez_leadvertisement1_property_info_includes.parent_struct, + &_bluez_leadvertisement1_property_info_local_name.parent_struct, + &_bluez_leadvertisement1_property_info_appearance.parent_struct, + &_bluez_leadvertisement1_property_info_duration.parent_struct, + &_bluez_leadvertisement1_property_info_timeout.parent_struct, + NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_leadvertisement1_interface_info = { + { -1, (gchar *) "org.bluez.LEAdvertisement1", (GDBusMethodInfo **) &_bluez_leadvertisement1_method_info_pointers, NULL, + (GDBusPropertyInfo **) &_bluez_leadvertisement1_property_info_pointers, NULL }, + "leadvertisement1", +}; + +/** + * bluez_leadvertisement1_interface_info: + * + * Gets a machine-readable description of the org.bluez.LEAdvertisement1 D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_leadvertisement1_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_leadvertisement1_interface_info.parent_struct; +} + +/** + * bluez_leadvertisement1_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezLEAdvertisement1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_leadvertisement1_override_properties(GObjectClass * klass, guint property_id_begin) +{ + g_object_class_override_property(klass, property_id_begin++, "type"); + g_object_class_override_property(klass, property_id_begin++, "service-uuids"); + g_object_class_override_property(klass, property_id_begin++, "manufacturer-data"); + g_object_class_override_property(klass, property_id_begin++, "solicit-uuids"); + g_object_class_override_property(klass, property_id_begin++, "service-data"); + g_object_class_override_property(klass, property_id_begin++, "data"); + g_object_class_override_property(klass, property_id_begin++, "discoverable"); + g_object_class_override_property(klass, property_id_begin++, "discoverable-timeout"); + g_object_class_override_property(klass, property_id_begin++, "includes"); + g_object_class_override_property(klass, property_id_begin++, "local-name"); + g_object_class_override_property(klass, property_id_begin++, "appearance"); + g_object_class_override_property(klass, property_id_begin++, "duration"); + g_object_class_override_property(klass, property_id_begin++, "timeout"); + return property_id_begin - 1; +} + +/** + * BluezLEAdvertisement1: + * + * Abstract interface type for the D-Bus interface org.bluez.LEAdvertisement1. + */ + +/** + * BluezLEAdvertisement1Iface: + * @parent_iface: The parent interface. + * @handle_release: Handler for the #BluezLEAdvertisement1::handle-release signal. + * @get_appearance: Getter for the #BluezLEAdvertisement1:appearance property. + * @get_data: Getter for the #BluezLEAdvertisement1:data property. + * @get_discoverable: Getter for the #BluezLEAdvertisement1:discoverable property. + * @get_discoverable_timeout: Getter for the #BluezLEAdvertisement1:discoverable-timeout property. + * @get_duration: Getter for the #BluezLEAdvertisement1:duration property. + * @get_includes: Getter for the #BluezLEAdvertisement1:includes property. + * @get_local_name: Getter for the #BluezLEAdvertisement1:local-name property. + * @get_manufacturer_data: Getter for the #BluezLEAdvertisement1:manufacturer-data property. + * @get_service_data: Getter for the #BluezLEAdvertisement1:service-data property. + * @get_service_uuids: Getter for the #BluezLEAdvertisement1:service-uuids property. + * @get_solicit_uuids: Getter for the #BluezLEAdvertisement1:solicit-uuids property. + * @get_timeout: Getter for the #BluezLEAdvertisement1:timeout property. + * @get_type_: Getter for the #BluezLEAdvertisement1:type property. + * + * Virtual table for the D-Bus interface org.bluez.LEAdvertisement1. + */ + +typedef BluezLEAdvertisement1Iface BluezLEAdvertisement1Interface; +G_DEFINE_INTERFACE(BluezLEAdvertisement1, bluez_leadvertisement1, G_TYPE_OBJECT) + +static void bluez_leadvertisement1_default_init(BluezLEAdvertisement1Iface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezLEAdvertisement1::handle-release: + * @object: A #BluezLEAdvertisement1. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the Release() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_leadvertisement1_complete_release() or e.g. g_dbus_method_invocation_return_error() on + * it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD + * error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-release", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezLEAdvertisement1Iface, handle_release), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject properties for D-Bus properties: */ + /** + * BluezLEAdvertisement1:type: + * + * Represents the D-Bus property "Type". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("type", "Type", "Type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:service-uuids: + * + * Represents the D-Bus property "ServiceUUIDs". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_boxed("service-uuids", "ServiceUUIDs", "ServiceUUIDs", G_TYPE_STRV, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:manufacturer-data: + * + * Represents the D-Bus property "ManufacturerData". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_variant("manufacturer-data", "ManufacturerData", "ManufacturerData", + G_VARIANT_TYPE("a{qv}"), NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:solicit-uuids: + * + * Represents the D-Bus property "SolicitUUIDs". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_boxed("solicit-uuids", "SolicitUUIDs", "SolicitUUIDs", G_TYPE_STRV, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:service-data: + * + * Represents the D-Bus property "ServiceData". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_variant("service-data", "ServiceData", "ServiceData", G_VARIANT_TYPE("a{sv}"), + NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:data: + * + * Represents the D-Bus property "Data". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_variant("data", "Data", "Data", G_VARIANT_TYPE("a{yay}"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:discoverable: + * + * Represents the D-Bus property "Discoverable". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_boolean("discoverable", "Discoverable", "Discoverable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:discoverable-timeout: + * + * Represents the D-Bus property "DiscoverableTimeout". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_uint("discoverable-timeout", "DiscoverableTimeout", "DiscoverableTimeout", 0, + G_MAXUINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:includes: + * + * Represents the D-Bus property "Includes". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_boxed("includes", "Includes", "Includes", G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:local-name: + * + * Represents the D-Bus property "LocalName". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_string("local-name", "LocalName", "LocalName", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:appearance: + * + * Represents the D-Bus property "Appearance". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_uint("appearance", "Appearance", "Appearance", 0, G_MAXUINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:duration: + * + * Represents the D-Bus property "Duration". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, + g_param_spec_uint("duration", "Duration", "Duration", 0, G_MAXUINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisement1:timeout: + * + * Represents the D-Bus property "Timeout". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property( + iface, g_param_spec_uint("timeout", "Timeout", "Timeout", 0, G_MAXUINT16, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * bluez_leadvertisement1_get_type_: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "Type" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertisement1_dup_type_() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_leadvertisement1_get_type_(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_type_(object); +} + +/** + * bluez_leadvertisement1_dup_type_: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets a copy of the "Type" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_leadvertisement1_dup_type_(BluezLEAdvertisement1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "type", &value, NULL); + return value; +} + +/** + * bluez_leadvertisement1_set_type_: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "Type" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_type_(BluezLEAdvertisement1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "type", value, NULL); +} + +/** + * bluez_leadvertisement1_get_service_uuids: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "ServiceUUIDs" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertisement1_dup_service_uuids() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * const * bluez_leadvertisement1_get_service_uuids(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_service_uuids(object); +} + +/** + * bluez_leadvertisement1_dup_service_uuids: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets a copy of the "ServiceUUIDs" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_strfreev(). + */ +gchar ** bluez_leadvertisement1_dup_service_uuids(BluezLEAdvertisement1 * object) +{ + gchar ** value; + g_object_get(G_OBJECT(object), "service-uuids", &value, NULL); + return value; +} + +/** + * bluez_leadvertisement1_set_service_uuids: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "ServiceUUIDs" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_service_uuids(BluezLEAdvertisement1 * object, const gchar * const * value) +{ + g_object_set(G_OBJECT(object), "service-uuids", value, NULL); +} + +/** + * bluez_leadvertisement1_get_manufacturer_data: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "ManufacturerData" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertisement1_dup_manufacturer_data() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +GVariant * bluez_leadvertisement1_get_manufacturer_data(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_manufacturer_data(object); +} + +/** + * bluez_leadvertisement1_dup_manufacturer_data: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets a copy of the "ManufacturerData" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_variant_unref(). + */ +GVariant * bluez_leadvertisement1_dup_manufacturer_data(BluezLEAdvertisement1 * object) +{ + GVariant * value; + g_object_get(G_OBJECT(object), "manufacturer-data", &value, NULL); + return value; +} + +/** + * bluez_leadvertisement1_set_manufacturer_data: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "ManufacturerData" D-Bus property to + * @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_manufacturer_data(BluezLEAdvertisement1 * object, GVariant * value) +{ + g_object_set(G_OBJECT(object), "manufacturer-data", value, NULL); +} + +/** + * bluez_leadvertisement1_get_solicit_uuids: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "SolicitUUIDs" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertisement1_dup_solicit_uuids() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * const * bluez_leadvertisement1_get_solicit_uuids(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_solicit_uuids(object); +} + +/** + * bluez_leadvertisement1_dup_solicit_uuids: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets a copy of the "SolicitUUIDs" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_strfreev(). + */ +gchar ** bluez_leadvertisement1_dup_solicit_uuids(BluezLEAdvertisement1 * object) +{ + gchar ** value; + g_object_get(G_OBJECT(object), "solicit-uuids", &value, NULL); + return value; +} + +/** + * bluez_leadvertisement1_set_solicit_uuids: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "SolicitUUIDs" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_solicit_uuids(BluezLEAdvertisement1 * object, const gchar * const * value) +{ + g_object_set(G_OBJECT(object), "solicit-uuids", value, NULL); +} + +/** + * bluez_leadvertisement1_get_service_data: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "ServiceData" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertisement1_dup_service_data() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +GVariant * bluez_leadvertisement1_get_service_data(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_service_data(object); +} + +/** + * bluez_leadvertisement1_dup_service_data: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets a copy of the "ServiceData" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_variant_unref(). + */ +GVariant * bluez_leadvertisement1_dup_service_data(BluezLEAdvertisement1 * object) +{ + GVariant * value; + g_object_get(G_OBJECT(object), "service-data", &value, NULL); + return value; +} + +/** + * bluez_leadvertisement1_set_service_data: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "ServiceData" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_service_data(BluezLEAdvertisement1 * object, GVariant * value) +{ + g_object_set(G_OBJECT(object), "service-data", value, NULL); +} + +/** + * bluez_leadvertisement1_get_data: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "Data" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertisement1_dup_data() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +GVariant * bluez_leadvertisement1_get_data(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_data(object); +} + +/** + * bluez_leadvertisement1_dup_data: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets a copy of the "Data" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_variant_unref(). + */ +GVariant * bluez_leadvertisement1_dup_data(BluezLEAdvertisement1 * object) +{ + GVariant * value; + g_object_get(G_OBJECT(object), "data", &value, NULL); + return value; +} + +/** + * bluez_leadvertisement1_set_data: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "Data" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_data(BluezLEAdvertisement1 * object, GVariant * value) +{ + g_object_set(G_OBJECT(object), "data", value, NULL); +} + +/** + * bluez_leadvertisement1_get_discoverable: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "Discoverable" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +gboolean bluez_leadvertisement1_get_discoverable(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_discoverable(object); +} + +/** + * bluez_leadvertisement1_set_discoverable: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "Discoverable" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_discoverable(BluezLEAdvertisement1 * object, gboolean value) +{ + g_object_set(G_OBJECT(object), "discoverable", value, NULL); +} + +/** + * bluez_leadvertisement1_get_discoverable_timeout: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "DiscoverableTimeout" + * D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint16 bluez_leadvertisement1_get_discoverable_timeout(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_discoverable_timeout(object); +} + +/** + * bluez_leadvertisement1_set_discoverable_timeout: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "DiscoverableTimeout" D-Bus + * property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_discoverable_timeout(BluezLEAdvertisement1 * object, guint16 value) +{ + g_object_set(G_OBJECT(object), "discoverable-timeout", value, NULL); +} + +/** + * bluez_leadvertisement1_get_includes: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "Includes" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertisement1_dup_includes() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * const * bluez_leadvertisement1_get_includes(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_includes(object); +} + +/** + * bluez_leadvertisement1_dup_includes: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets a copy of the "Includes" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_strfreev(). + */ +gchar ** bluez_leadvertisement1_dup_includes(BluezLEAdvertisement1 * object) +{ + gchar ** value; + g_object_get(G_OBJECT(object), "includes", &value, NULL); + return value; +} + +/** + * bluez_leadvertisement1_set_includes: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "Includes" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_includes(BluezLEAdvertisement1 * object, const gchar * const * value) +{ + g_object_set(G_OBJECT(object), "includes", value, NULL); +} + +/** + * bluez_leadvertisement1_get_local_name: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "LocalName" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertisement1_dup_local_name() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * bluez_leadvertisement1_get_local_name(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_local_name(object); +} + +/** + * bluez_leadvertisement1_dup_local_name: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets a copy of the "LocalName" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_free(). + */ +gchar * bluez_leadvertisement1_dup_local_name(BluezLEAdvertisement1 * object) +{ + gchar * value; + g_object_get(G_OBJECT(object), "local-name", &value, NULL); + return value; +} + +/** + * bluez_leadvertisement1_set_local_name: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "LocalName" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_local_name(BluezLEAdvertisement1 * object, const gchar * value) +{ + g_object_set(G_OBJECT(object), "local-name", value, NULL); +} + +/** + * bluez_leadvertisement1_get_appearance: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "Appearance" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint16 bluez_leadvertisement1_get_appearance(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_appearance(object); +} + +/** + * bluez_leadvertisement1_set_appearance: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "Appearance" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_appearance(BluezLEAdvertisement1 * object, guint16 value) +{ + g_object_set(G_OBJECT(object), "appearance", value, NULL); +} + +/** + * bluez_leadvertisement1_get_duration: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "Duration" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint16 bluez_leadvertisement1_get_duration(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_duration(object); +} + +/** + * bluez_leadvertisement1_set_duration: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "Duration" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_duration(BluezLEAdvertisement1 * object, guint16 value) +{ + g_object_set(G_OBJECT(object), "duration", value, NULL); +} + +/** + * bluez_leadvertisement1_get_timeout: (skip) + * @object: A #BluezLEAdvertisement1. + * + * Gets the value of the "Timeout" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guint16 bluez_leadvertisement1_get_timeout(BluezLEAdvertisement1 * object) +{ + return BLUEZ_LEADVERTISEMENT1_GET_IFACE(object)->get_timeout(object); +} + +/** + * bluez_leadvertisement1_set_timeout: (skip) + * @object: A #BluezLEAdvertisement1. + * @value: The value to set. + * + * Sets the "Timeout" D-Bus property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertisement1_set_timeout(BluezLEAdvertisement1 * object, guint16 value) +{ + g_object_set(G_OBJECT(object), "timeout", value, NULL); +} + +/** + * bluez_leadvertisement1_call_release: + * @proxy: A #BluezLEAdvertisement1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the Release() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call bluez_leadvertisement1_call_release_finish() to + * get the result of the operation. + * + * See bluez_leadvertisement1_call_release_sync() for the synchronous, blocking version of this method. + */ +void bluez_leadvertisement1_call_release(BluezLEAdvertisement1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "Release", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, + user_data); +} + +/** + * bluez_leadvertisement1_call_release_finish: + * @proxy: A #BluezLEAdvertisement1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_leadvertisement1_call_release(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_leadvertisement1_call_release(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_leadvertisement1_call_release_finish(BluezLEAdvertisement1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_leadvertisement1_call_release_sync: + * @proxy: A #BluezLEAdvertisement1Proxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Release() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_leadvertisement1_call_release() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_leadvertisement1_call_release_sync(BluezLEAdvertisement1 * proxy, GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = + g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "Release", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_leadvertisement1_complete_release: + * @object: A #BluezLEAdvertisement1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Release() D-Bus method. If you instead want to finish handling + * an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_leadvertisement1_complete_release(BluezLEAdvertisement1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezLEAdvertisement1Proxy: + * + * The #BluezLEAdvertisement1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezLEAdvertisement1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezLEAdvertisement1Proxy. + */ + +struct _BluezLEAdvertisement1ProxyPrivate +{ + GData * qdata; +}; + +static void bluez_leadvertisement1_proxy_iface_init(BluezLEAdvertisement1Iface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezLEAdvertisement1Proxy, bluez_leadvertisement1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezLEAdvertisement1Proxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_LEADVERTISEMENT1, bluez_leadvertisement1_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezLEAdvertisement1Proxy, bluez_leadvertisement1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_LEADVERTISEMENT1, bluez_leadvertisement1_proxy_iface_init)) + +#endif +static void bluez_leadvertisement1_proxy_finalize(GObject * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_leadvertisement1_proxy_parent_class)->finalize(object); +} + +static void bluez_leadvertisement1_proxy_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 13); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_leadvertisement1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant(value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue(variant, value); + } + if (variant != NULL) + g_variant_unref(variant); +} + +static void bluez_leadvertisement1_proxy_set_property_cb(GDBusProxy * proxy, GAsyncResult * res, gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo * info = user_data; + GError * error; + GVariant * _ret; + error = NULL; + _ret = g_dbus_proxy_call_finish(proxy, res, &error); + if (!_ret) + { + g_warning("Error setting property '%s' on interface org.bluez.LEAdvertisement1: %s (%s, %d)", info->parent_struct.name, + error->message, g_quark_to_string(error->domain), error->code); + g_error_free(error); + } + else + { + g_variant_unref(_ret); + } +} + +static void bluez_leadvertisement1_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 13); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_leadvertisement1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant(value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_dbus_proxy_call(G_DBUS_PROXY(object), "org.freedesktop.DBus.Properties.Set", + g_variant_new("(ssv)", "org.bluez.LEAdvertisement1", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) bluez_leadvertisement1_proxy_set_property_cb, + (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref(variant); +} + +static void bluez_leadvertisement1_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, + const gchar * signal_name, GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_leadvertisement1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_LEADVERTISEMENT1); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_LEADVERTISEMENT1); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_leadvertisement1_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_leadvertisement1_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_leadvertisement1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static const gchar * bluez_leadvertisement1_proxy_get_type_(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Type"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static const gchar * const * bluez_leadvertisement1_proxy_get_service_uuids(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + const gchar * const * value = NULL; + value = g_datalist_get_data(&proxy->priv->qdata, "ServiceUUIDs"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "ServiceUUIDs"); + if (variant != NULL) + { + value = g_variant_get_strv(variant, NULL); + g_datalist_set_data_full(&proxy->priv->qdata, "ServiceUUIDs", (gpointer) value, g_free); + g_variant_unref(variant); + } + return value; +} + +static GVariant * bluez_leadvertisement1_proxy_get_manufacturer_data(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + GVariant * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "ManufacturerData"); + value = variant; + if (variant != NULL) + g_variant_unref(variant); + return value; +} + +static const gchar * const * bluez_leadvertisement1_proxy_get_solicit_uuids(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + const gchar * const * value = NULL; + value = g_datalist_get_data(&proxy->priv->qdata, "SolicitUUIDs"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "SolicitUUIDs"); + if (variant != NULL) + { + value = g_variant_get_strv(variant, NULL); + g_datalist_set_data_full(&proxy->priv->qdata, "SolicitUUIDs", (gpointer) value, g_free); + g_variant_unref(variant); + } + return value; +} + +static GVariant * bluez_leadvertisement1_proxy_get_service_data(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + GVariant * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "ServiceData"); + value = variant; + if (variant != NULL) + g_variant_unref(variant); + return value; +} + +static GVariant * bluez_leadvertisement1_proxy_get_data(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + GVariant * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Data"); + value = variant; + if (variant != NULL) + g_variant_unref(variant); + return value; +} + +static gboolean bluez_leadvertisement1_proxy_get_discoverable(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + gboolean value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Discoverable"); + if (variant != NULL) + { + value = g_variant_get_boolean(variant); + g_variant_unref(variant); + } + return value; +} + +static guint16 bluez_leadvertisement1_proxy_get_discoverable_timeout(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + guint16 value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "DiscoverableTimeout"); + if (variant != NULL) + { + value = g_variant_get_uint16(variant); + g_variant_unref(variant); + } + return value; +} + +static const gchar * const * bluez_leadvertisement1_proxy_get_includes(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + const gchar * const * value = NULL; + value = g_datalist_get_data(&proxy->priv->qdata, "Includes"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Includes"); + if (variant != NULL) + { + value = g_variant_get_strv(variant, NULL); + g_datalist_set_data_full(&proxy->priv->qdata, "Includes", (gpointer) value, g_free); + g_variant_unref(variant); + } + return value; +} + +static const gchar * bluez_leadvertisement1_proxy_get_local_name(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + const gchar * value = NULL; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "LocalName"); + if (variant != NULL) + { + value = g_variant_get_string(variant, NULL); + g_variant_unref(variant); + } + return value; +} + +static guint16 bluez_leadvertisement1_proxy_get_appearance(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + guint16 value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Appearance"); + if (variant != NULL) + { + value = g_variant_get_uint16(variant); + g_variant_unref(variant); + } + return value; +} + +static guint16 bluez_leadvertisement1_proxy_get_duration(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + guint16 value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Duration"); + if (variant != NULL) + { + value = g_variant_get_uint16(variant); + g_variant_unref(variant); + } + return value; +} + +static guint16 bluez_leadvertisement1_proxy_get_timeout(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Proxy * proxy = BLUEZ_LEADVERTISEMENT1_PROXY(object); + GVariant * variant; + guint16 value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "Timeout"); + if (variant != NULL) + { + value = g_variant_get_uint16(variant); + g_variant_unref(variant); + } + return value; +} + +static void bluez_leadvertisement1_proxy_init(BluezLEAdvertisement1Proxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_leadvertisement1_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_LEADVERTISEMENT1_PROXY, BluezLEAdvertisement1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_leadvertisement1_interface_info()); +} + +static void bluez_leadvertisement1_proxy_class_init(BluezLEAdvertisement1ProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_leadvertisement1_proxy_finalize; + gobject_class->get_property = bluez_leadvertisement1_proxy_get_property; + gobject_class->set_property = bluez_leadvertisement1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_leadvertisement1_proxy_g_signal; + proxy_class->g_properties_changed = bluez_leadvertisement1_proxy_g_properties_changed; + + bluez_leadvertisement1_override_properties(gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezLEAdvertisement1ProxyPrivate)); +#endif +} + +static void bluez_leadvertisement1_proxy_iface_init(BluezLEAdvertisement1Iface * iface) +{ + iface->get_type_ = bluez_leadvertisement1_proxy_get_type_; + iface->get_service_uuids = bluez_leadvertisement1_proxy_get_service_uuids; + iface->get_manufacturer_data = bluez_leadvertisement1_proxy_get_manufacturer_data; + iface->get_solicit_uuids = bluez_leadvertisement1_proxy_get_solicit_uuids; + iface->get_service_data = bluez_leadvertisement1_proxy_get_service_data; + iface->get_data = bluez_leadvertisement1_proxy_get_data; + iface->get_discoverable = bluez_leadvertisement1_proxy_get_discoverable; + iface->get_discoverable_timeout = bluez_leadvertisement1_proxy_get_discoverable_timeout; + iface->get_includes = bluez_leadvertisement1_proxy_get_includes; + iface->get_local_name = bluez_leadvertisement1_proxy_get_local_name; + iface->get_appearance = bluez_leadvertisement1_proxy_get_appearance; + iface->get_duration = bluez_leadvertisement1_proxy_get_duration; + iface->get_timeout = bluez_leadvertisement1_proxy_get_timeout; +} + +/** + * bluez_leadvertisement1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.bluez.LEAdvertisement1. See g_dbus_proxy_new() for + * more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_leadvertisement1_proxy_new_finish() to get the + * result of the operation. + * + * See bluez_leadvertisement1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_leadvertisement1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_LEADVERTISEMENT1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.bluez.LEAdvertisement1", NULL); +} + +/** + * bluez_leadvertisement1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_leadvertisement1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_leadvertisement1_proxy_new(). + * + * Returns: (transfer full) (type BluezLEAdvertisement1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezLEAdvertisement1 * bluez_leadvertisement1_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_LEADVERTISEMENT1(ret); + else + return NULL; +} + +/** + * bluez_leadvertisement1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.bluez.LEAdvertisement1. See g_dbus_proxy_new_sync() + * for more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_leadvertisement1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezLEAdvertisement1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezLEAdvertisement1 * bluez_leadvertisement1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_LEADVERTISEMENT1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", + connection, "g-object-path", object_path, "g-interface-name", "org.bluez.LEAdvertisement1", NULL); + if (ret != NULL) + return BLUEZ_LEADVERTISEMENT1(ret); + else + return NULL; +} + +/** + * bluez_leadvertisement1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_leadvertisement1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_leadvertisement1_proxy_new_for_bus_finish() to + * get the result of the operation. + * + * See bluez_leadvertisement1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_leadvertisement1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_LEADVERTISEMENT1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", + "org.bluez.LEAdvertisement1", NULL); +} + +/** + * bluez_leadvertisement1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_leadvertisement1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_leadvertisement1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezLEAdvertisement1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezLEAdvertisement1 * bluez_leadvertisement1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_LEADVERTISEMENT1(ret); + else + return NULL; +} + +/** + * bluez_leadvertisement1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_leadvertisement1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_leadvertisement1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezLEAdvertisement1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezLEAdvertisement1 * bluez_leadvertisement1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_LEADVERTISEMENT1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", + bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.LEAdvertisement1", NULL); + if (ret != NULL) + return BLUEZ_LEADVERTISEMENT1(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezLEAdvertisement1Skeleton: + * + * The #BluezLEAdvertisement1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezLEAdvertisement1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezLEAdvertisement1Skeleton. + */ + +struct _BluezLEAdvertisement1SkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_leadvertisement1_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name, const gchar * method_name, + GVariant * parameters, GDBusMethodInvocation * invocation, + gpointer user_data) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_LEADVERTISEMENT1); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_LEADVERTISEMENT1); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_leadvertisement1_skeleton_handle_get_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_leadvertisement1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_leadvertisement1_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GVariant * variant, + GError ** error, gpointer user_data) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_leadvertisement1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_leadvertisement1_skeleton_vtable = { _bluez_leadvertisement1_skeleton_handle_method_call, + _bluez_leadvertisement1_skeleton_handle_get_property, + _bluez_leadvertisement1_skeleton_handle_set_property, + { NULL } }; + +static GDBusInterfaceInfo * bluez_leadvertisement1_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_leadvertisement1_interface_info(); +} + +static GDBusInterfaceVTable * +bluez_leadvertisement1_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_leadvertisement1_skeleton_vtable; +} + +static GVariant * bluez_leadvertisement1_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_leadvertisement1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_leadvertisement1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_leadvertisement1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_leadvertisement1_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.bluez.LEAdvertisement1", + info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static gboolean _bluez_leadvertisement1_emit_changed(gpointer user_data); + +static void bluez_leadvertisement1_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy(skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock(&skeleton->priv->lock); + + if (emit_changed) + _bluez_leadvertisement1_emit_changed(skeleton); +} + +static void bluez_leadvertisement1_skeleton_iface_init(BluezLEAdvertisement1Iface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezLEAdvertisement1Skeleton, bluez_leadvertisement1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezLEAdvertisement1Skeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_LEADVERTISEMENT1, bluez_leadvertisement1_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezLEAdvertisement1Skeleton, bluez_leadvertisement1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_LEADVERTISEMENT1, bluez_leadvertisement1_skeleton_iface_init)) + +#endif +static void bluez_leadvertisement1_skeleton_finalize(GObject * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + guint n; + for (n = 0; n < 13; n++) + g_value_unset(&skeleton->priv->properties[n]); + g_free(skeleton->priv->properties); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_leadvertisement1_skeleton_parent_class)->finalize(object); +} + +static void bluez_leadvertisement1_skeleton_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 13); + g_mutex_lock(&skeleton->priv->lock); + g_value_copy(&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock(&skeleton->priv->lock); +} + +static gboolean _bluez_leadvertisement1_emit_changed(gpointer user_data) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(user_data); + GList * l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock(&skeleton->priv->lock); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&invalidated_builder, G_VARIANT_TYPE("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty * cp = l->data; + GVariant * variant; + const GValue * cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal(cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant(cur_value, G_VARIANT_TYPE(cp->info->parent_struct.signature)); + g_variant_builder_add(&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref(variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant * signal_variant; + signal_variant = + g_variant_ref_sink(g_variant_new("(sa{sv}as)", "org.bluez.LEAdvertisement1", &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection * connection = ll->data; + + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); + } + else + { + g_variant_builder_clear(&builder); + g_variant_builder_clear(&invalidated_builder); + } + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock(&skeleton->priv->lock); + return FALSE; +} + +static void _bluez_leadvertisement1_schedule_emit_changed(BluezLEAdvertisement1Skeleton * skeleton, + const _ExtendedGDBusPropertyInfo * info, guint prop_id, + const GValue * orig_value) +{ + ChangedProperty * cp; + GList * l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty * i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0(ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend(skeleton->priv->changed_properties, cp); + g_value_init(&cp->orig_value, G_VALUE_TYPE(orig_value)); + g_value_copy(orig_value, &cp->orig_value); + } +} + +static void bluez_leadvertisement1_skeleton_notify(GObject * object, GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new(); + g_source_set_priority(skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback(skeleton->priv->changed_properties_idle_source, _bluez_leadvertisement1_emit_changed, + g_object_ref(skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name(skeleton->priv->changed_properties_idle_source, "[generated] _bluez_leadvertisement1_emit_changed"); + g_source_attach(skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref(skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock(&skeleton->priv->lock); +} + +static void bluez_leadvertisement1_skeleton_set_property(GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) +{ + const _ExtendedGDBusPropertyInfo * info; + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 13); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_leadvertisement1_property_info_pointers[prop_id - 1]; + g_mutex_lock(&skeleton->priv->lock); + g_object_freeze_notify(object); + if (!_g_value_equal(value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)) != NULL && info->emits_changed_signal) + _bluez_leadvertisement1_schedule_emit_changed(skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy(value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec(object, pspec); + } + g_mutex_unlock(&skeleton->priv->lock); + g_object_thaw_notify(object); +} + +static void bluez_leadvertisement1_skeleton_init(BluezLEAdvertisement1Skeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_leadvertisement1_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = + G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_LEADVERTISEMENT1_SKELETON, BluezLEAdvertisement1SkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); + skeleton->priv->properties = g_new0(GValue, 13); + g_value_init(&skeleton->priv->properties[0], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[1], G_TYPE_STRV); + g_value_init(&skeleton->priv->properties[2], G_TYPE_VARIANT); + g_value_init(&skeleton->priv->properties[3], G_TYPE_STRV); + g_value_init(&skeleton->priv->properties[4], G_TYPE_VARIANT); + g_value_init(&skeleton->priv->properties[5], G_TYPE_VARIANT); + g_value_init(&skeleton->priv->properties[6], G_TYPE_BOOLEAN); + g_value_init(&skeleton->priv->properties[7], G_TYPE_UINT); + g_value_init(&skeleton->priv->properties[8], G_TYPE_STRV); + g_value_init(&skeleton->priv->properties[9], G_TYPE_STRING); + g_value_init(&skeleton->priv->properties[10], G_TYPE_UINT); + g_value_init(&skeleton->priv->properties[11], G_TYPE_UINT); + g_value_init(&skeleton->priv->properties[12], G_TYPE_UINT); +} + +static const gchar * bluez_leadvertisement1_skeleton_get_type_(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[0])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * const * bluez_leadvertisement1_skeleton_get_service_uuids(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + const gchar * const * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boxed(&(skeleton->priv->properties[1])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static GVariant * bluez_leadvertisement1_skeleton_get_manufacturer_data(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + GVariant * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_variant(&(skeleton->priv->properties[2])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * const * bluez_leadvertisement1_skeleton_get_solicit_uuids(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + const gchar * const * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boxed(&(skeleton->priv->properties[3])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static GVariant * bluez_leadvertisement1_skeleton_get_service_data(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + GVariant * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_variant(&(skeleton->priv->properties[4])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static GVariant * bluez_leadvertisement1_skeleton_get_data(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + GVariant * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_variant(&(skeleton->priv->properties[5])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static gboolean bluez_leadvertisement1_skeleton_get_discoverable(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + gboolean value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boolean(&(skeleton->priv->properties[6])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guint16 bluez_leadvertisement1_skeleton_get_discoverable_timeout(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + guint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uint(&(skeleton->priv->properties[7])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * const * bluez_leadvertisement1_skeleton_get_includes(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + const gchar * const * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boxed(&(skeleton->priv->properties[8])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * bluez_leadvertisement1_skeleton_get_local_name(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + const gchar * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_string(&(skeleton->priv->properties[9])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guint16 bluez_leadvertisement1_skeleton_get_appearance(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + guint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uint(&(skeleton->priv->properties[10])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guint16 bluez_leadvertisement1_skeleton_get_duration(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + guint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uint(&(skeleton->priv->properties[11])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guint16 bluez_leadvertisement1_skeleton_get_timeout(BluezLEAdvertisement1 * object) +{ + BluezLEAdvertisement1Skeleton * skeleton = BLUEZ_LEADVERTISEMENT1_SKELETON(object); + guint value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uint(&(skeleton->priv->properties[12])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static void bluez_leadvertisement1_skeleton_class_init(BluezLEAdvertisement1SkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_leadvertisement1_skeleton_finalize; + gobject_class->get_property = bluez_leadvertisement1_skeleton_get_property; + gobject_class->set_property = bluez_leadvertisement1_skeleton_set_property; + gobject_class->notify = bluez_leadvertisement1_skeleton_notify; + + bluez_leadvertisement1_override_properties(gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_leadvertisement1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_leadvertisement1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_leadvertisement1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_leadvertisement1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezLEAdvertisement1SkeletonPrivate)); +#endif +} + +static void bluez_leadvertisement1_skeleton_iface_init(BluezLEAdvertisement1Iface * iface) +{ + iface->get_type_ = bluez_leadvertisement1_skeleton_get_type_; + iface->get_service_uuids = bluez_leadvertisement1_skeleton_get_service_uuids; + iface->get_manufacturer_data = bluez_leadvertisement1_skeleton_get_manufacturer_data; + iface->get_solicit_uuids = bluez_leadvertisement1_skeleton_get_solicit_uuids; + iface->get_service_data = bluez_leadvertisement1_skeleton_get_service_data; + iface->get_data = bluez_leadvertisement1_skeleton_get_data; + iface->get_discoverable = bluez_leadvertisement1_skeleton_get_discoverable; + iface->get_discoverable_timeout = bluez_leadvertisement1_skeleton_get_discoverable_timeout; + iface->get_includes = bluez_leadvertisement1_skeleton_get_includes; + iface->get_local_name = bluez_leadvertisement1_skeleton_get_local_name; + iface->get_appearance = bluez_leadvertisement1_skeleton_get_appearance; + iface->get_duration = bluez_leadvertisement1_skeleton_get_duration; + iface->get_timeout = bluez_leadvertisement1_skeleton_get_timeout; +} + +/** + * bluez_leadvertisement1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.bluez.LEAdvertisement1. + * + * Returns: (transfer full) (type BluezLEAdvertisement1Skeleton): The skeleton object. + */ +BluezLEAdvertisement1 * bluez_leadvertisement1_skeleton_new(void) +{ + return BLUEZ_LEADVERTISEMENT1(g_object_new(BLUEZ_TYPE_LEADVERTISEMENT1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.LEAdvertisingManager1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezLEAdvertisingManager1 + * @title: BluezLEAdvertisingManager1 + * @short_description: Generated C code for the org.bluez.LEAdvertisingManager1 D-Bus interface + * + * This section contains code for working with the org.bluez.LEAdvertisingManager1 D-Bus interface in + * C. + */ + +/* ---- Introspection data for org.bluez.LEAdvertisingManager1 ---- */ + +static const _ExtendedGDBusArgInfo _bluez_leadvertising_manager1_method_info_register_advertisement_IN_ARG_advertisement = { + { -1, (gchar *) "advertisement", (gchar *) "o", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_leadvertising_manager1_method_info_register_advertisement_IN_ARG_options = { + { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_leadvertising_manager1_method_info_register_advertisement_IN_ARG_pointers[] = { + &_bluez_leadvertising_manager1_method_info_register_advertisement_IN_ARG_advertisement.parent_struct, + &_bluez_leadvertising_manager1_method_info_register_advertisement_IN_ARG_options.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_leadvertising_manager1_method_info_register_advertisement = { + { -1, (gchar *) "RegisterAdvertisement", + (GDBusArgInfo **) &_bluez_leadvertising_manager1_method_info_register_advertisement_IN_ARG_pointers, NULL, NULL }, + "handle-register-advertisement", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_leadvertising_manager1_method_info_unregister_advertisement_IN_ARG_service = { + { -1, (gchar *) "service", (gchar *) "o", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_leadvertising_manager1_method_info_unregister_advertisement_IN_ARG_pointers[] = { + &_bluez_leadvertising_manager1_method_info_unregister_advertisement_IN_ARG_service.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_leadvertising_manager1_method_info_unregister_advertisement = { + { -1, (gchar *) "UnregisterAdvertisement", + (GDBusArgInfo **) &_bluez_leadvertising_manager1_method_info_unregister_advertisement_IN_ARG_pointers, NULL, NULL }, + "handle-unregister-advertisement", + FALSE +}; + +static const GDBusMethodInfo * const _bluez_leadvertising_manager1_method_info_pointers[] = { + &_bluez_leadvertising_manager1_method_info_register_advertisement.parent_struct, + &_bluez_leadvertising_manager1_method_info_unregister_advertisement.parent_struct, NULL +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertising_manager1_property_info_active_instances = { + { -1, (gchar *) "ActiveInstances", (gchar *) "y", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, "active-instances", FALSE, TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertising_manager1_property_info_supported_instances = { + { -1, (gchar *) "SupportedInstances", (gchar *) "y", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, + "supported-instances", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertising_manager1_property_info_supported_includes = { + { -1, (gchar *) "SupportedIncludes", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, + "supported-includes", + FALSE, + TRUE +}; + +static const _ExtendedGDBusPropertyInfo _bluez_leadvertising_manager1_property_info_supported_secondary_channels = { + { -1, (gchar *) "SupportedSecondaryChannels", (gchar *) "as", G_DBUS_PROPERTY_INFO_FLAGS_READABLE, NULL }, + "supported-secondary-channels", + FALSE, + TRUE +}; + +static const GDBusPropertyInfo * const _bluez_leadvertising_manager1_property_info_pointers[] = { + &_bluez_leadvertising_manager1_property_info_active_instances.parent_struct, + &_bluez_leadvertising_manager1_property_info_supported_instances.parent_struct, + &_bluez_leadvertising_manager1_property_info_supported_includes.parent_struct, + &_bluez_leadvertising_manager1_property_info_supported_secondary_channels.parent_struct, NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_leadvertising_manager1_interface_info = { + { -1, (gchar *) "org.bluez.LEAdvertisingManager1", (GDBusMethodInfo **) &_bluez_leadvertising_manager1_method_info_pointers, + NULL, (GDBusPropertyInfo **) &_bluez_leadvertising_manager1_property_info_pointers, NULL }, + "leadvertising-manager1", +}; + +/** + * bluez_leadvertising_manager1_interface_info: + * + * Gets a machine-readable description of the org.bluez.LEAdvertisingManager1 D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_leadvertising_manager1_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_leadvertising_manager1_interface_info.parent_struct; +} + +/** + * bluez_leadvertising_manager1_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezLEAdvertisingManager1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_leadvertising_manager1_override_properties(GObjectClass * klass, guint property_id_begin) +{ + g_object_class_override_property(klass, property_id_begin++, "active-instances"); + g_object_class_override_property(klass, property_id_begin++, "supported-instances"); + g_object_class_override_property(klass, property_id_begin++, "supported-includes"); + g_object_class_override_property(klass, property_id_begin++, "supported-secondary-channels"); + return property_id_begin - 1; +} + +/** + * BluezLEAdvertisingManager1: + * + * Abstract interface type for the D-Bus interface org.bluez.LEAdvertisingManager1. + */ + +/** + * BluezLEAdvertisingManager1Iface: + * @parent_iface: The parent interface. + * @handle_register_advertisement: Handler for the #BluezLEAdvertisingManager1::handle-register-advertisement signal. + * @handle_unregister_advertisement: Handler for the #BluezLEAdvertisingManager1::handle-unregister-advertisement signal. + * @get_active_instances: Getter for the #BluezLEAdvertisingManager1:active-instances property. + * @get_supported_includes: Getter for the #BluezLEAdvertisingManager1:supported-includes property. + * @get_supported_instances: Getter for the #BluezLEAdvertisingManager1:supported-instances property. + * @get_supported_secondary_channels: Getter for the #BluezLEAdvertisingManager1:supported-secondary-channels property. + * + * Virtual table for the D-Bus interface org.bluez.LEAdvertisingManager1. + */ + +typedef BluezLEAdvertisingManager1Iface BluezLEAdvertisingManager1Interface; +G_DEFINE_INTERFACE(BluezLEAdvertisingManager1, bluez_leadvertising_manager1, G_TYPE_OBJECT) + +static void bluez_leadvertising_manager1_default_init(BluezLEAdvertisingManager1Iface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezLEAdvertisingManager1::handle-register-advertisement: + * @object: A #BluezLEAdvertisingManager1. + * @invocation: A #GDBusMethodInvocation. + * @arg_advertisement: Argument passed by remote caller. + * @arg_options: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the RegisterAdvertisement() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_leadvertising_manager1_complete_register_advertisement() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-register-advertisement", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezLEAdvertisingManager1Iface, handle_register_advertisement), g_signal_accumulator_true_handled, + NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 3, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_VARIANT); + + /** + * BluezLEAdvertisingManager1::handle-unregister-advertisement: + * @object: A #BluezLEAdvertisingManager1. + * @invocation: A #GDBusMethodInvocation. + * @arg_service: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the UnregisterAdvertisement() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_leadvertising_manager1_complete_unregister_advertisement() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-unregister-advertisement", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezLEAdvertisingManager1Iface, handle_unregister_advertisement), + g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, + G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /* GObject properties for D-Bus properties: */ + /** + * BluezLEAdvertisingManager1:active-instances: + * + * Represents the D-Bus property "ActiveInstances". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_uchar("active-instances", "ActiveInstances", "ActiveInstances", 0, 255, 0, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisingManager1:supported-instances: + * + * Represents the D-Bus property "SupportedInstances". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_uchar("supported-instances", "SupportedInstances", "SupportedInstances", 0, + 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisingManager1:supported-includes: + * + * Represents the D-Bus property "SupportedIncludes". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_boxed("supported-includes", "SupportedIncludes", "SupportedIncludes", + G_TYPE_STRV, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * BluezLEAdvertisingManager1:supported-secondary-channels: + * + * Represents the D-Bus property "SupportedSecondaryChannels". + * + * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both + * the client- and service-side. It is only meaningful, however, to write to it on the service-side. + */ + g_object_interface_install_property(iface, + g_param_spec_boxed("supported-secondary-channels", "SupportedSecondaryChannels", + "SupportedSecondaryChannels", G_TYPE_STRV, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * bluez_leadvertising_manager1_get_active_instances: (skip) + * @object: A #BluezLEAdvertisingManager1. + * + * Gets the value of the "ActiveInstances" + * D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guchar bluez_leadvertising_manager1_get_active_instances(BluezLEAdvertisingManager1 * object) +{ + return BLUEZ_LEADVERTISING_MANAGER1_GET_IFACE(object)->get_active_instances(object); +} + +/** + * bluez_leadvertising_manager1_set_active_instances: (skip) + * @object: A #BluezLEAdvertisingManager1. + * @value: The value to set. + * + * Sets the "ActiveInstances" D-Bus property + * to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertising_manager1_set_active_instances(BluezLEAdvertisingManager1 * object, guchar value) +{ + g_object_set(G_OBJECT(object), "active-instances", value, NULL); +} + +/** + * bluez_leadvertising_manager1_get_supported_instances: (skip) + * @object: A #BluezLEAdvertisingManager1. + * + * Gets the value of the "SupportedInstances" D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: The property value. + */ +guchar bluez_leadvertising_manager1_get_supported_instances(BluezLEAdvertisingManager1 * object) +{ + return BLUEZ_LEADVERTISING_MANAGER1_GET_IFACE(object)->get_supported_instances(object); +} + +/** + * bluez_leadvertising_manager1_set_supported_instances: (skip) + * @object: A #BluezLEAdvertisingManager1. + * @value: The value to set. + * + * Sets the "SupportedInstances" D-Bus + * property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertising_manager1_set_supported_instances(BluezLEAdvertisingManager1 * object, guchar value) +{ + g_object_set(G_OBJECT(object), "supported-instances", value, NULL); +} + +/** + * bluez_leadvertising_manager1_get_supported_includes: (skip) + * @object: A #BluezLEAdvertisingManager1. + * + * Gets the value of the "SupportedIncludes" + * D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertising_manager1_dup_supported_includes() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * const * bluez_leadvertising_manager1_get_supported_includes(BluezLEAdvertisingManager1 * object) +{ + return BLUEZ_LEADVERTISING_MANAGER1_GET_IFACE(object)->get_supported_includes(object); +} + +/** + * bluez_leadvertising_manager1_dup_supported_includes: (skip) + * @object: A #BluezLEAdvertisingManager1. + * + * Gets a copy of the "SupportedIncludes" + * D-Bus property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_strfreev(). + */ +gchar ** bluez_leadvertising_manager1_dup_supported_includes(BluezLEAdvertisingManager1 * object) +{ + gchar ** value; + g_object_get(G_OBJECT(object), "supported-includes", &value, NULL); + return value; +} + +/** + * bluez_leadvertising_manager1_set_supported_includes: (skip) + * @object: A #BluezLEAdvertisingManager1. + * @value: The value to set. + * + * Sets the "SupportedIncludes" D-Bus + * property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertising_manager1_set_supported_includes(BluezLEAdvertisingManager1 * object, const gchar * const * value) +{ + g_object_set(G_OBJECT(object), "supported-includes", value, NULL); +} + +/** + * bluez_leadvertising_manager1_get_supported_secondary_channels: (skip) + * @object: A #BluezLEAdvertisingManager1. + * + * Gets the value of the "SupportedSecondaryChannels" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the + * thread where @object was constructed. Use bluez_leadvertising_manager1_dup_supported_secondary_channels() if on another thread. + * + * Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it + * belongs to @object. + */ +const gchar * const * bluez_leadvertising_manager1_get_supported_secondary_channels(BluezLEAdvertisingManager1 * object) +{ + return BLUEZ_LEADVERTISING_MANAGER1_GET_IFACE(object)->get_supported_secondary_channels(object); +} + +/** + * bluez_leadvertising_manager1_dup_supported_secondary_channels: (skip) + * @object: A #BluezLEAdvertisingManager1. + * + * Gets a copy of the "SupportedSecondaryChannels" D-Bus + * property. + * + * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side. + * + * Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed + * with g_strfreev(). + */ +gchar ** bluez_leadvertising_manager1_dup_supported_secondary_channels(BluezLEAdvertisingManager1 * object) +{ + gchar ** value; + g_object_get(G_OBJECT(object), "supported-secondary-channels", &value, NULL); + return value; +} + +/** + * bluez_leadvertising_manager1_set_supported_secondary_channels: (skip) + * @object: A #BluezLEAdvertisingManager1. + * @value: The value to set. + * + * Sets the "SupportedSecondaryChannels" D-Bus + * property to @value. + * + * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side. + */ +void bluez_leadvertising_manager1_set_supported_secondary_channels(BluezLEAdvertisingManager1 * object, const gchar * const * value) +{ + g_object_set(G_OBJECT(object), "supported-secondary-channels", value, NULL); +} + +/** + * bluez_leadvertising_manager1_call_register_advertisement: + * @proxy: A #BluezLEAdvertisingManager1Proxy. + * @arg_advertisement: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the RegisterAdvertisement() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call + * bluez_leadvertising_manager1_call_register_advertisement_finish() to get the result of the operation. + * + * See bluez_leadvertising_manager1_call_register_advertisement_sync() for the synchronous, blocking version of this method. + */ +void bluez_leadvertising_manager1_call_register_advertisement(BluezLEAdvertisingManager1 * proxy, const gchar * arg_advertisement, + GVariant * arg_options, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "RegisterAdvertisement", g_variant_new("(o@a{sv})", arg_advertisement, arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); +} + +/** + * bluez_leadvertising_manager1_call_register_advertisement_finish: + * @proxy: A #BluezLEAdvertisingManager1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to + * bluez_leadvertising_manager1_call_register_advertisement(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_leadvertising_manager1_call_register_advertisement(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_leadvertising_manager1_call_register_advertisement_finish(BluezLEAdvertisingManager1 * proxy, GAsyncResult * res, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_leadvertising_manager1_call_register_advertisement_sync: + * @proxy: A #BluezLEAdvertisingManager1Proxy. + * @arg_advertisement: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the RegisterAdvertisement() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_leadvertising_manager1_call_register_advertisement() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_leadvertising_manager1_call_register_advertisement_sync(BluezLEAdvertisingManager1 * proxy, + const gchar * arg_advertisement, GVariant * arg_options, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "RegisterAdvertisement", + g_variant_new("(o@a{sv})", arg_advertisement, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_leadvertising_manager1_call_unregister_advertisement: + * @proxy: A #BluezLEAdvertisingManager1Proxy. + * @arg_service: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the UnregisterAdvertisement() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call + * bluez_leadvertising_manager1_call_unregister_advertisement_finish() to get the result of the operation. + * + * See bluez_leadvertising_manager1_call_unregister_advertisement_sync() for the synchronous, blocking version of this method. + */ +void bluez_leadvertising_manager1_call_unregister_advertisement(BluezLEAdvertisingManager1 * proxy, const gchar * arg_service, + GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "UnregisterAdvertisement", g_variant_new("(o)", arg_service), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_leadvertising_manager1_call_unregister_advertisement_finish: + * @proxy: A #BluezLEAdvertisingManager1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to + * bluez_leadvertising_manager1_call_unregister_advertisement(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_leadvertising_manager1_call_unregister_advertisement(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_leadvertising_manager1_call_unregister_advertisement_finish(BluezLEAdvertisingManager1 * proxy, GAsyncResult * res, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_leadvertising_manager1_call_unregister_advertisement_sync: + * @proxy: A #BluezLEAdvertisingManager1Proxy. + * @arg_service: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the UnregisterAdvertisement() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_leadvertising_manager1_call_unregister_advertisement() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_leadvertising_manager1_call_unregister_advertisement_sync(BluezLEAdvertisingManager1 * proxy, + const gchar * arg_service, GCancellable * cancellable, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "UnregisterAdvertisement", g_variant_new("(o)", arg_service), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_leadvertising_manager1_complete_register_advertisement: + * @object: A #BluezLEAdvertisingManager1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the RegisterAdvertisement() D-Bus method. If you + * instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_leadvertising_manager1_complete_register_advertisement(BluezLEAdvertisingManager1 * object, + GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_leadvertising_manager1_complete_unregister_advertisement: + * @object: A #BluezLEAdvertisingManager1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the UnregisterAdvertisement() D-Bus method. If + * you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_leadvertising_manager1_complete_unregister_advertisement(BluezLEAdvertisingManager1 * object, + GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezLEAdvertisingManager1Proxy: + * + * The #BluezLEAdvertisingManager1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezLEAdvertisingManager1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezLEAdvertisingManager1Proxy. + */ + +struct _BluezLEAdvertisingManager1ProxyPrivate +{ + GData * qdata; +}; + +static void bluez_leadvertising_manager1_proxy_iface_init(BluezLEAdvertisingManager1Iface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezLEAdvertisingManager1Proxy, bluez_leadvertising_manager1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezLEAdvertisingManager1Proxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_LEADVERTISING_MANAGER1, bluez_leadvertising_manager1_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezLEAdvertisingManager1Proxy, bluez_leadvertising_manager1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_LEADVERTISING_MANAGER1, bluez_leadvertising_manager1_proxy_iface_init)) + +#endif +static void bluez_leadvertising_manager1_proxy_finalize(GObject * object) +{ + BluezLEAdvertisingManager1Proxy * proxy = BLUEZ_LEADVERTISING_MANAGER1_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_leadvertising_manager1_proxy_parent_class)->finalize(object); +} + +static void bluez_leadvertising_manager1_proxy_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 4); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_leadvertising_manager1_property_info_pointers[prop_id - 1]; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(object), info->parent_struct.name); + if (info->use_gvariant) + { + g_value_set_variant(value, variant); + } + else + { + if (variant != NULL) + g_dbus_gvariant_to_gvalue(variant, value); + } + if (variant != NULL) + g_variant_unref(variant); +} + +static void bluez_leadvertising_manager1_proxy_set_property_cb(GDBusProxy * proxy, GAsyncResult * res, gpointer user_data) +{ + const _ExtendedGDBusPropertyInfo * info = user_data; + GError * error; + GVariant * _ret; + error = NULL; + _ret = g_dbus_proxy_call_finish(proxy, res, &error); + if (!_ret) + { + g_warning("Error setting property '%s' on interface org.bluez.LEAdvertisingManager1: %s (%s, %d)", info->parent_struct.name, + error->message, g_quark_to_string(error->domain), error->code); + g_error_free(error); + } + else + { + g_variant_unref(_ret); + } +} + +static void bluez_leadvertising_manager1_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + const _ExtendedGDBusPropertyInfo * info; + GVariant * variant; + g_assert(prop_id != 0 && prop_id - 1 < 4); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_leadvertising_manager1_property_info_pointers[prop_id - 1]; + variant = g_dbus_gvalue_to_gvariant(value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_dbus_proxy_call(G_DBUS_PROXY(object), "org.freedesktop.DBus.Properties.Set", + g_variant_new("(ssv)", "org.bluez.LEAdvertisingManager1", info->parent_struct.name, variant), + G_DBUS_CALL_FLAGS_NONE, -1, NULL, (GAsyncReadyCallback) bluez_leadvertising_manager1_proxy_set_property_cb, + (GDBusPropertyInfo *) &info->parent_struct); + g_variant_unref(variant); +} + +static void bluez_leadvertising_manager1_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, + const gchar * signal_name, GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_leadvertising_manager1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_LEADVERTISING_MANAGER1); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_LEADVERTISING_MANAGER1); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_leadvertising_manager1_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezLEAdvertisingManager1Proxy * proxy = BLUEZ_LEADVERTISING_MANAGER1_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_leadvertising_manager1_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_leadvertising_manager1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static guchar bluez_leadvertising_manager1_proxy_get_active_instances(BluezLEAdvertisingManager1 * object) +{ + BluezLEAdvertisingManager1Proxy * proxy = BLUEZ_LEADVERTISING_MANAGER1_PROXY(object); + GVariant * variant; + guchar value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "ActiveInstances"); + if (variant != NULL) + { + value = g_variant_get_byte(variant); + g_variant_unref(variant); + } + return value; +} + +static guchar bluez_leadvertising_manager1_proxy_get_supported_instances(BluezLEAdvertisingManager1 * object) +{ + BluezLEAdvertisingManager1Proxy * proxy = BLUEZ_LEADVERTISING_MANAGER1_PROXY(object); + GVariant * variant; + guchar value = 0; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "SupportedInstances"); + if (variant != NULL) + { + value = g_variant_get_byte(variant); + g_variant_unref(variant); + } + return value; +} + +static const gchar * const * bluez_leadvertising_manager1_proxy_get_supported_includes(BluezLEAdvertisingManager1 * object) +{ + BluezLEAdvertisingManager1Proxy * proxy = BLUEZ_LEADVERTISING_MANAGER1_PROXY(object); + GVariant * variant; + const gchar * const * value = NULL; + value = g_datalist_get_data(&proxy->priv->qdata, "SupportedIncludes"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "SupportedIncludes"); + if (variant != NULL) + { + value = g_variant_get_strv(variant, NULL); + g_datalist_set_data_full(&proxy->priv->qdata, "SupportedIncludes", (gpointer) value, g_free); + g_variant_unref(variant); + } + return value; +} + +static const gchar * const * +bluez_leadvertising_manager1_proxy_get_supported_secondary_channels(BluezLEAdvertisingManager1 * object) +{ + BluezLEAdvertisingManager1Proxy * proxy = BLUEZ_LEADVERTISING_MANAGER1_PROXY(object); + GVariant * variant; + const gchar * const * value = NULL; + value = g_datalist_get_data(&proxy->priv->qdata, "SupportedSecondaryChannels"); + if (value != NULL) + return value; + variant = g_dbus_proxy_get_cached_property(G_DBUS_PROXY(proxy), "SupportedSecondaryChannels"); + if (variant != NULL) + { + value = g_variant_get_strv(variant, NULL); + g_datalist_set_data_full(&proxy->priv->qdata, "SupportedSecondaryChannels", (gpointer) value, g_free); + g_variant_unref(variant); + } + return value; +} + +static void bluez_leadvertising_manager1_proxy_init(BluezLEAdvertisingManager1Proxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_leadvertising_manager1_proxy_get_instance_private(proxy); +#else + proxy->priv = + G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY, BluezLEAdvertisingManager1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_leadvertising_manager1_interface_info()); +} + +static void bluez_leadvertising_manager1_proxy_class_init(BluezLEAdvertisingManager1ProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_leadvertising_manager1_proxy_finalize; + gobject_class->get_property = bluez_leadvertising_manager1_proxy_get_property; + gobject_class->set_property = bluez_leadvertising_manager1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_leadvertising_manager1_proxy_g_signal; + proxy_class->g_properties_changed = bluez_leadvertising_manager1_proxy_g_properties_changed; + + bluez_leadvertising_manager1_override_properties(gobject_class, 1); + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezLEAdvertisingManager1ProxyPrivate)); +#endif +} + +static void bluez_leadvertising_manager1_proxy_iface_init(BluezLEAdvertisingManager1Iface * iface) +{ + iface->get_active_instances = bluez_leadvertising_manager1_proxy_get_active_instances; + iface->get_supported_instances = bluez_leadvertising_manager1_proxy_get_supported_instances; + iface->get_supported_includes = bluez_leadvertising_manager1_proxy_get_supported_includes; + iface->get_supported_secondary_channels = bluez_leadvertising_manager1_proxy_get_supported_secondary_channels; +} + +/** + * bluez_leadvertising_manager1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.bluez.LEAdvertisingManager1. See + * g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_leadvertising_manager1_proxy_new_finish() to get + * the result of the operation. + * + * See bluez_leadvertising_manager1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_leadvertising_manager1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, + "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, + "g-interface-name", "org.bluez.LEAdvertisingManager1", NULL); +} + +/** + * bluez_leadvertising_manager1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_leadvertising_manager1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_leadvertising_manager1_proxy_new(). + * + * Returns: (transfer full) (type BluezLEAdvertisingManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_LEADVERTISING_MANAGER1(ret); + else + return NULL; +} + +/** + * bluez_leadvertising_manager1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.bluez.LEAdvertisingManager1. See + * g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_leadvertising_manager1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezLEAdvertisingManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, + "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.bluez.LEAdvertisingManager1", NULL); + if (ret != NULL) + return BLUEZ_LEADVERTISING_MANAGER1(ret); + else + return NULL; +} + +/** + * bluez_leadvertising_manager1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_leadvertising_manager1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_leadvertising_manager1_proxy_new_for_bus_finish() + * to get the result of the operation. + * + * See bluez_leadvertising_manager1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_leadvertising_manager1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, + "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, + "g-interface-name", "org.bluez.LEAdvertisingManager1", NULL); +} + +/** + * bluez_leadvertising_manager1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_leadvertising_manager1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_leadvertising_manager1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezLEAdvertisingManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_LEADVERTISING_MANAGER1(ret); + else + return NULL; +} + +/** + * bluez_leadvertising_manager1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_leadvertising_manager1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_leadvertising_manager1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezLEAdvertisingManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = + g_initable_new(BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", + bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.LEAdvertisingManager1", NULL); + if (ret != NULL) + return BLUEZ_LEADVERTISING_MANAGER1(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezLEAdvertisingManager1Skeleton: + * + * The #BluezLEAdvertisingManager1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezLEAdvertisingManager1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezLEAdvertisingManager1Skeleton. + */ + +struct _BluezLEAdvertisingManager1SkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_leadvertising_manager1_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name, const gchar * method_name, + GVariant * parameters, GDBusMethodInvocation * invocation, + gpointer user_data) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_LEADVERTISING_MANAGER1); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_LEADVERTISING_MANAGER1); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_leadvertising_manager1_skeleton_handle_get_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_leadvertising_manager1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_leadvertising_manager1_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GVariant * variant, + GError ** error, gpointer user_data) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_leadvertising_manager1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_leadvertising_manager1_skeleton_vtable = { + _bluez_leadvertising_manager1_skeleton_handle_method_call, + _bluez_leadvertising_manager1_skeleton_handle_get_property, + _bluez_leadvertising_manager1_skeleton_handle_set_property, + { NULL } +}; + +static GDBusInterfaceInfo * +bluez_leadvertising_manager1_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_leadvertising_manager1_interface_info(); +} + +static GDBusInterfaceVTable * +bluez_leadvertising_manager1_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_leadvertising_manager1_skeleton_vtable; +} + +static GVariant * bluez_leadvertising_manager1_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_leadvertising_manager1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_leadvertising_manager1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_leadvertising_manager1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_leadvertising_manager1_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.bluez.LEAdvertisingManager1", + info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static gboolean _bluez_leadvertising_manager1_emit_changed(gpointer user_data); + +static void bluez_leadvertising_manager1_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(_skeleton); + gboolean emit_changed = FALSE; + + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties_idle_source != NULL) + { + g_source_destroy(skeleton->priv->changed_properties_idle_source); + skeleton->priv->changed_properties_idle_source = NULL; + emit_changed = TRUE; + } + g_mutex_unlock(&skeleton->priv->lock); + + if (emit_changed) + _bluez_leadvertising_manager1_emit_changed(skeleton); +} + +static void bluez_leadvertising_manager1_skeleton_iface_init(BluezLEAdvertisingManager1Iface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezLEAdvertisingManager1Skeleton, bluez_leadvertising_manager1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezLEAdvertisingManager1Skeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_LEADVERTISING_MANAGER1, + bluez_leadvertising_manager1_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezLEAdvertisingManager1Skeleton, bluez_leadvertising_manager1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_LEADVERTISING_MANAGER1, bluez_leadvertising_manager1_skeleton_iface_init)) + +#endif +static void bluez_leadvertising_manager1_skeleton_finalize(GObject * object) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(object); + guint n; + for (n = 0; n < 4; n++) + g_value_unset(&skeleton->priv->properties[n]); + g_free(skeleton->priv->properties); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_leadvertising_manager1_skeleton_parent_class)->finalize(object); +} + +static void bluez_leadvertising_manager1_skeleton_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 4); + g_mutex_lock(&skeleton->priv->lock); + g_value_copy(&skeleton->priv->properties[prop_id - 1], value); + g_mutex_unlock(&skeleton->priv->lock); +} + +static gboolean _bluez_leadvertising_manager1_emit_changed(gpointer user_data) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(user_data); + GList * l; + GVariantBuilder builder; + GVariantBuilder invalidated_builder; + guint num_changes; + + g_mutex_lock(&skeleton->priv->lock); + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + g_variant_builder_init(&invalidated_builder, G_VARIANT_TYPE("as")); + for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next) + { + ChangedProperty * cp = l->data; + GVariant * variant; + const GValue * cur_value; + + cur_value = &skeleton->priv->properties[cp->prop_id - 1]; + if (!_g_value_equal(cur_value, &cp->orig_value)) + { + variant = g_dbus_gvalue_to_gvariant(cur_value, G_VARIANT_TYPE(cp->info->parent_struct.signature)); + g_variant_builder_add(&builder, "{sv}", cp->info->parent_struct.name, variant); + g_variant_unref(variant); + num_changes++; + } + } + if (num_changes > 0) + { + GList *connections, *ll; + GVariant * signal_variant; + signal_variant = + g_variant_ref_sink(g_variant_new("(sa{sv}as)", "org.bluez.LEAdvertisingManager1", &builder, &invalidated_builder)); + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + for (ll = connections; ll != NULL; ll = ll->next) + { + GDBusConnection * connection = ll->data; + + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); + } + else + { + g_variant_builder_clear(&builder); + g_variant_builder_clear(&invalidated_builder); + } + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + skeleton->priv->changed_properties = NULL; + skeleton->priv->changed_properties_idle_source = NULL; + g_mutex_unlock(&skeleton->priv->lock); + return FALSE; +} + +static void _bluez_leadvertising_manager1_schedule_emit_changed(BluezLEAdvertisingManager1Skeleton * skeleton, + const _ExtendedGDBusPropertyInfo * info, guint prop_id, + const GValue * orig_value) +{ + ChangedProperty * cp; + GList * l; + cp = NULL; + for (l = skeleton->priv->changed_properties; l != NULL; l = l->next) + { + ChangedProperty * i_cp = l->data; + if (i_cp->info == info) + { + cp = i_cp; + break; + } + } + if (cp == NULL) + { + cp = g_new0(ChangedProperty, 1); + cp->prop_id = prop_id; + cp->info = info; + skeleton->priv->changed_properties = g_list_prepend(skeleton->priv->changed_properties, cp); + g_value_init(&cp->orig_value, G_VALUE_TYPE(orig_value)); + g_value_copy(orig_value, &cp->orig_value); + } +} + +static void bluez_leadvertising_manager1_skeleton_notify(GObject * object, GParamSpec * pspec G_GNUC_UNUSED) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(object); + g_mutex_lock(&skeleton->priv->lock); + if (skeleton->priv->changed_properties != NULL && skeleton->priv->changed_properties_idle_source == NULL) + { + skeleton->priv->changed_properties_idle_source = g_idle_source_new(); + g_source_set_priority(skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT); + g_source_set_callback(skeleton->priv->changed_properties_idle_source, _bluez_leadvertising_manager1_emit_changed, + g_object_ref(skeleton), (GDestroyNotify) g_object_unref); + g_source_set_name(skeleton->priv->changed_properties_idle_source, "[generated] _bluez_leadvertising_manager1_emit_changed"); + g_source_attach(skeleton->priv->changed_properties_idle_source, skeleton->priv->context); + g_source_unref(skeleton->priv->changed_properties_idle_source); + } + g_mutex_unlock(&skeleton->priv->lock); +} + +static void bluez_leadvertising_manager1_skeleton_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec) +{ + const _ExtendedGDBusPropertyInfo * info; + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(object); + g_assert(prop_id != 0 && prop_id - 1 < 4); + info = (const _ExtendedGDBusPropertyInfo *) _bluez_leadvertising_manager1_property_info_pointers[prop_id - 1]; + g_mutex_lock(&skeleton->priv->lock); + g_object_freeze_notify(object); + if (!_g_value_equal(value, &skeleton->priv->properties[prop_id - 1])) + { + if (g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)) != NULL && info->emits_changed_signal) + _bluez_leadvertising_manager1_schedule_emit_changed(skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]); + g_value_copy(value, &skeleton->priv->properties[prop_id - 1]); + g_object_notify_by_pspec(object, pspec); + } + g_mutex_unlock(&skeleton->priv->lock); + g_object_thaw_notify(object); +} + +static void bluez_leadvertising_manager1_skeleton_init(BluezLEAdvertisingManager1Skeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_leadvertising_manager1_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_LEADVERTISING_MANAGER1_SKELETON, + BluezLEAdvertisingManager1SkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); + skeleton->priv->properties = g_new0(GValue, 4); + g_value_init(&skeleton->priv->properties[0], G_TYPE_UCHAR); + g_value_init(&skeleton->priv->properties[1], G_TYPE_UCHAR); + g_value_init(&skeleton->priv->properties[2], G_TYPE_STRV); + g_value_init(&skeleton->priv->properties[3], G_TYPE_STRV); +} + +static guchar bluez_leadvertising_manager1_skeleton_get_active_instances(BluezLEAdvertisingManager1 * object) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(object); + guchar value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uchar(&(skeleton->priv->properties[0])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static guchar bluez_leadvertising_manager1_skeleton_get_supported_instances(BluezLEAdvertisingManager1 * object) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(object); + guchar value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_uchar(&(skeleton->priv->properties[1])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * const * bluez_leadvertising_manager1_skeleton_get_supported_includes(BluezLEAdvertisingManager1 * object) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(object); + const gchar * const * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boxed(&(skeleton->priv->properties[2])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static const gchar * const * +bluez_leadvertising_manager1_skeleton_get_supported_secondary_channels(BluezLEAdvertisingManager1 * object) +{ + BluezLEAdvertisingManager1Skeleton * skeleton = BLUEZ_LEADVERTISING_MANAGER1_SKELETON(object); + const gchar * const * value; + g_mutex_lock(&skeleton->priv->lock); + value = g_value_get_boxed(&(skeleton->priv->properties[3])); + g_mutex_unlock(&skeleton->priv->lock); + return value; +} + +static void bluez_leadvertising_manager1_skeleton_class_init(BluezLEAdvertisingManager1SkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_leadvertising_manager1_skeleton_finalize; + gobject_class->get_property = bluez_leadvertising_manager1_skeleton_get_property; + gobject_class->set_property = bluez_leadvertising_manager1_skeleton_set_property; + gobject_class->notify = bluez_leadvertising_manager1_skeleton_notify; + + bluez_leadvertising_manager1_override_properties(gobject_class, 1); + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_leadvertising_manager1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_leadvertising_manager1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_leadvertising_manager1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_leadvertising_manager1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezLEAdvertisingManager1SkeletonPrivate)); +#endif +} + +static void bluez_leadvertising_manager1_skeleton_iface_init(BluezLEAdvertisingManager1Iface * iface) +{ + iface->get_active_instances = bluez_leadvertising_manager1_skeleton_get_active_instances; + iface->get_supported_instances = bluez_leadvertising_manager1_skeleton_get_supported_instances; + iface->get_supported_includes = bluez_leadvertising_manager1_skeleton_get_supported_includes; + iface->get_supported_secondary_channels = bluez_leadvertising_manager1_skeleton_get_supported_secondary_channels; +} + +/** + * bluez_leadvertising_manager1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.bluez.LEAdvertisingManager1. + * + * Returns: (transfer full) (type BluezLEAdvertisingManager1Skeleton): The skeleton object. + */ +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_skeleton_new(void) +{ + return BLUEZ_LEADVERTISING_MANAGER1(g_object_new(BLUEZ_TYPE_LEADVERTISING_MANAGER1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.DBus.Properties + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezOrgFreedesktopDBusProperties + * @title: BluezOrgFreedesktopDBusProperties + * @short_description: Generated C code for the org.freedesktop.DBus.Properties D-Bus interface + * + * This section contains code for working with the org.freedesktop.DBus.Properties D-Bus interface in + * C. + */ + +/* ---- Introspection data for org.freedesktop.DBus.Properties ---- */ + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_method_info_get_IN_ARG_interface = { + { -1, (gchar *) "interface", (gchar *) "s", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_method_info_get_IN_ARG_name = { + { -1, (gchar *) "name", (gchar *) "s", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_org_freedesktop_dbus_properties_method_info_get_IN_ARG_pointers[] = { + &_bluez_org_freedesktop_dbus_properties_method_info_get_IN_ARG_interface.parent_struct, + &_bluez_org_freedesktop_dbus_properties_method_info_get_IN_ARG_name.parent_struct, NULL +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_method_info_get_OUT_ARG_value = { + { -1, (gchar *) "value", (gchar *) "v", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_org_freedesktop_dbus_properties_method_info_get_OUT_ARG_pointers[] = { + &_bluez_org_freedesktop_dbus_properties_method_info_get_OUT_ARG_value.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_org_freedesktop_dbus_properties_method_info_get = { + { -1, (gchar *) "Get", (GDBusArgInfo **) &_bluez_org_freedesktop_dbus_properties_method_info_get_IN_ARG_pointers, + (GDBusArgInfo **) &_bluez_org_freedesktop_dbus_properties_method_info_get_OUT_ARG_pointers, NULL }, + "handle-get", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_method_info_set_IN_ARG_interface = { + { -1, (gchar *) "interface", (gchar *) "s", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_method_info_set_IN_ARG_name = { + { -1, (gchar *) "name", (gchar *) "s", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_method_info_set_IN_ARG_value = { + { -1, (gchar *) "value", (gchar *) "v", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_org_freedesktop_dbus_properties_method_info_set_IN_ARG_pointers[] = { + &_bluez_org_freedesktop_dbus_properties_method_info_set_IN_ARG_interface.parent_struct, + &_bluez_org_freedesktop_dbus_properties_method_info_set_IN_ARG_name.parent_struct, + &_bluez_org_freedesktop_dbus_properties_method_info_set_IN_ARG_value.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_org_freedesktop_dbus_properties_method_info_set = { + { -1, (gchar *) "Set", (GDBusArgInfo **) &_bluez_org_freedesktop_dbus_properties_method_info_set_IN_ARG_pointers, NULL, NULL }, + "handle-set", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_method_info_get_all_IN_ARG_interface = { + { -1, (gchar *) "interface", (gchar *) "s", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_org_freedesktop_dbus_properties_method_info_get_all_IN_ARG_pointers[] = { + &_bluez_org_freedesktop_dbus_properties_method_info_get_all_IN_ARG_interface.parent_struct, NULL +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_method_info_get_all_OUT_ARG_properties = { + { -1, (gchar *) "properties", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_org_freedesktop_dbus_properties_method_info_get_all_OUT_ARG_pointers[] = { + &_bluez_org_freedesktop_dbus_properties_method_info_get_all_OUT_ARG_properties.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_org_freedesktop_dbus_properties_method_info_get_all = { + { -1, (gchar *) "GetAll", (GDBusArgInfo **) &_bluez_org_freedesktop_dbus_properties_method_info_get_all_IN_ARG_pointers, + (GDBusArgInfo **) &_bluez_org_freedesktop_dbus_properties_method_info_get_all_OUT_ARG_pointers, NULL }, + "handle-get-all", + FALSE +}; + +static const GDBusMethodInfo * const _bluez_org_freedesktop_dbus_properties_method_info_pointers[] = { + &_bluez_org_freedesktop_dbus_properties_method_info_get.parent_struct, + &_bluez_org_freedesktop_dbus_properties_method_info_set.parent_struct, + &_bluez_org_freedesktop_dbus_properties_method_info_get_all.parent_struct, NULL +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_signal_info_properties_changed_ARG_interface = { + { -1, (gchar *) "interface", (gchar *) "s", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_properties_signal_info_properties_changed_ARG_changed_properties = { + { -1, (gchar *) "changed_properties", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo + _bluez_org_freedesktop_dbus_properties_signal_info_properties_changed_ARG_invalidated_properties = { + { -1, (gchar *) "invalidated_properties", (gchar *) "as", NULL }, FALSE + }; + +static const GDBusArgInfo * const _bluez_org_freedesktop_dbus_properties_signal_info_properties_changed_ARG_pointers[] = { + &_bluez_org_freedesktop_dbus_properties_signal_info_properties_changed_ARG_interface.parent_struct, + &_bluez_org_freedesktop_dbus_properties_signal_info_properties_changed_ARG_changed_properties.parent_struct, + &_bluez_org_freedesktop_dbus_properties_signal_info_properties_changed_ARG_invalidated_properties.parent_struct, NULL +}; + +static const _ExtendedGDBusSignalInfo _bluez_org_freedesktop_dbus_properties_signal_info_properties_changed = { + { -1, (gchar *) "PropertiesChanged", + (GDBusArgInfo **) &_bluez_org_freedesktop_dbus_properties_signal_info_properties_changed_ARG_pointers, NULL }, + "properties-changed" +}; + +static const GDBusSignalInfo * const _bluez_org_freedesktop_dbus_properties_signal_info_pointers[] = { + &_bluez_org_freedesktop_dbus_properties_signal_info_properties_changed.parent_struct, NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_org_freedesktop_dbus_properties_interface_info = { + { -1, (gchar *) "org.freedesktop.DBus.Properties", + (GDBusMethodInfo **) &_bluez_org_freedesktop_dbus_properties_method_info_pointers, + (GDBusSignalInfo **) &_bluez_org_freedesktop_dbus_properties_signal_info_pointers, NULL, NULL }, + "org-freedesktop-dbus-properties", +}; + +/** + * bluez_org_freedesktop_dbus_properties_interface_info: + * + * Gets a machine-readable description of the org.freedesktop.DBus.Properties D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_org_freedesktop_dbus_properties_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_properties_interface_info.parent_struct; +} + +/** + * bluez_org_freedesktop_dbus_properties_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezOrgFreedesktopDBusProperties interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_org_freedesktop_dbus_properties_override_properties(GObjectClass * klass, guint property_id_begin) +{ + return property_id_begin - 1; +} + +/** + * BluezOrgFreedesktopDBusProperties: + * + * Abstract interface type for the D-Bus interface org.freedesktop.DBus.Properties. + */ + +/** + * BluezOrgFreedesktopDBusPropertiesIface: + * @parent_iface: The parent interface. + * @handle_get: Handler for the #BluezOrgFreedesktopDBusProperties::handle-get signal. + * @handle_get_all: Handler for the #BluezOrgFreedesktopDBusProperties::handle-get-all signal. + * @handle_set: Handler for the #BluezOrgFreedesktopDBusProperties::handle-set signal. + * @properties_changed: Handler for the #BluezOrgFreedesktopDBusProperties::properties-changed signal. + * + * Virtual table for the D-Bus interface org.freedesktop.DBus.Properties. + */ + +typedef BluezOrgFreedesktopDBusPropertiesIface BluezOrgFreedesktopDBusPropertiesInterface; +G_DEFINE_INTERFACE(BluezOrgFreedesktopDBusProperties, bluez_org_freedesktop_dbus_properties, G_TYPE_OBJECT) + +static void bluez_org_freedesktop_dbus_properties_default_init(BluezOrgFreedesktopDBusPropertiesIface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezOrgFreedesktopDBusProperties::handle-get: + * @object: A #BluezOrgFreedesktopDBusProperties. + * @invocation: A #GDBusMethodInvocation. + * @arg_interface: Argument passed by remote caller. + * @arg_name: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the Get() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_org_freedesktop_dbus_properties_complete_get() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-get", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezOrgFreedesktopDBusPropertiesIface, handle_get), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 3, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING); + + /** + * BluezOrgFreedesktopDBusProperties::handle-set: + * @object: A #BluezOrgFreedesktopDBusProperties. + * @invocation: A #GDBusMethodInvocation. + * @arg_interface: Argument passed by remote caller. + * @arg_name: Argument passed by remote caller. + * @arg_value: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the Set() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_org_freedesktop_dbus_properties_complete_set() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-set", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezOrgFreedesktopDBusPropertiesIface, handle_set), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 4, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_VARIANT); + + /** + * BluezOrgFreedesktopDBusProperties::handle-get-all: + * @object: A #BluezOrgFreedesktopDBusProperties. + * @invocation: A #GDBusMethodInvocation. + * @arg_interface: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the GetAll() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_org_freedesktop_dbus_properties_complete_get_all() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-get-all", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezOrgFreedesktopDBusPropertiesIface, handle_get_all), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); + + /* GObject signals for received D-Bus signals: */ + /** + * BluezOrgFreedesktopDBusProperties::properties-changed: + * @object: A #BluezOrgFreedesktopDBusProperties. + * @arg_interface: Argument. + * @arg_changed_properties: Argument. + * @arg_invalidated_properties: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "PropertiesChanged" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new("properties-changed", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezOrgFreedesktopDBusPropertiesIface, properties_changed), NULL, NULL, + g_cclosure_marshal_generic, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_STRV); +} + +/** + * bluez_org_freedesktop_dbus_properties_emit_properties_changed: + * @object: A #BluezOrgFreedesktopDBusProperties. + * @arg_interface: Argument to pass with the signal. + * @arg_changed_properties: Argument to pass with the signal. + * @arg_invalidated_properties: Argument to pass with the signal. + * + * Emits the "PropertiesChanged" D-Bus signal. + */ +void bluez_org_freedesktop_dbus_properties_emit_properties_changed(BluezOrgFreedesktopDBusProperties * object, + const gchar * arg_interface, GVariant * arg_changed_properties, + const gchar * const * arg_invalidated_properties) +{ + g_signal_emit_by_name(object, "properties-changed", arg_interface, arg_changed_properties, arg_invalidated_properties); +} + +/** + * bluez_org_freedesktop_dbus_properties_call_get: + * @proxy: A #BluezOrgFreedesktopDBusPropertiesProxy. + * @arg_interface: Argument to pass with the method invocation. + * @arg_name: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the Get() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_org_freedesktop_dbus_properties_call_get_finish() + * to get the result of the operation. + * + * See bluez_org_freedesktop_dbus_properties_call_get_sync() for the synchronous, blocking version of this method. + */ +void bluez_org_freedesktop_dbus_properties_call_get(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + const gchar * arg_name, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "Get", g_variant_new("(ss)", arg_interface, arg_name), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_org_freedesktop_dbus_properties_call_get_finish: + * @proxy: A #BluezOrgFreedesktopDBusPropertiesProxy. + * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_org_freedesktop_dbus_properties_call_get(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_org_freedesktop_dbus_properties_call_get(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_org_freedesktop_dbus_properties_call_get_finish(BluezOrgFreedesktopDBusProperties * proxy, GVariant ** out_value, + GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@v)", out_value); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_org_freedesktop_dbus_properties_call_get_sync: + * @proxy: A #BluezOrgFreedesktopDBusPropertiesProxy. + * @arg_interface: Argument to pass with the method invocation. + * @arg_name: Argument to pass with the method invocation. + * @out_value: (out) (optional): Return location for return parameter or %NULL to ignore. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Get() D-Bus method on @proxy. + * The calling thread is blocked until a reply is received. + * + * See bluez_org_freedesktop_dbus_properties_call_get() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_org_freedesktop_dbus_properties_call_get_sync(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + const gchar * arg_name, GVariant ** out_value, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "Get", g_variant_new("(ss)", arg_interface, arg_name), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@v)", out_value); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_org_freedesktop_dbus_properties_call_set: + * @proxy: A #BluezOrgFreedesktopDBusPropertiesProxy. + * @arg_interface: Argument to pass with the method invocation. + * @arg_name: Argument to pass with the method invocation. + * @arg_value: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the Set() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_org_freedesktop_dbus_properties_call_set_finish() + * to get the result of the operation. + * + * See bluez_org_freedesktop_dbus_properties_call_set_sync() for the synchronous, blocking version of this method. + */ +void bluez_org_freedesktop_dbus_properties_call_set(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + const gchar * arg_name, GVariant * arg_value, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "Set", g_variant_new("(ss@v)", arg_interface, arg_name, arg_value), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); +} + +/** + * bluez_org_freedesktop_dbus_properties_call_set_finish: + * @proxy: A #BluezOrgFreedesktopDBusPropertiesProxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_org_freedesktop_dbus_properties_call_set(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_org_freedesktop_dbus_properties_call_set(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_org_freedesktop_dbus_properties_call_set_finish(BluezOrgFreedesktopDBusProperties * proxy, GAsyncResult * res, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_org_freedesktop_dbus_properties_call_set_sync: + * @proxy: A #BluezOrgFreedesktopDBusPropertiesProxy. + * @arg_interface: Argument to pass with the method invocation. + * @arg_name: Argument to pass with the method invocation. + * @arg_value: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the Set() D-Bus method on @proxy. + * The calling thread is blocked until a reply is received. + * + * See bluez_org_freedesktop_dbus_properties_call_set() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_org_freedesktop_dbus_properties_call_set_sync(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + const gchar * arg_name, GVariant * arg_value, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "Set", g_variant_new("(ss@v)", arg_interface, arg_name, arg_value), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_org_freedesktop_dbus_properties_call_get_all: + * @proxy: A #BluezOrgFreedesktopDBusPropertiesProxy. + * @arg_interface: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the GetAll() D-Bus method on + * @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling + * this method from (see g_main_context_push_thread_default()). You can then call + * bluez_org_freedesktop_dbus_properties_call_get_all_finish() to get the result of the operation. + * + * See bluez_org_freedesktop_dbus_properties_call_get_all_sync() for the synchronous, blocking version of this method. + */ +void bluez_org_freedesktop_dbus_properties_call_get_all(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "GetAll", g_variant_new("(s)", arg_interface), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, + callback, user_data); +} + +/** + * bluez_org_freedesktop_dbus_properties_call_get_all_finish: + * @proxy: A #BluezOrgFreedesktopDBusPropertiesProxy. + * @out_properties: (out) (optional): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_org_freedesktop_dbus_properties_call_get_all(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_org_freedesktop_dbus_properties_call_get_all(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_org_freedesktop_dbus_properties_call_get_all_finish(BluezOrgFreedesktopDBusProperties * proxy, + GVariant ** out_properties, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@a{sv})", out_properties); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_org_freedesktop_dbus_properties_call_get_all_sync: + * @proxy: A #BluezOrgFreedesktopDBusPropertiesProxy. + * @arg_interface: Argument to pass with the method invocation. + * @out_properties: (out) (optional): Return location for return parameter or %NULL to ignore. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the GetAll() D-Bus method on + * @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_org_freedesktop_dbus_properties_call_get_all() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_org_freedesktop_dbus_properties_call_get_all_sync(BluezOrgFreedesktopDBusProperties * proxy, + const gchar * arg_interface, GVariant ** out_properties, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "GetAll", g_variant_new("(s)", arg_interface), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@a{sv})", out_properties); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_org_freedesktop_dbus_properties_complete_get: + * @object: A #BluezOrgFreedesktopDBusProperties. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @value: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the Get() D-Bus method. If you instead want to finish handling an + * invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_org_freedesktop_dbus_properties_complete_get(BluezOrgFreedesktopDBusProperties * object, + GDBusMethodInvocation * invocation, GVariant * value) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("(@v)", value)); +} + +/** + * bluez_org_freedesktop_dbus_properties_complete_set: + * @object: A #BluezOrgFreedesktopDBusProperties. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the Set() D-Bus method. If you instead want to finish handling an + * invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_org_freedesktop_dbus_properties_complete_set(BluezOrgFreedesktopDBusProperties * object, + GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_org_freedesktop_dbus_properties_complete_get_all: + * @object: A #BluezOrgFreedesktopDBusProperties. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @properties: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the GetAll() D-Bus method. If you instead want to finish + * handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_org_freedesktop_dbus_properties_complete_get_all(BluezOrgFreedesktopDBusProperties * object, + GDBusMethodInvocation * invocation, GVariant * properties) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("(@a{sv})", properties)); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezOrgFreedesktopDBusPropertiesProxy: + * + * The #BluezOrgFreedesktopDBusPropertiesProxy structure contains only private data and should only be accessed using the provided + * API. + */ + +/** + * BluezOrgFreedesktopDBusPropertiesProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezOrgFreedesktopDBusPropertiesProxy. + */ + +struct _BluezOrgFreedesktopDBusPropertiesProxyPrivate +{ + GData * qdata; +}; + +static void bluez_org_freedesktop_dbus_properties_proxy_iface_init(BluezOrgFreedesktopDBusPropertiesIface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezOrgFreedesktopDBusPropertiesProxy, bluez_org_freedesktop_dbus_properties_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezOrgFreedesktopDBusPropertiesProxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES, + bluez_org_freedesktop_dbus_properties_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezOrgFreedesktopDBusPropertiesProxy, bluez_org_freedesktop_dbus_properties_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES, + bluez_org_freedesktop_dbus_properties_proxy_iface_init)) + +#endif +static void bluez_org_freedesktop_dbus_properties_proxy_finalize(GObject * object) +{ + BluezOrgFreedesktopDBusPropertiesProxy * proxy = BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_org_freedesktop_dbus_properties_proxy_parent_class)->finalize(object); +} + +static void bluez_org_freedesktop_dbus_properties_proxy_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{} + +static void bluez_org_freedesktop_dbus_properties_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{} + +static void bluez_org_freedesktop_dbus_properties_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, + const gchar * signal_name, GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_properties_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_org_freedesktop_dbus_properties_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezOrgFreedesktopDBusPropertiesProxy * proxy = BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_properties_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_properties_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static void bluez_org_freedesktop_dbus_properties_proxy_init(BluezOrgFreedesktopDBusPropertiesProxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_org_freedesktop_dbus_properties_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY, + BluezOrgFreedesktopDBusPropertiesProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_org_freedesktop_dbus_properties_interface_info()); +} + +static void bluez_org_freedesktop_dbus_properties_proxy_class_init(BluezOrgFreedesktopDBusPropertiesProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_org_freedesktop_dbus_properties_proxy_finalize; + gobject_class->get_property = bluez_org_freedesktop_dbus_properties_proxy_get_property; + gobject_class->set_property = bluez_org_freedesktop_dbus_properties_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_org_freedesktop_dbus_properties_proxy_g_signal; + proxy_class->g_properties_changed = bluez_org_freedesktop_dbus_properties_proxy_g_properties_changed; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezOrgFreedesktopDBusPropertiesProxyPrivate)); +#endif +} + +static void bluez_org_freedesktop_dbus_properties_proxy_iface_init(BluezOrgFreedesktopDBusPropertiesIface * iface) {} + +/** + * bluez_org_freedesktop_dbus_properties_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.freedesktop.DBus.Properties. See + * g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call + * bluez_org_freedesktop_dbus_properties_proxy_new_finish() to get the result of the operation. + * + * See bluez_org_freedesktop_dbus_properties_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_org_freedesktop_dbus_properties_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, + user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", + object_path, "g-interface-name", "org.freedesktop.DBus.Properties", NULL); +} + +/** + * bluez_org_freedesktop_dbus_properties_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_org_freedesktop_dbus_properties_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_org_freedesktop_dbus_properties_proxy_new(). + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusPropertiesProxy): The constructed proxy object or %NULL if @error is set. + */ +BluezOrgFreedesktopDBusProperties * bluez_org_freedesktop_dbus_properties_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES(ret); + else + return NULL; +} + +/** + * bluez_org_freedesktop_dbus_properties_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.freedesktop.DBus.Properties. See + * g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_org_freedesktop_dbus_properties_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusPropertiesProxy): The constructed proxy object or %NULL if @error is set. + */ +BluezOrgFreedesktopDBusProperties * +bluez_org_freedesktop_dbus_properties_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY, cancellable, error, "g-flags", flags, "g-name", name, + "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.freedesktop.DBus.Properties", NULL); + if (ret != NULL) + return BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES(ret); + else + return NULL; +} + +/** + * bluez_org_freedesktop_dbus_properties_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_org_freedesktop_dbus_properties_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call + * bluez_org_freedesktop_dbus_properties_proxy_new_for_bus_finish() to get the result of the operation. + * + * See bluez_org_freedesktop_dbus_properties_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_org_freedesktop_dbus_properties_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, + user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, + "g-interface-name", "org.freedesktop.DBus.Properties", NULL); +} + +/** + * bluez_org_freedesktop_dbus_properties_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to + * bluez_org_freedesktop_dbus_properties_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_org_freedesktop_dbus_properties_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusPropertiesProxy): The constructed proxy object or %NULL if @error is set. + */ +BluezOrgFreedesktopDBusProperties * bluez_org_freedesktop_dbus_properties_proxy_new_for_bus_finish(GAsyncResult * res, + GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES(ret); + else + return NULL; +} + +/** + * bluez_org_freedesktop_dbus_properties_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_org_freedesktop_dbus_properties_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_org_freedesktop_dbus_properties_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusPropertiesProxy): The constructed proxy object or %NULL if @error is set. + */ +BluezOrgFreedesktopDBusProperties * +bluez_org_freedesktop_dbus_properties_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY, cancellable, error, "g-flags", flags, "g-name", name, + "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", + "org.freedesktop.DBus.Properties", NULL); + if (ret != NULL) + return BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezOrgFreedesktopDBusPropertiesSkeleton: + * + * The #BluezOrgFreedesktopDBusPropertiesSkeleton structure contains only private data and should only be accessed using the + * provided API. + */ + +/** + * BluezOrgFreedesktopDBusPropertiesSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezOrgFreedesktopDBusPropertiesSkeleton. + */ + +struct _BluezOrgFreedesktopDBusPropertiesSkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_org_freedesktop_dbus_properties_skeleton_handle_method_call( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name, const gchar * method_name, GVariant * parameters, GDBusMethodInvocation * invocation, + gpointer user_data) +{ + BluezOrgFreedesktopDBusPropertiesSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_org_freedesktop_dbus_properties_skeleton_handle_get_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezOrgFreedesktopDBusPropertiesSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_properties_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_org_freedesktop_dbus_properties_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GVariant * variant, + GError ** error, gpointer user_data) +{ + BluezOrgFreedesktopDBusPropertiesSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_properties_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_org_freedesktop_dbus_properties_skeleton_vtable = { + _bluez_org_freedesktop_dbus_properties_skeleton_handle_method_call, + _bluez_org_freedesktop_dbus_properties_skeleton_handle_get_property, + _bluez_org_freedesktop_dbus_properties_skeleton_handle_set_property, + { NULL } +}; + +static GDBusInterfaceInfo * +bluez_org_freedesktop_dbus_properties_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_org_freedesktop_dbus_properties_interface_info(); +} + +static GDBusInterfaceVTable * +bluez_org_freedesktop_dbus_properties_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_org_freedesktop_dbus_properties_skeleton_vtable; +} + +static GVariant * bluez_org_freedesktop_dbus_properties_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezOrgFreedesktopDBusPropertiesSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_org_freedesktop_dbus_properties_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_org_freedesktop_dbus_properties_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_org_freedesktop_dbus_properties_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_org_freedesktop_dbus_properties_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.freedesktop.DBus.Properties", + info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static void bluez_org_freedesktop_dbus_properties_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) {} + +static void _bluez_org_freedesktop_dbus_properties_on_signal_properties_changed(BluezOrgFreedesktopDBusProperties * object, + const gchar * arg_interface, + GVariant * arg_changed_properties, + const gchar * const * arg_invalidated_properties) +{ + BluezOrgFreedesktopDBusPropertiesSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON(object); + + GList *connections, *l; + GVariant * signal_variant; + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + + signal_variant = + g_variant_ref_sink(g_variant_new("(s@a{sv}^as)", arg_interface, arg_changed_properties, arg_invalidated_properties)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection * connection = l->data; + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.Properties", "PropertiesChanged", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); +} + +static void bluez_org_freedesktop_dbus_properties_skeleton_iface_init(BluezOrgFreedesktopDBusPropertiesIface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezOrgFreedesktopDBusPropertiesSkeleton, bluez_org_freedesktop_dbus_properties_skeleton, + G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezOrgFreedesktopDBusPropertiesSkeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES, + bluez_org_freedesktop_dbus_properties_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezOrgFreedesktopDBusPropertiesSkeleton, bluez_org_freedesktop_dbus_properties_skeleton, + G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES, + bluez_org_freedesktop_dbus_properties_skeleton_iface_init)) + +#endif +static void bluez_org_freedesktop_dbus_properties_skeleton_finalize(GObject * object) +{ + BluezOrgFreedesktopDBusPropertiesSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON(object); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_org_freedesktop_dbus_properties_skeleton_parent_class)->finalize(object); +} + +static void bluez_org_freedesktop_dbus_properties_skeleton_init(BluezOrgFreedesktopDBusPropertiesSkeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_org_freedesktop_dbus_properties_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON, + BluezOrgFreedesktopDBusPropertiesSkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); +} + +static void bluez_org_freedesktop_dbus_properties_skeleton_class_init(BluezOrgFreedesktopDBusPropertiesSkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_org_freedesktop_dbus_properties_skeleton_finalize; + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_org_freedesktop_dbus_properties_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_org_freedesktop_dbus_properties_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_org_freedesktop_dbus_properties_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_org_freedesktop_dbus_properties_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezOrgFreedesktopDBusPropertiesSkeletonPrivate)); +#endif +} + +static void bluez_org_freedesktop_dbus_properties_skeleton_iface_init(BluezOrgFreedesktopDBusPropertiesIface * iface) +{ + iface->properties_changed = _bluez_org_freedesktop_dbus_properties_on_signal_properties_changed; +} + +/** + * bluez_org_freedesktop_dbus_properties_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.freedesktop.DBus.Properties. + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusPropertiesSkeleton): The skeleton object. + */ +BluezOrgFreedesktopDBusProperties * bluez_org_freedesktop_dbus_properties_skeleton_new(void) +{ + return BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES(g_object_new(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.bluez.ProfileManager1 + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezProfileManager1 + * @title: BluezProfileManager1 + * @short_description: Generated C code for the org.bluez.ProfileManager1 D-Bus interface + * + * This section contains code for working with the org.bluez.ProfileManager1 D-Bus interface in C. + */ + +/* ---- Introspection data for org.bluez.ProfileManager1 ---- */ + +static const _ExtendedGDBusArgInfo _bluez_profile_manager1_method_info_register_profile_IN_ARG_profile = { + { -1, (gchar *) "profile", (gchar *) "o", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_profile_manager1_method_info_register_profile_IN_ARG_UUID = { + { -1, (gchar *) "UUID", (gchar *) "s", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_profile_manager1_method_info_register_profile_IN_ARG_options = { + { -1, (gchar *) "options", (gchar *) "a{sv}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_profile_manager1_method_info_register_profile_IN_ARG_pointers[] = { + &_bluez_profile_manager1_method_info_register_profile_IN_ARG_profile.parent_struct, + &_bluez_profile_manager1_method_info_register_profile_IN_ARG_UUID.parent_struct, + &_bluez_profile_manager1_method_info_register_profile_IN_ARG_options.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_profile_manager1_method_info_register_profile = { + { -1, (gchar *) "RegisterProfile", (GDBusArgInfo **) &_bluez_profile_manager1_method_info_register_profile_IN_ARG_pointers, + NULL, NULL }, + "handle-register-profile", + FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_profile_manager1_method_info_unregister_profile_IN_ARG_profile = { + { -1, (gchar *) "profile", (gchar *) "o", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_profile_manager1_method_info_unregister_profile_IN_ARG_pointers[] = { + &_bluez_profile_manager1_method_info_unregister_profile_IN_ARG_profile.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_profile_manager1_method_info_unregister_profile = { + { -1, (gchar *) "UnregisterProfile", (GDBusArgInfo **) &_bluez_profile_manager1_method_info_unregister_profile_IN_ARG_pointers, + NULL, NULL }, + "handle-unregister-profile", + FALSE +}; + +static const GDBusMethodInfo * const _bluez_profile_manager1_method_info_pointers[] = { + &_bluez_profile_manager1_method_info_register_profile.parent_struct, + &_bluez_profile_manager1_method_info_unregister_profile.parent_struct, NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_profile_manager1_interface_info = { + { -1, (gchar *) "org.bluez.ProfileManager1", (GDBusMethodInfo **) &_bluez_profile_manager1_method_info_pointers, NULL, NULL, + NULL }, + "profile-manager1", +}; + +/** + * bluez_profile_manager1_interface_info: + * + * Gets a machine-readable description of the org.bluez.ProfileManager1 D-Bus interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_profile_manager1_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_profile_manager1_interface_info.parent_struct; +} + +/** + * bluez_profile_manager1_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezProfileManager1 interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_profile_manager1_override_properties(GObjectClass * klass, guint property_id_begin) +{ + return property_id_begin - 1; +} + +/** + * BluezProfileManager1: + * + * Abstract interface type for the D-Bus interface org.bluez.ProfileManager1. + */ + +/** + * BluezProfileManager1Iface: + * @parent_iface: The parent interface. + * @handle_register_profile: Handler for the #BluezProfileManager1::handle-register-profile signal. + * @handle_unregister_profile: Handler for the #BluezProfileManager1::handle-unregister-profile signal. + * + * Virtual table for the D-Bus interface org.bluez.ProfileManager1. + */ + +typedef BluezProfileManager1Iface BluezProfileManager1Interface; +G_DEFINE_INTERFACE(BluezProfileManager1, bluez_profile_manager1, G_TYPE_OBJECT) + +static void bluez_profile_manager1_default_init(BluezProfileManager1Iface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezProfileManager1::handle-register-profile: + * @object: A #BluezProfileManager1. + * @invocation: A #GDBusMethodInvocation. + * @arg_profile: Argument passed by remote caller. + * @arg_UUID: Argument passed by remote caller. + * @arg_options: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the RegisterProfile() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_profile_manager1_complete_register_profile() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-register-profile", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezProfileManager1Iface, handle_register_profile), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 4, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_VARIANT); + + /** + * BluezProfileManager1::handle-unregister-profile: + * @object: A #BluezProfileManager1. + * @invocation: A #GDBusMethodInvocation. + * @arg_profile: Argument passed by remote caller. + * + * Signal emitted when a remote caller is invoking the UnregisterProfile() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_profile_manager1_complete_unregister_profile() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-unregister-profile", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezProfileManager1Iface, handle_unregister_profile), g_signal_accumulator_true_handled, NULL, + g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 2, G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING); +} + +/** + * bluez_profile_manager1_call_register_profile: + * @proxy: A #BluezProfileManager1Proxy. + * @arg_profile: Argument to pass with the method invocation. + * @arg_UUID: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the RegisterProfile() D-Bus + * method on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are + * calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_profile_manager1_call_register_profile_finish() to get the result of the operation. + * + * See bluez_profile_manager1_call_register_profile_sync() for the synchronous, blocking version of this method. + */ +void bluez_profile_manager1_call_register_profile(BluezProfileManager1 * proxy, const gchar * arg_profile, const gchar * arg_UUID, + GVariant * arg_options, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "RegisterProfile", g_variant_new("(os@a{sv})", arg_profile, arg_UUID, arg_options), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); +} + +/** + * bluez_profile_manager1_call_register_profile_finish: + * @proxy: A #BluezProfileManager1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_profile_manager1_call_register_profile(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_profile_manager1_call_register_profile(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_profile_manager1_call_register_profile_finish(BluezProfileManager1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_profile_manager1_call_register_profile_sync: + * @proxy: A #BluezProfileManager1Proxy. + * @arg_profile: Argument to pass with the method invocation. + * @arg_UUID: Argument to pass with the method invocation. + * @arg_options: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the RegisterProfile() D-Bus + * method on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_profile_manager1_call_register_profile() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_profile_manager1_call_register_profile_sync(BluezProfileManager1 * proxy, const gchar * arg_profile, + const gchar * arg_UUID, GVariant * arg_options, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "RegisterProfile", + g_variant_new("(os@a{sv})", arg_profile, arg_UUID, arg_options), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_profile_manager1_call_unregister_profile: + * @proxy: A #BluezProfileManager1Proxy. + * @arg_profile: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the UnregisterProfile() + * D-Bus method on @proxy. When the operation is finished, @callback will be invoked in the thread-default main loop of the thread + * you are calling this method from (see g_main_context_push_thread_default()). You can then call + * bluez_profile_manager1_call_unregister_profile_finish() to get the result of the operation. + * + * See bluez_profile_manager1_call_unregister_profile_sync() for the synchronous, blocking version of this method. + */ +void bluez_profile_manager1_call_unregister_profile(BluezProfileManager1 * proxy, const gchar * arg_profile, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "UnregisterProfile", g_variant_new("(o)", arg_profile), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, callback, user_data); +} + +/** + * bluez_profile_manager1_call_unregister_profile_finish: + * @proxy: A #BluezProfileManager1Proxy. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_profile_manager1_call_unregister_profile(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_profile_manager1_call_unregister_profile(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_profile_manager1_call_unregister_profile_finish(BluezProfileManager1 * proxy, GAsyncResult * res, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_profile_manager1_call_unregister_profile_sync: + * @proxy: A #BluezProfileManager1Proxy. + * @arg_profile: Argument to pass with the method invocation. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the UnregisterProfile() + * D-Bus method on @proxy. The calling thread is blocked until a reply is received. + * + * See bluez_profile_manager1_call_unregister_profile() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_profile_manager1_call_unregister_profile_sync(BluezProfileManager1 * proxy, const gchar * arg_profile, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "UnregisterProfile", g_variant_new("(o)", arg_profile), + G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "()"); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_profile_manager1_complete_register_profile: + * @object: A #BluezProfileManager1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the RegisterProfile() D-Bus method. If you instead want to + * finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_profile_manager1_complete_register_profile(BluezProfileManager1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/** + * bluez_profile_manager1_complete_unregister_profile: + * @object: A #BluezProfileManager1. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * + * Helper function used in service implementations to finish handling invocations of the UnregisterProfile() D-Bus method. If you instead want + * to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_profile_manager1_complete_unregister_profile(BluezProfileManager1 * object, GDBusMethodInvocation * invocation) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("()")); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezProfileManager1Proxy: + * + * The #BluezProfileManager1Proxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezProfileManager1ProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezProfileManager1Proxy. + */ + +struct _BluezProfileManager1ProxyPrivate +{ + GData * qdata; +}; + +static void bluez_profile_manager1_proxy_iface_init(BluezProfileManager1Iface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezProfileManager1Proxy, bluez_profile_manager1_proxy, G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezProfileManager1Proxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_PROFILE_MANAGER1, bluez_profile_manager1_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezProfileManager1Proxy, bluez_profile_manager1_proxy, G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_PROFILE_MANAGER1, bluez_profile_manager1_proxy_iface_init)) + +#endif +static void bluez_profile_manager1_proxy_finalize(GObject * object) +{ + BluezProfileManager1Proxy * proxy = BLUEZ_PROFILE_MANAGER1_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_profile_manager1_proxy_parent_class)->finalize(object); +} + +static void bluez_profile_manager1_proxy_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{} + +static void bluez_profile_manager1_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{} + +static void bluez_profile_manager1_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, + const gchar * signal_name, GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_profile_manager1_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_PROFILE_MANAGER1); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_PROFILE_MANAGER1); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_profile_manager1_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezProfileManager1Proxy * proxy = BLUEZ_PROFILE_MANAGER1_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_profile_manager1_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_profile_manager1_interface_info.parent_struct, invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static void bluez_profile_manager1_proxy_init(BluezProfileManager1Proxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_profile_manager1_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_PROFILE_MANAGER1_PROXY, BluezProfileManager1ProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_profile_manager1_interface_info()); +} + +static void bluez_profile_manager1_proxy_class_init(BluezProfileManager1ProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_profile_manager1_proxy_finalize; + gobject_class->get_property = bluez_profile_manager1_proxy_get_property; + gobject_class->set_property = bluez_profile_manager1_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_profile_manager1_proxy_g_signal; + proxy_class->g_properties_changed = bluez_profile_manager1_proxy_g_properties_changed; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezProfileManager1ProxyPrivate)); +#endif +} + +static void bluez_profile_manager1_proxy_iface_init(BluezProfileManager1Iface * iface) {} + +/** + * bluez_profile_manager1_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.bluez.ProfileManager1. See g_dbus_proxy_new() for more + * details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_profile_manager1_proxy_new_finish() to get the + * result of the operation. + * + * See bluez_profile_manager1_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_profile_manager1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_PROFILE_MANAGER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.bluez.ProfileManager1", NULL); +} + +/** + * bluez_profile_manager1_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_profile_manager1_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_profile_manager1_proxy_new(). + * + * Returns: (transfer full) (type BluezProfileManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezProfileManager1 * bluez_profile_manager1_proxy_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_PROFILE_MANAGER1(ret); + else + return NULL; +} + +/** + * bluez_profile_manager1_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.bluez.ProfileManager1. See g_dbus_proxy_new_sync() for + * more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_profile_manager1_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezProfileManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezProfileManager1 * bluez_profile_manager1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_PROFILE_MANAGER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", + connection, "g-object-path", object_path, "g-interface-name", "org.bluez.ProfileManager1", NULL); + if (ret != NULL) + return BLUEZ_PROFILE_MANAGER1(ret); + else + return NULL; +} + +/** + * bluez_profile_manager1_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_profile_manager1_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_profile_manager1_proxy_new_for_bus_finish() to + * get the result of the operation. + * + * See bluez_profile_manager1_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_profile_manager1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_PROFILE_MANAGER1_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", + flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", + "org.bluez.ProfileManager1", NULL); +} + +/** + * bluez_profile_manager1_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_profile_manager1_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_profile_manager1_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezProfileManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezProfileManager1 * bluez_profile_manager1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_PROFILE_MANAGER1(ret); + else + return NULL; +} + +/** + * bluez_profile_manager1_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_profile_manager1_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_profile_manager1_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezProfileManager1Proxy): The constructed proxy object or %NULL if @error is set. + */ +BluezProfileManager1 * bluez_profile_manager1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_PROFILE_MANAGER1_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", + bus_type, "g-object-path", object_path, "g-interface-name", "org.bluez.ProfileManager1", NULL); + if (ret != NULL) + return BLUEZ_PROFILE_MANAGER1(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezProfileManager1Skeleton: + * + * The #BluezProfileManager1Skeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezProfileManager1SkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezProfileManager1Skeleton. + */ + +struct _BluezProfileManager1SkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_profile_manager1_skeleton_handle_method_call(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name, const gchar * method_name, + GVariant * parameters, GDBusMethodInvocation * invocation, + gpointer user_data) +{ + BluezProfileManager1Skeleton * skeleton = BLUEZ_PROFILE_MANAGER1_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_PROFILE_MANAGER1); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_PROFILE_MANAGER1); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_profile_manager1_skeleton_handle_get_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezProfileManager1Skeleton * skeleton = BLUEZ_PROFILE_MANAGER1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_profile_manager1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_profile_manager1_skeleton_handle_set_property(GDBusConnection * connection G_GNUC_UNUSED, + const gchar * sender G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, + const gchar * property_name, GVariant * variant, + GError ** error, gpointer user_data) +{ + BluezProfileManager1Skeleton * skeleton = BLUEZ_PROFILE_MANAGER1_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_profile_manager1_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_profile_manager1_skeleton_vtable = { _bluez_profile_manager1_skeleton_handle_method_call, + _bluez_profile_manager1_skeleton_handle_get_property, + _bluez_profile_manager1_skeleton_handle_set_property, + { NULL } }; + +static GDBusInterfaceInfo * bluez_profile_manager1_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_profile_manager1_interface_info(); +} + +static GDBusInterfaceVTable * +bluez_profile_manager1_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_profile_manager1_skeleton_vtable; +} + +static GVariant * bluez_profile_manager1_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezProfileManager1Skeleton * skeleton = BLUEZ_PROFILE_MANAGER1_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_profile_manager1_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_profile_manager1_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_profile_manager1_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_profile_manager1_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), "org.bluez.ProfileManager1", + info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static void bluez_profile_manager1_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) {} + +static void bluez_profile_manager1_skeleton_iface_init(BluezProfileManager1Iface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezProfileManager1Skeleton, bluez_profile_manager1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezProfileManager1Skeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_PROFILE_MANAGER1, bluez_profile_manager1_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezProfileManager1Skeleton, bluez_profile_manager1_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_PROFILE_MANAGER1, bluez_profile_manager1_skeleton_iface_init)) + +#endif +static void bluez_profile_manager1_skeleton_finalize(GObject * object) +{ + BluezProfileManager1Skeleton * skeleton = BLUEZ_PROFILE_MANAGER1_SKELETON(object); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_profile_manager1_skeleton_parent_class)->finalize(object); +} + +static void bluez_profile_manager1_skeleton_init(BluezProfileManager1Skeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_profile_manager1_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = + G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_PROFILE_MANAGER1_SKELETON, BluezProfileManager1SkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); +} + +static void bluez_profile_manager1_skeleton_class_init(BluezProfileManager1SkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_profile_manager1_skeleton_finalize; + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_profile_manager1_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_profile_manager1_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_profile_manager1_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_profile_manager1_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezProfileManager1SkeletonPrivate)); +#endif +} + +static void bluez_profile_manager1_skeleton_iface_init(BluezProfileManager1Iface * iface) {} + +/** + * bluez_profile_manager1_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.bluez.ProfileManager1. + * + * Returns: (transfer full) (type BluezProfileManager1Skeleton): The skeleton object. + */ +BluezProfileManager1 * bluez_profile_manager1_skeleton_new(void) +{ + return BLUEZ_PROFILE_MANAGER1(g_object_new(BLUEZ_TYPE_PROFILE_MANAGER1_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for interface org.freedesktop.DBus.ObjectManager + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezOrgFreedesktopDBusObjectManager + * @title: BluezOrgFreedesktopDBusObjectManager + * @short_description: Generated C code for the org.freedesktop.DBus.ObjectManager D-Bus interface + * + * This section contains code for working with the org.freedesktop.DBus.ObjectManager D-Bus + * interface in C. + */ + +/* ---- Introspection data for org.freedesktop.DBus.ObjectManager ---- */ + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_object_manager_method_info_get_managed_objects_OUT_ARG_objects = { + { -1, (gchar *) "objects", (gchar *) "a{oa{sa{sv}}}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_org_freedesktop_dbus_object_manager_method_info_get_managed_objects_OUT_ARG_pointers[] = { + &_bluez_org_freedesktop_dbus_object_manager_method_info_get_managed_objects_OUT_ARG_objects.parent_struct, NULL +}; + +static const _ExtendedGDBusMethodInfo _bluez_org_freedesktop_dbus_object_manager_method_info_get_managed_objects = { + { -1, (gchar *) "GetManagedObjects", NULL, + (GDBusArgInfo **) &_bluez_org_freedesktop_dbus_object_manager_method_info_get_managed_objects_OUT_ARG_pointers, NULL }, + "handle-get-managed-objects", + FALSE +}; + +static const GDBusMethodInfo * const _bluez_org_freedesktop_dbus_object_manager_method_info_pointers[] = { + &_bluez_org_freedesktop_dbus_object_manager_method_info_get_managed_objects.parent_struct, NULL +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_added_ARG_object = { + { -1, (gchar *) "object", (gchar *) "o", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_added_ARG_interfaces = { + { -1, (gchar *) "interfaces", (gchar *) "a{sa{sv}}", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_added_ARG_pointers[] = { + &_bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_added_ARG_object.parent_struct, + &_bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_added_ARG_interfaces.parent_struct, NULL +}; + +static const _ExtendedGDBusSignalInfo _bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_added = { + { -1, (gchar *) "InterfacesAdded", + (GDBusArgInfo **) &_bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_added_ARG_pointers, NULL }, + "interfaces-added" +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_removed_ARG_object = { + { -1, (gchar *) "object", (gchar *) "o", NULL }, FALSE +}; + +static const _ExtendedGDBusArgInfo _bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_removed_ARG_interfaces = { + { -1, (gchar *) "interfaces", (gchar *) "as", NULL }, FALSE +}; + +static const GDBusArgInfo * const _bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_removed_ARG_pointers[] = { + &_bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_removed_ARG_object.parent_struct, + &_bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_removed_ARG_interfaces.parent_struct, NULL +}; + +static const _ExtendedGDBusSignalInfo _bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_removed = { + { -1, (gchar *) "InterfacesRemoved", + (GDBusArgInfo **) &_bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_removed_ARG_pointers, NULL }, + "interfaces-removed" +}; + +static const GDBusSignalInfo * const _bluez_org_freedesktop_dbus_object_manager_signal_info_pointers[] = { + &_bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_added.parent_struct, + &_bluez_org_freedesktop_dbus_object_manager_signal_info_interfaces_removed.parent_struct, NULL +}; + +static const _ExtendedGDBusInterfaceInfo _bluez_org_freedesktop_dbus_object_manager_interface_info = { + { -1, (gchar *) "org.freedesktop.DBus.ObjectManager", + (GDBusMethodInfo **) &_bluez_org_freedesktop_dbus_object_manager_method_info_pointers, + (GDBusSignalInfo **) &_bluez_org_freedesktop_dbus_object_manager_signal_info_pointers, NULL, NULL }, + "org-freedesktop-dbus-object-manager", +}; + +/** + * bluez_org_freedesktop_dbus_object_manager_interface_info: + * + * Gets a machine-readable description of the org.freedesktop.DBus.ObjectManager D-Bus + * interface. + * + * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. + */ +GDBusInterfaceInfo * bluez_org_freedesktop_dbus_object_manager_interface_info(void) +{ + return (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_object_manager_interface_info.parent_struct; +} + +/** + * bluez_org_freedesktop_dbus_object_manager_override_properties: + * @klass: The class structure for a #GObject derived class. + * @property_id_begin: The property id to assign to the first overridden property. + * + * Overrides all #GObject properties in the #BluezOrgFreedesktopDBusObjectManager interface for a concrete class. + * The properties are overridden in the order they are defined. + * + * Returns: The last property id. + */ +guint bluez_org_freedesktop_dbus_object_manager_override_properties(GObjectClass * klass, guint property_id_begin) +{ + return property_id_begin - 1; +} + +/** + * BluezOrgFreedesktopDBusObjectManager: + * + * Abstract interface type for the D-Bus interface org.freedesktop.DBus.ObjectManager. + */ + +/** + * BluezOrgFreedesktopDBusObjectManagerIface: + * @parent_iface: The parent interface. + * @handle_get_managed_objects: Handler for the #BluezOrgFreedesktopDBusObjectManager::handle-get-managed-objects signal. + * @interfaces_added: Handler for the #BluezOrgFreedesktopDBusObjectManager::interfaces-added signal. + * @interfaces_removed: Handler for the #BluezOrgFreedesktopDBusObjectManager::interfaces-removed signal. + * + * Virtual table for the D-Bus interface org.freedesktop.DBus.ObjectManager. + */ + +typedef BluezOrgFreedesktopDBusObjectManagerIface BluezOrgFreedesktopDBusObjectManagerInterface; +G_DEFINE_INTERFACE(BluezOrgFreedesktopDBusObjectManager, bluez_org_freedesktop_dbus_object_manager, G_TYPE_OBJECT) + +static void bluez_org_freedesktop_dbus_object_manager_default_init(BluezOrgFreedesktopDBusObjectManagerIface * iface) +{ + /* GObject signals for incoming D-Bus method calls: */ + /** + * BluezOrgFreedesktopDBusObjectManager::handle-get-managed-objects: + * @object: A #BluezOrgFreedesktopDBusObjectManager. + * @invocation: A #GDBusMethodInvocation. + * + * Signal emitted when a remote caller is invoking the GetManagedObjects() D-Bus method. + * + * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to + * @invocation and eventually call bluez_org_freedesktop_dbus_object_manager_complete_get_managed_objects() or e.g. + * g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the + * invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned. + * + * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run. + */ + g_signal_new("handle-get-managed-objects", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezOrgFreedesktopDBusObjectManagerIface, handle_get_managed_objects), + g_signal_accumulator_true_handled, NULL, g_cclosure_marshal_generic, G_TYPE_BOOLEAN, 1, + G_TYPE_DBUS_METHOD_INVOCATION); + + /* GObject signals for received D-Bus signals: */ + /** + * BluezOrgFreedesktopDBusObjectManager::interfaces-added: + * @object: A #BluezOrgFreedesktopDBusObjectManager. + * @arg_object: Argument. + * @arg_interfaces: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "InterfacesAdded" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new("interfaces-added", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezOrgFreedesktopDBusObjectManagerIface, interfaces_added), NULL, NULL, + g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); + + /** + * BluezOrgFreedesktopDBusObjectManager::interfaces-removed: + * @object: A #BluezOrgFreedesktopDBusObjectManager. + * @arg_object: Argument. + * @arg_interfaces: Argument. + * + * On the client-side, this signal is emitted whenever the D-Bus signal "InterfacesRemoved" is received. + * + * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal. + */ + g_signal_new("interfaces-removed", G_TYPE_FROM_INTERFACE(iface), G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(BluezOrgFreedesktopDBusObjectManagerIface, interfaces_removed), NULL, NULL, + g_cclosure_marshal_generic, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRV); +} + +/** + * bluez_org_freedesktop_dbus_object_manager_emit_interfaces_added: + * @object: A #BluezOrgFreedesktopDBusObjectManager. + * @arg_object: Argument to pass with the signal. + * @arg_interfaces: Argument to pass with the signal. + * + * Emits the "InterfacesAdded" D-Bus signal. + */ +void bluez_org_freedesktop_dbus_object_manager_emit_interfaces_added(BluezOrgFreedesktopDBusObjectManager * object, + const gchar * arg_object, GVariant * arg_interfaces) +{ + g_signal_emit_by_name(object, "interfaces-added", arg_object, arg_interfaces); +} + +/** + * bluez_org_freedesktop_dbus_object_manager_emit_interfaces_removed: + * @object: A #BluezOrgFreedesktopDBusObjectManager. + * @arg_object: Argument to pass with the signal. + * @arg_interfaces: Argument to pass with the signal. + * + * Emits the "InterfacesRemoved" D-Bus + * signal. + */ +void bluez_org_freedesktop_dbus_object_manager_emit_interfaces_removed(BluezOrgFreedesktopDBusObjectManager * object, + const gchar * arg_object, + const gchar * const * arg_interfaces) +{ + g_signal_emit_by_name(object, "interfaces-removed", arg_object, arg_interfaces); +} + +/** + * bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects: + * @proxy: A #BluezOrgFreedesktopDBusObjectManagerProxy. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL. + * @user_data: User data to pass to @callback. + * + * Asynchronously invokes the GetManagedObjects() D-Bus method on @proxy. + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call + * bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects_finish() to get the result of the operation. + * + * See bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects_sync() for the synchronous, blocking version of this + * method. + */ +void bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects(BluezOrgFreedesktopDBusObjectManager * proxy, + GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_dbus_proxy_call(G_DBUS_PROXY(proxy), "GetManagedObjects", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, + callback, user_data); +} + +/** + * bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects_finish: + * @proxy: A #BluezOrgFreedesktopDBusObjectManagerProxy. + * @out_objects: (out) (optional): Return location for return parameter or %NULL to ignore. + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to + * bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects(). + * @error: Return location for error or %NULL. + * + * Finishes an operation started with bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects(). + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects_finish(BluezOrgFreedesktopDBusObjectManager * proxy, + GVariant ** out_objects, GAsyncResult * res, + GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@a{oa{sa{sv}}})", out_objects); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects_sync: + * @proxy: A #BluezOrgFreedesktopDBusObjectManagerProxy. + * @out_objects: (out) (optional): Return location for return parameter or %NULL to ignore. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL. + * + * Synchronously invokes the GetManagedObjects() D-Bus method on @proxy. + * The calling thread is blocked until a reply is received. + * + * See bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects() for the asynchronous version of this method. + * + * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set. + */ +gboolean bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects_sync(BluezOrgFreedesktopDBusObjectManager * proxy, + GVariant ** out_objects, + GCancellable * cancellable, GError ** error) +{ + GVariant * _ret; + _ret = g_dbus_proxy_call_sync(G_DBUS_PROXY(proxy), "GetManagedObjects", g_variant_new("()"), G_DBUS_CALL_FLAGS_NONE, -1, + cancellable, error); + if (_ret == NULL) + goto _out; + g_variant_get(_ret, "(@a{oa{sa{sv}}})", out_objects); + g_variant_unref(_ret); +_out: + return _ret != NULL; +} + +/** + * bluez_org_freedesktop_dbus_object_manager_complete_get_managed_objects: + * @object: A #BluezOrgFreedesktopDBusObjectManager. + * @invocation: (transfer full): A #GDBusMethodInvocation. + * @objects: Parameter to return. + * + * Helper function used in service implementations to finish handling invocations of the GetManagedObjects() D-Bus method. If you + * instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar. + * + * This method will free @invocation, you cannot use it afterwards. + */ +void bluez_org_freedesktop_dbus_object_manager_complete_get_managed_objects(BluezOrgFreedesktopDBusObjectManager * object, + GDBusMethodInvocation * invocation, GVariant * objects) +{ + g_dbus_method_invocation_return_value(invocation, g_variant_new("(@a{oa{sa{sv}}})", objects)); +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezOrgFreedesktopDBusObjectManagerProxy: + * + * The #BluezOrgFreedesktopDBusObjectManagerProxy structure contains only private data and should only be accessed using the + * provided API. + */ + +/** + * BluezOrgFreedesktopDBusObjectManagerProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezOrgFreedesktopDBusObjectManagerProxy. + */ + +struct _BluezOrgFreedesktopDBusObjectManagerProxyPrivate +{ + GData * qdata; +}; + +static void bluez_org_freedesktop_dbus_object_manager_proxy_iface_init(BluezOrgFreedesktopDBusObjectManagerIface * iface); + +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezOrgFreedesktopDBusObjectManagerProxy, bluez_org_freedesktop_dbus_object_manager_proxy, + G_TYPE_DBUS_PROXY, + G_ADD_PRIVATE(BluezOrgFreedesktopDBusObjectManagerProxy) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER, + bluez_org_freedesktop_dbus_object_manager_proxy_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezOrgFreedesktopDBusObjectManagerProxy, bluez_org_freedesktop_dbus_object_manager_proxy, + G_TYPE_DBUS_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER, + bluez_org_freedesktop_dbus_object_manager_proxy_iface_init)) + +#endif +static void bluez_org_freedesktop_dbus_object_manager_proxy_finalize(GObject * object) +{ + BluezOrgFreedesktopDBusObjectManagerProxy * proxy = BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY(object); + g_datalist_clear(&proxy->priv->qdata); + G_OBJECT_CLASS(bluez_org_freedesktop_dbus_object_manager_proxy_parent_class)->finalize(object); +} + +static void bluez_org_freedesktop_dbus_object_manager_proxy_get_property(GObject * object, guint prop_id, GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{} + +static void bluez_org_freedesktop_dbus_object_manager_proxy_set_property(GObject * object, guint prop_id, const GValue * value, + GParamSpec * pspec G_GNUC_UNUSED) +{} + +static void bluez_org_freedesktop_dbus_object_manager_proxy_g_signal(GDBusProxy * proxy, const gchar * sender_name G_GNUC_UNUSED, + const gchar * signal_name, GVariant * parameters) +{ + _ExtendedGDBusSignalInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + gsize n; + guint signal_id; + info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_object_manager_interface_info.parent_struct, signal_name); + if (info == NULL) + return; + num_params = g_variant_n_children(parameters); + paramv = g_new0(GValue, num_params + 1); + g_value_init(¶mv[0], BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER); + g_value_set_object(¶mv[0], proxy); + g_variant_iter_init(&iter, parameters); + n = 1; + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER); + g_signal_emitv(paramv, signal_id, 0, NULL); + for (n = 0; n < num_params + 1; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static void bluez_org_freedesktop_dbus_object_manager_proxy_g_properties_changed(GDBusProxy * _proxy, GVariant * changed_properties, + const gchar * const * invalidated_properties) +{ + BluezOrgFreedesktopDBusObjectManagerProxy * proxy = BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY(_proxy); + guint n; + const gchar * key; + GVariantIter * iter; + _ExtendedGDBusPropertyInfo * info; + g_variant_get(changed_properties, "a{sv}", &iter); + while (g_variant_iter_next(iter, "{&sv}", &key, NULL)) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_object_manager_interface_info.parent_struct, key); + g_datalist_remove_data(&proxy->priv->qdata, key); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } + g_variant_iter_free(iter); + for (n = 0; invalidated_properties[n] != NULL; n++) + { + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_object_manager_interface_info.parent_struct, + invalidated_properties[n]); + g_datalist_remove_data(&proxy->priv->qdata, invalidated_properties[n]); + if (info != NULL) + g_object_notify(G_OBJECT(proxy), info->hyphen_name); + } +} + +static void bluez_org_freedesktop_dbus_object_manager_proxy_init(BluezOrgFreedesktopDBusObjectManagerProxy * proxy) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + proxy->priv = bluez_org_freedesktop_dbus_object_manager_proxy_get_instance_private(proxy); +#else + proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE(proxy, BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY, + BluezOrgFreedesktopDBusObjectManagerProxyPrivate); +#endif + + g_dbus_proxy_set_interface_info(G_DBUS_PROXY(proxy), bluez_org_freedesktop_dbus_object_manager_interface_info()); +} + +static void bluez_org_freedesktop_dbus_object_manager_proxy_class_init(BluezOrgFreedesktopDBusObjectManagerProxyClass * klass) +{ + GObjectClass * gobject_class; + GDBusProxyClass * proxy_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_org_freedesktop_dbus_object_manager_proxy_finalize; + gobject_class->get_property = bluez_org_freedesktop_dbus_object_manager_proxy_get_property; + gobject_class->set_property = bluez_org_freedesktop_dbus_object_manager_proxy_set_property; + + proxy_class = G_DBUS_PROXY_CLASS(klass); + proxy_class->g_signal = bluez_org_freedesktop_dbus_object_manager_proxy_g_signal; + proxy_class->g_properties_changed = bluez_org_freedesktop_dbus_object_manager_proxy_g_properties_changed; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezOrgFreedesktopDBusObjectManagerProxyPrivate)); +#endif +} + +static void bluez_org_freedesktop_dbus_object_manager_proxy_iface_init(BluezOrgFreedesktopDBusObjectManagerIface * iface) {} + +/** + * bluez_org_freedesktop_dbus_object_manager_proxy_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates a proxy for the D-Bus interface org.freedesktop.DBus.ObjectManager. See + * g_dbus_proxy_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call + * bluez_org_freedesktop_dbus_object_manager_proxy_new_finish() to get the result of the operation. + * + * See bluez_org_freedesktop_dbus_object_manager_proxy_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_org_freedesktop_dbus_object_manager_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, + user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", + object_path, "g-interface-name", "org.freedesktop.DBus.ObjectManager", NULL); +} + +/** + * bluez_org_freedesktop_dbus_object_manager_proxy_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_org_freedesktop_dbus_object_manager_proxy_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_org_freedesktop_dbus_object_manager_proxy_new(). + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusObjectManagerProxy): The constructed proxy object or %NULL if @error is + * set. + */ +BluezOrgFreedesktopDBusObjectManager * bluez_org_freedesktop_dbus_object_manager_proxy_new_finish(GAsyncResult * res, + GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(ret); + else + return NULL; +} + +/** + * bluez_org_freedesktop_dbus_object_manager_proxy_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates a proxy for the D-Bus interface org.freedesktop.DBus.ObjectManager. See + * g_dbus_proxy_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_org_freedesktop_dbus_object_manager_proxy_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusObjectManagerProxy): The constructed proxy object or %NULL if @error is + * set. + */ +BluezOrgFreedesktopDBusObjectManager * +bluez_org_freedesktop_dbus_object_manager_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, + "g-connection", connection, "g-object-path", object_path, "g-interface-name", + "org.freedesktop.DBus.ObjectManager", NULL); + if (ret != NULL) + return BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(ret); + else + return NULL; +} + +/** + * bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_org_freedesktop_dbus_object_manager_proxy_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call + * bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus_finish() to get the result of the operation. + * + * See bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, + user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, + "g-interface-name", "org.freedesktop.DBus.ObjectManager", NULL); +} + +/** + * bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to + * bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus(). + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusObjectManagerProxy): The constructed proxy object or %NULL if @error is + * set. + */ +BluezOrgFreedesktopDBusObjectManager * bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus_finish(GAsyncResult * res, + GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(ret); + else + return NULL; +} + +/** + * bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusProxyFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_org_freedesktop_dbus_object_manager_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusObjectManagerProxy): The constructed proxy object or %NULL if @error is + * set. + */ +BluezOrgFreedesktopDBusObjectManager * +bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, + "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", + "org.freedesktop.DBus.ObjectManager", NULL); + if (ret != NULL) + return BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(ret); + else + return NULL; +} + +/* ------------------------------------------------------------------------ */ + +/** + * BluezOrgFreedesktopDBusObjectManagerSkeleton: + * + * The #BluezOrgFreedesktopDBusObjectManagerSkeleton structure contains only private data and should only be accessed using the + * provided API. + */ + +/** + * BluezOrgFreedesktopDBusObjectManagerSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezOrgFreedesktopDBusObjectManagerSkeleton. + */ + +struct _BluezOrgFreedesktopDBusObjectManagerSkeletonPrivate +{ + GValue * properties; + GList * changed_properties; + GSource * changed_properties_idle_source; + GMainContext * context; + GMutex lock; +}; + +static void _bluez_org_freedesktop_dbus_object_manager_skeleton_handle_method_call( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name, const gchar * method_name, GVariant * parameters, GDBusMethodInvocation * invocation, + gpointer user_data) +{ + BluezOrgFreedesktopDBusObjectManagerSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON(user_data); + _ExtendedGDBusMethodInfo * info; + GVariantIter iter; + GVariant * child; + GValue * paramv; + gsize num_params; + guint num_extra; + gsize n; + guint signal_id; + GValue return_value = G_VALUE_INIT; + info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info(invocation); + g_assert(info != NULL); + num_params = g_variant_n_children(parameters); + num_extra = info->pass_fdlist ? 3 : 2; + paramv = g_new0(GValue, num_params + num_extra); + n = 0; + g_value_init(¶mv[n], BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER); + g_value_set_object(¶mv[n++], skeleton); + g_value_init(¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION); + g_value_set_object(¶mv[n++], invocation); + if (info->pass_fdlist) + { +#ifdef G_OS_UNIX + g_value_init(¶mv[n], G_TYPE_UNIX_FD_LIST); + g_value_set_object(¶mv[n++], g_dbus_message_get_unix_fd_list(g_dbus_method_invocation_get_message(invocation))); +#else + g_assert_not_reached(); +#endif + } + g_variant_iter_init(&iter, parameters); + while ((child = g_variant_iter_next_value(&iter)) != NULL) + { + _ExtendedGDBusArgInfo * arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra]; + if (arg_info->use_gvariant) + { + g_value_init(¶mv[n], G_TYPE_VARIANT); + g_value_set_variant(¶mv[n], child); + n++; + } + else + g_dbus_gvariant_to_gvalue(child, ¶mv[n++]); + g_variant_unref(child); + } + signal_id = g_signal_lookup(info->signal_name, BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER); + g_value_init(&return_value, G_TYPE_BOOLEAN); + g_signal_emitv(paramv, signal_id, 0, &return_value); + if (!g_value_get_boolean(&return_value)) + g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, + "Method %s is not implemented on interface %s", method_name, interface_name); + g_value_unset(&return_value); + for (n = 0; n < num_params + num_extra; n++) + g_value_unset(¶mv[n]); + g_free(paramv); +} + +static GVariant * _bluez_org_freedesktop_dbus_object_manager_skeleton_handle_get_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GError ** error, gpointer user_data) +{ + BluezOrgFreedesktopDBusObjectManagerSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + GVariant * ret; + ret = NULL; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_object_manager_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + g_value_init(&value, pspec->value_type); + g_object_get_property(G_OBJECT(skeleton), info->hyphen_name, &value); + ret = g_dbus_gvalue_to_gvariant(&value, G_VARIANT_TYPE(info->parent_struct.signature)); + g_value_unset(&value); + } + return ret; +} + +static gboolean _bluez_org_freedesktop_dbus_object_manager_skeleton_handle_set_property( + GDBusConnection * connection G_GNUC_UNUSED, const gchar * sender G_GNUC_UNUSED, const gchar * object_path G_GNUC_UNUSED, + const gchar * interface_name G_GNUC_UNUSED, const gchar * property_name, GVariant * variant, GError ** error, + gpointer user_data) +{ + BluezOrgFreedesktopDBusObjectManagerSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON(user_data); + GValue value = G_VALUE_INIT; + GParamSpec * pspec; + _ExtendedGDBusPropertyInfo * info; + gboolean ret; + ret = FALSE; + info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property( + (GDBusInterfaceInfo *) &_bluez_org_freedesktop_dbus_object_manager_interface_info.parent_struct, property_name); + g_assert(info != NULL); + pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(skeleton), info->hyphen_name); + if (pspec == NULL) + { + g_set_error(error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name); + } + else + { + if (info->use_gvariant) + g_value_set_variant(&value, variant); + else + g_dbus_gvariant_to_gvalue(variant, &value); + g_object_set_property(G_OBJECT(skeleton), info->hyphen_name, &value); + g_value_unset(&value); + ret = TRUE; + } + return ret; +} + +static const GDBusInterfaceVTable _bluez_org_freedesktop_dbus_object_manager_skeleton_vtable = { + _bluez_org_freedesktop_dbus_object_manager_skeleton_handle_method_call, + _bluez_org_freedesktop_dbus_object_manager_skeleton_handle_get_property, + _bluez_org_freedesktop_dbus_object_manager_skeleton_handle_set_property, + { NULL } +}; + +static GDBusInterfaceInfo * +bluez_org_freedesktop_dbus_object_manager_skeleton_dbus_interface_get_info(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return bluez_org_freedesktop_dbus_object_manager_interface_info(); +} + +static GDBusInterfaceVTable * +bluez_org_freedesktop_dbus_object_manager_skeleton_dbus_interface_get_vtable(GDBusInterfaceSkeleton * skeleton G_GNUC_UNUSED) +{ + return (GDBusInterfaceVTable *) &_bluez_org_freedesktop_dbus_object_manager_skeleton_vtable; +} + +static GVariant * +bluez_org_freedesktop_dbus_object_manager_skeleton_dbus_interface_get_properties(GDBusInterfaceSkeleton * _skeleton) +{ + BluezOrgFreedesktopDBusObjectManagerSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON(_skeleton); + + GVariantBuilder builder; + guint n; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a{sv}")); + if (_bluez_org_freedesktop_dbus_object_manager_interface_info.parent_struct.properties == NULL) + goto out; + for (n = 0; _bluez_org_freedesktop_dbus_object_manager_interface_info.parent_struct.properties[n] != NULL; n++) + { + GDBusPropertyInfo * info = _bluez_org_freedesktop_dbus_object_manager_interface_info.parent_struct.properties[n]; + if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE) + { + GVariant * value; + value = _bluez_org_freedesktop_dbus_object_manager_skeleton_handle_get_property( + g_dbus_interface_skeleton_get_connection(G_DBUS_INTERFACE_SKELETON(skeleton)), NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.ObjectManager", info->name, NULL, skeleton); + if (value != NULL) + { + g_variant_take_ref(value); + g_variant_builder_add(&builder, "{sv}", info->name, value); + g_variant_unref(value); + } + } + } +out: + return g_variant_builder_end(&builder); +} + +static void bluez_org_freedesktop_dbus_object_manager_skeleton_dbus_interface_flush(GDBusInterfaceSkeleton * _skeleton) {} + +static void _bluez_org_freedesktop_dbus_object_manager_on_signal_interfaces_added(BluezOrgFreedesktopDBusObjectManager * object, + const gchar * arg_object, + GVariant * arg_interfaces) +{ + BluezOrgFreedesktopDBusObjectManagerSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON(object); + + GList *connections, *l; + GVariant * signal_variant; + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + + signal_variant = g_variant_ref_sink(g_variant_new("(o@a{sa{sv}})", arg_object, arg_interfaces)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection * connection = l->data; + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.ObjectManager", "InterfacesAdded", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); +} + +static void _bluez_org_freedesktop_dbus_object_manager_on_signal_interfaces_removed(BluezOrgFreedesktopDBusObjectManager * object, + const gchar * arg_object, + const gchar * const * arg_interfaces) +{ + BluezOrgFreedesktopDBusObjectManagerSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON(object); + + GList *connections, *l; + GVariant * signal_variant; + connections = g_dbus_interface_skeleton_get_connections(G_DBUS_INTERFACE_SKELETON(skeleton)); + + signal_variant = g_variant_ref_sink(g_variant_new("(o^as)", arg_object, arg_interfaces)); + for (l = connections; l != NULL; l = l->next) + { + GDBusConnection * connection = l->data; + g_dbus_connection_emit_signal(connection, NULL, + g_dbus_interface_skeleton_get_object_path(G_DBUS_INTERFACE_SKELETON(skeleton)), + "org.freedesktop.DBus.ObjectManager", "InterfacesRemoved", signal_variant, NULL); + } + g_variant_unref(signal_variant); + g_list_free_full(connections, g_object_unref); +} + +static void bluez_org_freedesktop_dbus_object_manager_skeleton_iface_init(BluezOrgFreedesktopDBusObjectManagerIface * iface); +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 +G_DEFINE_TYPE_WITH_CODE(BluezOrgFreedesktopDBusObjectManagerSkeleton, bluez_org_freedesktop_dbus_object_manager_skeleton, + G_TYPE_DBUS_INTERFACE_SKELETON, + G_ADD_PRIVATE(BluezOrgFreedesktopDBusObjectManagerSkeleton) + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER, + bluez_org_freedesktop_dbus_object_manager_skeleton_iface_init)) + +#else +G_DEFINE_TYPE_WITH_CODE(BluezOrgFreedesktopDBusObjectManagerSkeleton, bluez_org_freedesktop_dbus_object_manager_skeleton, + G_TYPE_DBUS_INTERFACE_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER, + bluez_org_freedesktop_dbus_object_manager_skeleton_iface_init)) + +#endif +static void bluez_org_freedesktop_dbus_object_manager_skeleton_finalize(GObject * object) +{ + BluezOrgFreedesktopDBusObjectManagerSkeleton * skeleton = BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON(object); + g_list_free_full(skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free); + if (skeleton->priv->changed_properties_idle_source != NULL) + g_source_destroy(skeleton->priv->changed_properties_idle_source); + g_main_context_unref(skeleton->priv->context); + g_mutex_clear(&skeleton->priv->lock); + G_OBJECT_CLASS(bluez_org_freedesktop_dbus_object_manager_skeleton_parent_class)->finalize(object); +} + +static void bluez_org_freedesktop_dbus_object_manager_skeleton_init(BluezOrgFreedesktopDBusObjectManagerSkeleton * skeleton) +{ +#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38 + skeleton->priv = bluez_org_freedesktop_dbus_object_manager_skeleton_get_instance_private(skeleton); +#else + skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE(skeleton, BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON, + BluezOrgFreedesktopDBusObjectManagerSkeletonPrivate); +#endif + + g_mutex_init(&skeleton->priv->lock); + skeleton->priv->context = g_main_context_ref_thread_default(); +} + +static void bluez_org_freedesktop_dbus_object_manager_skeleton_class_init(BluezOrgFreedesktopDBusObjectManagerSkeletonClass * klass) +{ + GObjectClass * gobject_class; + GDBusInterfaceSkeletonClass * skeleton_class; + + gobject_class = G_OBJECT_CLASS(klass); + gobject_class->finalize = bluez_org_freedesktop_dbus_object_manager_skeleton_finalize; + + skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS(klass); + skeleton_class->get_info = bluez_org_freedesktop_dbus_object_manager_skeleton_dbus_interface_get_info; + skeleton_class->get_properties = bluez_org_freedesktop_dbus_object_manager_skeleton_dbus_interface_get_properties; + skeleton_class->flush = bluez_org_freedesktop_dbus_object_manager_skeleton_dbus_interface_flush; + skeleton_class->get_vtable = bluez_org_freedesktop_dbus_object_manager_skeleton_dbus_interface_get_vtable; + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 + g_type_class_add_private(klass, sizeof(BluezOrgFreedesktopDBusObjectManagerSkeletonPrivate)); +#endif +} + +static void bluez_org_freedesktop_dbus_object_manager_skeleton_iface_init(BluezOrgFreedesktopDBusObjectManagerIface * iface) +{ + iface->interfaces_added = _bluez_org_freedesktop_dbus_object_manager_on_signal_interfaces_added; + iface->interfaces_removed = _bluez_org_freedesktop_dbus_object_manager_on_signal_interfaces_removed; +} + +/** + * bluez_org_freedesktop_dbus_object_manager_skeleton_new: + * + * Creates a skeleton object for the D-Bus interface org.freedesktop.DBus.ObjectManager. + * + * Returns: (transfer full) (type BluezOrgFreedesktopDBusObjectManagerSkeleton): The skeleton object. + */ +BluezOrgFreedesktopDBusObjectManager * bluez_org_freedesktop_dbus_object_manager_skeleton_new(void) +{ + return BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(g_object_new(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON, NULL)); +} + +/* ------------------------------------------------------------------------ + * Code for Object, ObjectProxy and ObjectSkeleton + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezObject + * @title: BluezObject + * @short_description: Specialized GDBusObject types + * + * This section contains the #BluezObject, #BluezObjectProxy, and #BluezObjectSkeleton types which make it easier to work with + * objects implementing generated types for D-Bus interfaces. + */ + +/** + * BluezObject: + * + * The #BluezObject type is a specialized container of interfaces. + */ + +/** + * BluezObjectIface: + * @parent_iface: The parent interface. + * + * Virtual table for the #BluezObject interface. + */ + +typedef BluezObjectIface BluezObjectInterface; +G_DEFINE_INTERFACE_WITH_CODE(BluezObject, bluez_object, G_TYPE_OBJECT, + g_type_interface_add_prerequisite(g_define_type_id, G_TYPE_DBUS_OBJECT);) + +static void bluez_object_default_init(BluezObjectIface * iface) +{ + /** + * BluezObject:adapter1: + * + * The #BluezAdapter1 instance corresponding to the D-Bus interface org.bluez.Adapter1, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property( + iface, + g_param_spec_object("adapter1", "adapter1", "adapter1", BLUEZ_TYPE_ADAPTER1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:device1: + * + * The #BluezDevice1 instance corresponding to the D-Bus interface org.bluez.Device1, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property( + iface, + g_param_spec_object("device1", "device1", "device1", BLUEZ_TYPE_DEVICE1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:gatt-manager1: + * + * The #BluezGattManager1 instance corresponding to the D-Bus interface org.bluez.GattManager1, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property(iface, + g_param_spec_object("gatt-manager1", "gatt-manager1", "gatt-manager1", + BLUEZ_TYPE_GATT_MANAGER1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:gatt-service1: + * + * The #BluezGattService1 instance corresponding to the D-Bus interface org.bluez.GattService1, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property(iface, + g_param_spec_object("gatt-service1", "gatt-service1", "gatt-service1", + BLUEZ_TYPE_GATT_SERVICE1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:gatt-characteristic1: + * + * The #BluezGattCharacteristic1 instance corresponding to the D-Bus interface org.bluez.GattCharacteristic1, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property(iface, + g_param_spec_object("gatt-characteristic1", "gatt-characteristic1", "gatt-characteristic1", + BLUEZ_TYPE_GATT_CHARACTERISTIC1, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:gatt-descriptor1: + * + * The #BluezGattDescriptor1 instance corresponding to the D-Bus interface org.bluez.GattDescriptor1, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property(iface, + g_param_spec_object("gatt-descriptor1", "gatt-descriptor1", "gatt-descriptor1", + BLUEZ_TYPE_GATT_DESCRIPTOR1, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:leadvertisement1: + * + * The #BluezLEAdvertisement1 instance corresponding to the D-Bus interface org.bluez.LEAdvertisement1, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property(iface, + g_param_spec_object("leadvertisement1", "leadvertisement1", "leadvertisement1", + BLUEZ_TYPE_LEADVERTISEMENT1, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:leadvertising-manager1: + * + * The #BluezLEAdvertisingManager1 instance corresponding to the D-Bus interface org.bluez.LEAdvertisingManager1, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property(iface, + g_param_spec_object("leadvertising-manager1", "leadvertising-manager1", + "leadvertising-manager1", BLUEZ_TYPE_LEADVERTISING_MANAGER1, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:org-freedesktop-dbus-properties: + * + * The #BluezOrgFreedesktopDBusProperties instance corresponding to the D-Bus interface org.freedesktop.DBus.Properties, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property( + iface, + g_param_spec_object("org-freedesktop-dbus-properties", "org-freedesktop-dbus-properties", "org-freedesktop-dbus-properties", + BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:profile-manager1: + * + * The #BluezProfileManager1 instance corresponding to the D-Bus interface org.bluez.ProfileManager1, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property(iface, + g_param_spec_object("profile-manager1", "profile-manager1", "profile-manager1", + BLUEZ_TYPE_PROFILE_MANAGER1, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** + * BluezObject:org-freedesktop-dbus-object-manager: + * + * The #BluezOrgFreedesktopDBusObjectManager instance corresponding to the D-Bus interface org.freedesktop.DBus.ObjectManager, if any. + * + * Connect to the #GObject::notify signal to get informed of property changes. + */ + g_object_interface_install_property( + iface, + g_param_spec_object("org-freedesktop-dbus-object-manager", "org-freedesktop-dbus-object-manager", + "org-freedesktop-dbus-object-manager", BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +} + +/** + * bluez_object_get_adapter1: + * @object: A #BluezObject. + * + * Gets the #BluezAdapter1 instance for the D-Bus interface org.bluez.Adapter1 on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezAdapter1 that must be freed with g_object_unref() or %NULL if @object does not + * implement the interface. + */ +BluezAdapter1 * bluez_object_get_adapter1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.Adapter1"); + if (ret == NULL) + return NULL; + return BLUEZ_ADAPTER1(ret); +} + +/** + * bluez_object_get_device1: + * @object: A #BluezObject. + * + * Gets the #BluezDevice1 instance for the D-Bus interface org.bluez.Device1 on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezDevice1 that must be freed with g_object_unref() or %NULL if @object does not + * implement the interface. + */ +BluezDevice1 * bluez_object_get_device1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.Device1"); + if (ret == NULL) + return NULL; + return BLUEZ_DEVICE1(ret); +} + +/** + * bluez_object_get_gatt_manager1: + * @object: A #BluezObject. + * + * Gets the #BluezGattManager1 instance for the D-Bus interface org.bluez.GattManager1 on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezGattManager1 that must be freed with g_object_unref() or %NULL if @object does not + * implement the interface. + */ +BluezGattManager1 * bluez_object_get_gatt_manager1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattManager1"); + if (ret == NULL) + return NULL; + return BLUEZ_GATT_MANAGER1(ret); +} + +/** + * bluez_object_get_gatt_service1: + * @object: A #BluezObject. + * + * Gets the #BluezGattService1 instance for the D-Bus interface org.bluez.GattService1 on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezGattService1 that must be freed with g_object_unref() or %NULL if @object does not + * implement the interface. + */ +BluezGattService1 * bluez_object_get_gatt_service1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattService1"); + if (ret == NULL) + return NULL; + return BLUEZ_GATT_SERVICE1(ret); +} + +/** + * bluez_object_get_gatt_characteristic1: + * @object: A #BluezObject. + * + * Gets the #BluezGattCharacteristic1 instance for the D-Bus interface org.bluez.GattCharacteristic1 on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezGattCharacteristic1 that must be freed with g_object_unref() or %NULL if @object + * does not implement the interface. + */ +BluezGattCharacteristic1 * bluez_object_get_gatt_characteristic1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattCharacteristic1"); + if (ret == NULL) + return NULL; + return BLUEZ_GATT_CHARACTERISTIC1(ret); +} + +/** + * bluez_object_get_gatt_descriptor1: + * @object: A #BluezObject. + * + * Gets the #BluezGattDescriptor1 instance for the D-Bus interface org.bluez.GattDescriptor1 on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezGattDescriptor1 that must be freed with g_object_unref() or %NULL if @object does + * not implement the interface. + */ +BluezGattDescriptor1 * bluez_object_get_gatt_descriptor1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattDescriptor1"); + if (ret == NULL) + return NULL; + return BLUEZ_GATT_DESCRIPTOR1(ret); +} + +/** + * bluez_object_get_leadvertisement1: + * @object: A #BluezObject. + * + * Gets the #BluezLEAdvertisement1 instance for the D-Bus interface org.bluez.LEAdvertisement1 on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezLEAdvertisement1 that must be freed with g_object_unref() or %NULL if @object does + * not implement the interface. + */ +BluezLEAdvertisement1 * bluez_object_get_leadvertisement1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.LEAdvertisement1"); + if (ret == NULL) + return NULL; + return BLUEZ_LEADVERTISEMENT1(ret); +} + +/** + * bluez_object_get_leadvertising_manager1: + * @object: A #BluezObject. + * + * Gets the #BluezLEAdvertisingManager1 instance for the D-Bus interface org.bluez.LEAdvertisingManager1 on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezLEAdvertisingManager1 that must be freed with g_object_unref() or %NULL if @object + * does not implement the interface. + */ +BluezLEAdvertisingManager1 * bluez_object_get_leadvertising_manager1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.LEAdvertisingManager1"); + if (ret == NULL) + return NULL; + return BLUEZ_LEADVERTISING_MANAGER1(ret); +} + +/** + * bluez_object_get_org_freedesktop_dbus_properties: + * @object: A #BluezObject. + * + * Gets the #BluezOrgFreedesktopDBusProperties instance for the D-Bus interface org.freedesktop.DBus.Properties on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezOrgFreedesktopDBusProperties that must be freed with g_object_unref() or %NULL if + * @object does not implement the interface. + */ +BluezOrgFreedesktopDBusProperties * bluez_object_get_org_freedesktop_dbus_properties(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.freedesktop.DBus.Properties"); + if (ret == NULL) + return NULL; + return BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES(ret); +} + +/** + * bluez_object_get_profile_manager1: + * @object: A #BluezObject. + * + * Gets the #BluezProfileManager1 instance for the D-Bus interface org.bluez.ProfileManager1 on @object, if any. + * + * Returns: (transfer full) (nullable): A #BluezProfileManager1 that must be freed with g_object_unref() or %NULL if @object does + * not implement the interface. + */ +BluezProfileManager1 * bluez_object_get_profile_manager1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.ProfileManager1"); + if (ret == NULL) + return NULL; + return BLUEZ_PROFILE_MANAGER1(ret); +} + +/** + * bluez_object_get_org_freedesktop_dbus_object_manager: + * @object: A #BluezObject. + * + * Gets the #BluezOrgFreedesktopDBusObjectManager instance for the D-Bus interface org.freedesktop.DBus.ObjectManager on @object, if + * any. + * + * Returns: (transfer full) (nullable): A #BluezOrgFreedesktopDBusObjectManager that must be freed with g_object_unref() or %NULL if + * @object does not implement the interface. + */ +BluezOrgFreedesktopDBusObjectManager * bluez_object_get_org_freedesktop_dbus_object_manager(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.freedesktop.DBus.ObjectManager"); + if (ret == NULL) + return NULL; + return BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(ret); +} + +/** + * bluez_object_peek_adapter1: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_adapter1() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezAdapter1 or %NULL if @object does not implement the interface. Do not free the + * returned object, it is owned by @object. + */ +BluezAdapter1 * bluez_object_peek_adapter1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.Adapter1"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_ADAPTER1(ret); +} + +/** + * bluez_object_peek_device1: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_device1() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezDevice1 or %NULL if @object does not implement the interface. Do not free the + * returned object, it is owned by @object. + */ +BluezDevice1 * bluez_object_peek_device1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.Device1"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_DEVICE1(ret); +} + +/** + * bluez_object_peek_gatt_manager1: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_gatt_manager1() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezGattManager1 or %NULL if @object does not implement the interface. Do not free the + * returned object, it is owned by @object. + */ +BluezGattManager1 * bluez_object_peek_gatt_manager1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattManager1"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_GATT_MANAGER1(ret); +} + +/** + * bluez_object_peek_gatt_service1: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_gatt_service1() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezGattService1 or %NULL if @object does not implement the interface. Do not free the + * returned object, it is owned by @object. + */ +BluezGattService1 * bluez_object_peek_gatt_service1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattService1"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_GATT_SERVICE1(ret); +} + +/** + * bluez_object_peek_gatt_characteristic1: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_gatt_characteristic1() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezGattCharacteristic1 or %NULL if @object does not implement the interface. Do not + * free the returned object, it is owned by @object. + */ +BluezGattCharacteristic1 * bluez_object_peek_gatt_characteristic1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattCharacteristic1"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_GATT_CHARACTERISTIC1(ret); +} + +/** + * bluez_object_peek_gatt_descriptor1: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_gatt_descriptor1() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezGattDescriptor1 or %NULL if @object does not implement the interface. Do not free + * the returned object, it is owned by @object. + */ +BluezGattDescriptor1 * bluez_object_peek_gatt_descriptor1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattDescriptor1"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_GATT_DESCRIPTOR1(ret); +} + +/** + * bluez_object_peek_leadvertisement1: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_leadvertisement1() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezLEAdvertisement1 or %NULL if @object does not implement the interface. Do not free + * the returned object, it is owned by @object. + */ +BluezLEAdvertisement1 * bluez_object_peek_leadvertisement1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.LEAdvertisement1"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_LEADVERTISEMENT1(ret); +} + +/** + * bluez_object_peek_leadvertising_manager1: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_leadvertising_manager1() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezLEAdvertisingManager1 or %NULL if @object does not implement the interface. Do not + * free the returned object, it is owned by @object. + */ +BluezLEAdvertisingManager1 * bluez_object_peek_leadvertising_manager1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.LEAdvertisingManager1"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_LEADVERTISING_MANAGER1(ret); +} + +/** + * bluez_object_peek_org_freedesktop_dbus_properties: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_org_freedesktop_dbus_properties() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezOrgFreedesktopDBusProperties or %NULL if @object does not implement the interface. + * Do not free the returned object, it is owned by @object. + */ +BluezOrgFreedesktopDBusProperties * bluez_object_peek_org_freedesktop_dbus_properties(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.freedesktop.DBus.Properties"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES(ret); +} + +/** + * bluez_object_peek_profile_manager1: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_profile_manager1() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezProfileManager1 or %NULL if @object does not implement the interface. Do not free + * the returned object, it is owned by @object. + */ +BluezProfileManager1 * bluez_object_peek_profile_manager1(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.ProfileManager1"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_PROFILE_MANAGER1(ret); +} + +/** + * bluez_object_peek_org_freedesktop_dbus_object_manager: (skip) + * @object: A #BluezObject. + * + * Like bluez_object_get_org_freedesktop_dbus_object_manager() but doesn't increase the reference count on the returned object. + * + * It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or + * #GDBusObjectManagerServer for @object is running. + * + * Returns: (transfer none) (nullable): A #BluezOrgFreedesktopDBusObjectManager or %NULL if @object does not implement the + * interface. Do not free the returned object, it is owned by @object. + */ +BluezOrgFreedesktopDBusObjectManager * bluez_object_peek_org_freedesktop_dbus_object_manager(BluezObject * object) +{ + GDBusInterface * ret; + ret = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.freedesktop.DBus.ObjectManager"); + if (ret == NULL) + return NULL; + g_object_unref(ret); + return BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(ret); +} + +static void bluez_object_notify(GDBusObject * object, GDBusInterface * interface) +{ + _ExtendedGDBusInterfaceInfo * info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info(interface); + /* info can be NULL if the other end is using a D-Bus interface we don't know + * anything about, for example old generated code in this process talking to + * newer generated code in the other process. */ + if (info != NULL) + g_object_notify(G_OBJECT(object), info->hyphen_name); +} + +/** + * BluezObjectProxy: + * + * The #BluezObjectProxy structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezObjectProxyClass: + * @parent_class: The parent class. + * + * Class structure for #BluezObjectProxy. + */ + +static void bluez_object_proxy__bluez_object_iface_init(BluezObjectIface * iface G_GNUC_UNUSED) {} + +static void bluez_object_proxy__g_dbus_object_iface_init(GDBusObjectIface * iface) +{ + iface->interface_added = bluez_object_notify; + iface->interface_removed = bluez_object_notify; +} + +G_DEFINE_TYPE_WITH_CODE(BluezObjectProxy, bluez_object_proxy, G_TYPE_DBUS_OBJECT_PROXY, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_OBJECT, bluez_object_proxy__bluez_object_iface_init) + G_IMPLEMENT_INTERFACE(G_TYPE_DBUS_OBJECT, bluez_object_proxy__g_dbus_object_iface_init)) + +static void bluez_object_proxy_init(BluezObjectProxy * object G_GNUC_UNUSED) {} + +static void bluez_object_proxy_set_property(GObject * gobject, guint prop_id, const GValue * value G_GNUC_UNUSED, + GParamSpec * pspec) +{ + G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); +} + +static void bluez_object_proxy_get_property(GObject * gobject, guint prop_id, GValue * value, GParamSpec * pspec) +{ + BluezObjectProxy * object = BLUEZ_OBJECT_PROXY(gobject); + GDBusInterface * interface; + + switch (prop_id) + { + case 1: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.Adapter1"); + g_value_take_object(value, interface); + break; + + case 2: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.Device1"); + g_value_take_object(value, interface); + break; + + case 3: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattManager1"); + g_value_take_object(value, interface); + break; + + case 4: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattService1"); + g_value_take_object(value, interface); + break; + + case 5: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattCharacteristic1"); + g_value_take_object(value, interface); + break; + + case 6: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattDescriptor1"); + g_value_take_object(value, interface); + break; + + case 7: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.LEAdvertisement1"); + g_value_take_object(value, interface); + break; + + case 8: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.LEAdvertisingManager1"); + g_value_take_object(value, interface); + break; + + case 9: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.freedesktop.DBus.Properties"); + g_value_take_object(value, interface); + break; + + case 10: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.ProfileManager1"); + g_value_take_object(value, interface); + break; + + case 11: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.freedesktop.DBus.ObjectManager"); + g_value_take_object(value, interface); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); + break; + } +} + +static void bluez_object_proxy_class_init(BluezObjectProxyClass * klass) +{ + GObjectClass * gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->set_property = bluez_object_proxy_set_property; + gobject_class->get_property = bluez_object_proxy_get_property; + + g_object_class_override_property(gobject_class, 1, "adapter1"); + g_object_class_override_property(gobject_class, 2, "device1"); + g_object_class_override_property(gobject_class, 3, "gatt-manager1"); + g_object_class_override_property(gobject_class, 4, "gatt-service1"); + g_object_class_override_property(gobject_class, 5, "gatt-characteristic1"); + g_object_class_override_property(gobject_class, 6, "gatt-descriptor1"); + g_object_class_override_property(gobject_class, 7, "leadvertisement1"); + g_object_class_override_property(gobject_class, 8, "leadvertising-manager1"); + g_object_class_override_property(gobject_class, 9, "org-freedesktop-dbus-properties"); + g_object_class_override_property(gobject_class, 10, "profile-manager1"); + g_object_class_override_property(gobject_class, 11, "org-freedesktop-dbus-object-manager"); +} + +/** + * bluez_object_proxy_new: + * @connection: A #GDBusConnection. + * @object_path: An object path. + * + * Creates a new proxy object. + * + * Returns: (transfer full): The proxy object. + */ +BluezObjectProxy * bluez_object_proxy_new(GDBusConnection * connection, const gchar * object_path) +{ + g_return_val_if_fail(G_IS_DBUS_CONNECTION(connection), NULL); + g_return_val_if_fail(g_variant_is_object_path(object_path), NULL); + return BLUEZ_OBJECT_PROXY( + g_object_new(BLUEZ_TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL)); +} + +/** + * BluezObjectSkeleton: + * + * The #BluezObjectSkeleton structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezObjectSkeletonClass: + * @parent_class: The parent class. + * + * Class structure for #BluezObjectSkeleton. + */ + +static void bluez_object_skeleton__bluez_object_iface_init(BluezObjectIface * iface G_GNUC_UNUSED) {} + +static void bluez_object_skeleton__g_dbus_object_iface_init(GDBusObjectIface * iface) +{ + iface->interface_added = bluez_object_notify; + iface->interface_removed = bluez_object_notify; +} + +G_DEFINE_TYPE_WITH_CODE(BluezObjectSkeleton, bluez_object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON, + G_IMPLEMENT_INTERFACE(BLUEZ_TYPE_OBJECT, bluez_object_skeleton__bluez_object_iface_init) + G_IMPLEMENT_INTERFACE(G_TYPE_DBUS_OBJECT, bluez_object_skeleton__g_dbus_object_iface_init)) + +static void bluez_object_skeleton_init(BluezObjectSkeleton * object G_GNUC_UNUSED) {} + +static void bluez_object_skeleton_set_property(GObject * gobject, guint prop_id, const GValue * value, GParamSpec * pspec) +{ + BluezObjectSkeleton * object = BLUEZ_OBJECT_SKELETON(gobject); + GDBusInterfaceSkeleton * interface; + + switch (prop_id) + { + case 1: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_ADAPTER1(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.bluez.Adapter1"); + } + break; + + case 2: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_DEVICE1(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.bluez.Device1"); + } + break; + + case 3: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_GATT_MANAGER1(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.bluez.GattManager1"); + } + break; + + case 4: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_GATT_SERVICE1(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.bluez.GattService1"); + } + break; + + case 5: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_GATT_CHARACTERISTIC1(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.bluez.GattCharacteristic1"); + } + break; + + case 6: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_GATT_DESCRIPTOR1(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.bluez.GattDescriptor1"); + } + break; + + case 7: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_LEADVERTISEMENT1(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.bluez.LEAdvertisement1"); + } + break; + + case 8: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_LEADVERTISING_MANAGER1(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.bluez.LEAdvertisingManager1"); + } + break; + + case 9: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_ORG_FREEDESKTOP_DBUS_PROPERTIES(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.freedesktop.DBus.Properties"); + } + break; + + case 10: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_PROFILE_MANAGER1(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.bluez.ProfileManager1"); + } + break; + + case 11: + interface = g_value_get_object(value); + if (interface != NULL) + { + g_warn_if_fail(BLUEZ_IS_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(interface)); + g_dbus_object_skeleton_add_interface(G_DBUS_OBJECT_SKELETON(object), interface); + } + else + { + g_dbus_object_skeleton_remove_interface_by_name(G_DBUS_OBJECT_SKELETON(object), "org.freedesktop.DBus.ObjectManager"); + } + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); + break; + } +} + +static void bluez_object_skeleton_get_property(GObject * gobject, guint prop_id, GValue * value, GParamSpec * pspec) +{ + BluezObjectSkeleton * object = BLUEZ_OBJECT_SKELETON(gobject); + GDBusInterface * interface; + + switch (prop_id) + { + case 1: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.Adapter1"); + g_value_take_object(value, interface); + break; + + case 2: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.Device1"); + g_value_take_object(value, interface); + break; + + case 3: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattManager1"); + g_value_take_object(value, interface); + break; + + case 4: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattService1"); + g_value_take_object(value, interface); + break; + + case 5: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattCharacteristic1"); + g_value_take_object(value, interface); + break; + + case 6: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.GattDescriptor1"); + g_value_take_object(value, interface); + break; + + case 7: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.LEAdvertisement1"); + g_value_take_object(value, interface); + break; + + case 8: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.LEAdvertisingManager1"); + g_value_take_object(value, interface); + break; + + case 9: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.freedesktop.DBus.Properties"); + g_value_take_object(value, interface); + break; + + case 10: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.bluez.ProfileManager1"); + g_value_take_object(value, interface); + break; + + case 11: + interface = g_dbus_object_get_interface(G_DBUS_OBJECT(object), "org.freedesktop.DBus.ObjectManager"); + g_value_take_object(value, interface); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); + break; + } +} + +static void bluez_object_skeleton_class_init(BluezObjectSkeletonClass * klass) +{ + GObjectClass * gobject_class = G_OBJECT_CLASS(klass); + + gobject_class->set_property = bluez_object_skeleton_set_property; + gobject_class->get_property = bluez_object_skeleton_get_property; + + g_object_class_override_property(gobject_class, 1, "adapter1"); + g_object_class_override_property(gobject_class, 2, "device1"); + g_object_class_override_property(gobject_class, 3, "gatt-manager1"); + g_object_class_override_property(gobject_class, 4, "gatt-service1"); + g_object_class_override_property(gobject_class, 5, "gatt-characteristic1"); + g_object_class_override_property(gobject_class, 6, "gatt-descriptor1"); + g_object_class_override_property(gobject_class, 7, "leadvertisement1"); + g_object_class_override_property(gobject_class, 8, "leadvertising-manager1"); + g_object_class_override_property(gobject_class, 9, "org-freedesktop-dbus-properties"); + g_object_class_override_property(gobject_class, 10, "profile-manager1"); + g_object_class_override_property(gobject_class, 11, "org-freedesktop-dbus-object-manager"); +} + +/** + * bluez_object_skeleton_new: + * @object_path: An object path. + * + * Creates a new skeleton object. + * + * Returns: (transfer full): The skeleton object. + */ +BluezObjectSkeleton * bluez_object_skeleton_new(const gchar * object_path) +{ + g_return_val_if_fail(g_variant_is_object_path(object_path), NULL); + return BLUEZ_OBJECT_SKELETON(g_object_new(BLUEZ_TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL)); +} + +/** + * bluez_object_skeleton_set_adapter1: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezAdapter1 or %NULL to clear the interface. + * + * Sets the #BluezAdapter1 instance for the D-Bus interface org.bluez.Adapter1 on @object. + */ +void bluez_object_skeleton_set_adapter1(BluezObjectSkeleton * object, BluezAdapter1 * interface_) +{ + g_object_set(G_OBJECT(object), "adapter1", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_device1: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezDevice1 or %NULL to clear the interface. + * + * Sets the #BluezDevice1 instance for the D-Bus interface org.bluez.Device1 on @object. + */ +void bluez_object_skeleton_set_device1(BluezObjectSkeleton * object, BluezDevice1 * interface_) +{ + g_object_set(G_OBJECT(object), "device1", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_gatt_manager1: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezGattManager1 or %NULL to clear the interface. + * + * Sets the #BluezGattManager1 instance for the D-Bus interface org.bluez.GattManager1 on @object. + */ +void bluez_object_skeleton_set_gatt_manager1(BluezObjectSkeleton * object, BluezGattManager1 * interface_) +{ + g_object_set(G_OBJECT(object), "gatt-manager1", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_gatt_service1: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezGattService1 or %NULL to clear the interface. + * + * Sets the #BluezGattService1 instance for the D-Bus interface org.bluez.GattService1 on @object. + */ +void bluez_object_skeleton_set_gatt_service1(BluezObjectSkeleton * object, BluezGattService1 * interface_) +{ + g_object_set(G_OBJECT(object), "gatt-service1", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_gatt_characteristic1: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezGattCharacteristic1 or %NULL to clear the interface. + * + * Sets the #BluezGattCharacteristic1 instance for the D-Bus interface org.bluez.GattCharacteristic1 on @object. + */ +void bluez_object_skeleton_set_gatt_characteristic1(BluezObjectSkeleton * object, BluezGattCharacteristic1 * interface_) +{ + g_object_set(G_OBJECT(object), "gatt-characteristic1", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_gatt_descriptor1: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezGattDescriptor1 or %NULL to clear the interface. + * + * Sets the #BluezGattDescriptor1 instance for the D-Bus interface org.bluez.GattDescriptor1 on @object. + */ +void bluez_object_skeleton_set_gatt_descriptor1(BluezObjectSkeleton * object, BluezGattDescriptor1 * interface_) +{ + g_object_set(G_OBJECT(object), "gatt-descriptor1", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_leadvertisement1: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezLEAdvertisement1 or %NULL to clear the interface. + * + * Sets the #BluezLEAdvertisement1 instance for the D-Bus interface org.bluez.LEAdvertisement1 on @object. + */ +void bluez_object_skeleton_set_leadvertisement1(BluezObjectSkeleton * object, BluezLEAdvertisement1 * interface_) +{ + g_object_set(G_OBJECT(object), "leadvertisement1", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_leadvertising_manager1: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezLEAdvertisingManager1 or %NULL to clear the interface. + * + * Sets the #BluezLEAdvertisingManager1 instance for the D-Bus interface org.bluez.LEAdvertisingManager1 on @object. + */ +void bluez_object_skeleton_set_leadvertising_manager1(BluezObjectSkeleton * object, BluezLEAdvertisingManager1 * interface_) +{ + g_object_set(G_OBJECT(object), "leadvertising-manager1", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_org_freedesktop_dbus_properties: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezOrgFreedesktopDBusProperties or %NULL to clear the interface. + * + * Sets the #BluezOrgFreedesktopDBusProperties instance for the D-Bus interface org.freedesktop.DBus.Properties on @object. + */ +void bluez_object_skeleton_set_org_freedesktop_dbus_properties(BluezObjectSkeleton * object, + BluezOrgFreedesktopDBusProperties * interface_) +{ + g_object_set(G_OBJECT(object), "org-freedesktop-dbus-properties", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_profile_manager1: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezProfileManager1 or %NULL to clear the interface. + * + * Sets the #BluezProfileManager1 instance for the D-Bus interface org.bluez.ProfileManager1 on @object. + */ +void bluez_object_skeleton_set_profile_manager1(BluezObjectSkeleton * object, BluezProfileManager1 * interface_) +{ + g_object_set(G_OBJECT(object), "profile-manager1", interface_, NULL); +} + +/** + * bluez_object_skeleton_set_org_freedesktop_dbus_object_manager: + * @object: A #BluezObjectSkeleton. + * @interface_: (nullable): A #BluezOrgFreedesktopDBusObjectManager or %NULL to clear the interface. + * + * Sets the #BluezOrgFreedesktopDBusObjectManager instance for the D-Bus interface org.freedesktop.DBus.ObjectManager on @object. + */ +void bluez_object_skeleton_set_org_freedesktop_dbus_object_manager(BluezObjectSkeleton * object, + BluezOrgFreedesktopDBusObjectManager * interface_) +{ + g_object_set(G_OBJECT(object), "org-freedesktop-dbus-object-manager", interface_, NULL); +} + +/* ------------------------------------------------------------------------ + * Code for ObjectManager client + * ------------------------------------------------------------------------ + */ + +/** + * SECTION:BluezObjectManagerClient + * @title: BluezObjectManagerClient + * @short_description: Generated GDBusObjectManagerClient type + * + * This section contains a #GDBusObjectManagerClient that uses bluez_object_manager_client_get_proxy_type() as the + * #GDBusProxyTypeFunc. + */ + +/** + * BluezObjectManagerClient: + * + * The #BluezObjectManagerClient structure contains only private data and should only be accessed using the provided API. + */ + +/** + * BluezObjectManagerClientClass: + * @parent_class: The parent class. + * + * Class structure for #BluezObjectManagerClient. + */ + +G_DEFINE_TYPE(BluezObjectManagerClient, bluez_object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT) + +static void bluez_object_manager_client_init(BluezObjectManagerClient * manager G_GNUC_UNUSED) {} + +static void bluez_object_manager_client_class_init(BluezObjectManagerClientClass * klass G_GNUC_UNUSED) {} + +/** + * bluez_object_manager_client_get_proxy_type: + * @manager: A #GDBusObjectManagerClient. + * @object_path: The object path of the remote object (unused). + * @interface_name: (nullable): Interface name of the remote object or %NULL to get the object proxy #GType. + * @user_data: User data (unused). + * + * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy derived and #GDBusProxy derived types. + * + * Returns: A #GDBusProxy derived #GType if @interface_name is not %NULL, otherwise the #GType for #BluezObjectProxy. + */ +GType bluez_object_manager_client_get_proxy_type(GDBusObjectManagerClient * manager G_GNUC_UNUSED, + const gchar * object_path G_GNUC_UNUSED, const gchar * interface_name, + gpointer user_data G_GNUC_UNUSED) +{ + static gsize once_init_value = 0; + static GHashTable * lookup_hash; + GType ret; + + if (interface_name == NULL) + return BLUEZ_TYPE_OBJECT_PROXY; + if (g_once_init_enter(&once_init_value)) + { + lookup_hash = g_hash_table_new(g_str_hash, g_str_equal); + g_hash_table_insert(lookup_hash, (gpointer) "org.bluez.Adapter1", GSIZE_TO_POINTER(BLUEZ_TYPE_ADAPTER1_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.bluez.Device1", GSIZE_TO_POINTER(BLUEZ_TYPE_DEVICE1_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.bluez.GattManager1", GSIZE_TO_POINTER(BLUEZ_TYPE_GATT_MANAGER1_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.bluez.GattService1", GSIZE_TO_POINTER(BLUEZ_TYPE_GATT_SERVICE1_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.bluez.GattCharacteristic1", + GSIZE_TO_POINTER(BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.bluez.GattDescriptor1", + GSIZE_TO_POINTER(BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.bluez.LEAdvertisement1", + GSIZE_TO_POINTER(BLUEZ_TYPE_LEADVERTISEMENT1_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.bluez.LEAdvertisingManager1", + GSIZE_TO_POINTER(BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.freedesktop.DBus.Properties", + GSIZE_TO_POINTER(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.bluez.ProfileManager1", + GSIZE_TO_POINTER(BLUEZ_TYPE_PROFILE_MANAGER1_PROXY)); + g_hash_table_insert(lookup_hash, (gpointer) "org.freedesktop.DBus.ObjectManager", + GSIZE_TO_POINTER(BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY)); + g_once_init_leave(&once_init_value, 1); + } + ret = (GType) GPOINTER_TO_SIZE(g_hash_table_lookup(lookup_hash, interface_name)); + if (ret == (GType) 0) + ret = G_TYPE_DBUS_PROXY; + return ret; +} + +/** + * bluez_object_manager_client_new: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Asynchronously creates #GDBusObjectManagerClient using bluez_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. + * See g_dbus_object_manager_client_new() for more details. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_object_manager_client_new_finish() to get the + * result of the operation. + * + * See bluez_object_manager_client_new_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_object_manager_client_new(GDBusConnection * connection, GDBusObjectManagerClientFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", + flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", + bluez_object_manager_client_get_proxy_type, NULL); +} + +/** + * bluez_object_manager_client_new_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_object_manager_client_new(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_object_manager_client_new(). + * + * Returns: (transfer full) (type BluezObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * bluez_object_manager_client_new_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER(ret); + else + return NULL; +} + +/** + * bluez_object_manager_client_new_sync: + * @connection: A #GDBusConnection. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection. + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Synchronously creates #GDBusObjectManagerClient using bluez_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. + * See g_dbus_object_manager_client_new_sync() for more details. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_object_manager_client_new() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * bluez_object_manager_client_new_sync(GDBusConnection * connection, GDBusObjectManagerClientFlags flags, + const gchar * name, const gchar * object_path, GCancellable * cancellable, + GError ** error) +{ + GInitable * ret; + ret = + g_initable_new(BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, + "object-path", object_path, "get-proxy-type-func", bluez_object_manager_client_get_proxy_type, NULL); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER(ret); + else + return NULL; +} + +/** + * bluez_object_manager_client_new_for_bus: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @callback: A #GAsyncReadyCallback to call when the request is satisfied. + * @user_data: User data to pass to @callback. + * + * Like bluez_object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection. + * + * When the operation is finished, @callback will be invoked in the thread-default main loop of the thread you are calling this + * method from (see g_main_context_push_thread_default()). You can then call bluez_object_manager_client_new_for_bus_finish() to get + * the result of the operation. + * + * See bluez_object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor. + */ +void bluez_object_manager_client_new_for_bus(GBusType bus_type, GDBusObjectManagerClientFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + g_async_initable_new_async(BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", + flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", + bluez_object_manager_client_get_proxy_type, NULL); +} + +/** + * bluez_object_manager_client_new_for_bus_finish: + * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to bluez_object_manager_client_new_for_bus(). + * @error: Return location for error or %NULL + * + * Finishes an operation started with bluez_object_manager_client_new_for_bus(). + * + * Returns: (transfer full) (type BluezObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * bluez_object_manager_client_new_for_bus_finish(GAsyncResult * res, GError ** error) +{ + GObject * ret; + GObject * source_object; + source_object = g_async_result_get_source_object(res); + ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, error); + g_object_unref(source_object); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER(ret); + else + return NULL; +} + +/** + * bluez_object_manager_client_new_for_bus_sync: + * @bus_type: A #GBusType. + * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration. + * @name: A bus name (well-known or unique). + * @object_path: An object path. + * @cancellable: (nullable): A #GCancellable or %NULL. + * @error: Return location for error or %NULL + * + * Like bluez_object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection. + * + * The calling thread is blocked until a reply is received. + * + * See bluez_object_manager_client_new_for_bus() for the asynchronous version of this constructor. + * + * Returns: (transfer full) (type BluezObjectManagerClient): The constructed object manager client or %NULL if @error is set. + */ +GDBusObjectManager * bluez_object_manager_client_new_for_bus_sync(GBusType bus_type, GDBusObjectManagerClientFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error) +{ + GInitable * ret; + ret = g_initable_new(BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, + "object-path", object_path, "get-proxy-type-func", bluez_object_manager_client_get_proxy_type, NULL); + if (ret != NULL) + return G_DBUS_OBJECT_MANAGER(ret); + else + return NULL; +} diff --git a/src/platform/Linux/dbus/DbusBluez.h b/src/platform/Linux/dbus/DbusBluez.h new file mode 100644 index 00000000000000..78c021938f5cf6 --- /dev/null +++ b/src/platform/Linux/dbus/DbusBluez.h @@ -0,0 +1,2230 @@ +/* + * This file is generated by gdbus-codegen, do not modify it. + * + * The license of this code is the same as for the D-Bus interface description + * it was derived from. Note that it links to GLib, so must comply with the + * LGPL linking clauses. + */ + +#ifndef __DBUSBLUEZ_H__ +#define __DBUSBLUEZ_H__ + +#include + +G_BEGIN_DECLS + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.Adapter1 */ + +#define BLUEZ_TYPE_ADAPTER1 (bluez_adapter1_get_type()) +#define BLUEZ_ADAPTER1(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_ADAPTER1, BluezAdapter1)) +#define BLUEZ_IS_ADAPTER1(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_ADAPTER1)) +#define BLUEZ_ADAPTER1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_ADAPTER1, BluezAdapter1Iface)) + +struct _BluezAdapter1; +typedef struct _BluezAdapter1 BluezAdapter1; +typedef struct _BluezAdapter1Iface BluezAdapter1Iface; + +struct _BluezAdapter1Iface +{ + GTypeInterface parent_iface; + + gboolean (*handle_connect_device)(BluezAdapter1 * object, GDBusMethodInvocation * invocation, GVariant * arg_properties); + + gboolean (*handle_get_discovery_filters)(BluezAdapter1 * object, GDBusMethodInvocation * invocation); + + gboolean (*handle_remove_device)(BluezAdapter1 * object, GDBusMethodInvocation * invocation, const gchar * arg_device); + + gboolean (*handle_set_discovery_filter)(BluezAdapter1 * object, GDBusMethodInvocation * invocation, GVariant * arg_properties); + + gboolean (*handle_start_discovery)(BluezAdapter1 * object, GDBusMethodInvocation * invocation); + + gboolean (*handle_stop_discovery)(BluezAdapter1 * object, GDBusMethodInvocation * invocation); + + const gchar * (*get_address)(BluezAdapter1 * object); + + const gchar * (*get_address_type)(BluezAdapter1 * object); + + const gchar * (*get_alias)(BluezAdapter1 * object); + + guint (*get_class)(BluezAdapter1 * object); + + gboolean (*get_discoverable)(BluezAdapter1 * object); + + guint (*get_discoverable_timeout)(BluezAdapter1 * object); + + gboolean (*get_discovering)(BluezAdapter1 * object); + + const gchar * (*get_modalias)(BluezAdapter1 * object); + + const gchar * (*get_name)(BluezAdapter1 * object); + + gboolean (*get_pairable)(BluezAdapter1 * object); + + guint (*get_pairable_timeout)(BluezAdapter1 * object); + + gboolean (*get_powered)(BluezAdapter1 * object); + + const gchar * const * (*get_roles)(BluezAdapter1 * object); + + const gchar * const * (*get_uuids)(BluezAdapter1 * object); +}; + +GType bluez_adapter1_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_adapter1_interface_info(void); +guint bluez_adapter1_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_adapter1_complete_start_discovery(BluezAdapter1 * object, GDBusMethodInvocation * invocation); + +void bluez_adapter1_complete_set_discovery_filter(BluezAdapter1 * object, GDBusMethodInvocation * invocation); + +void bluez_adapter1_complete_stop_discovery(BluezAdapter1 * object, GDBusMethodInvocation * invocation); + +void bluez_adapter1_complete_remove_device(BluezAdapter1 * object, GDBusMethodInvocation * invocation); + +void bluez_adapter1_complete_get_discovery_filters(BluezAdapter1 * object, GDBusMethodInvocation * invocation, + const gchar * const * filters); + +void bluez_adapter1_complete_connect_device(BluezAdapter1 * object, GDBusMethodInvocation * invocation); + +/* D-Bus method calls: */ +void bluez_adapter1_call_start_discovery(BluezAdapter1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_adapter1_call_start_discovery_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_adapter1_call_start_discovery_sync(BluezAdapter1 * proxy, GCancellable * cancellable, GError ** error); + +void bluez_adapter1_call_set_discovery_filter(BluezAdapter1 * proxy, GVariant * arg_properties, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_adapter1_call_set_discovery_filter_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_adapter1_call_set_discovery_filter_sync(BluezAdapter1 * proxy, GVariant * arg_properties, GCancellable * cancellable, + GError ** error); + +void bluez_adapter1_call_stop_discovery(BluezAdapter1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_adapter1_call_stop_discovery_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_adapter1_call_stop_discovery_sync(BluezAdapter1 * proxy, GCancellable * cancellable, GError ** error); + +void bluez_adapter1_call_remove_device(BluezAdapter1 * proxy, const gchar * arg_device, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_adapter1_call_remove_device_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_adapter1_call_remove_device_sync(BluezAdapter1 * proxy, const gchar * arg_device, GCancellable * cancellable, + GError ** error); + +void bluez_adapter1_call_get_discovery_filters(BluezAdapter1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_adapter1_call_get_discovery_filters_finish(BluezAdapter1 * proxy, gchar *** out_filters, GAsyncResult * res, + GError ** error); + +gboolean bluez_adapter1_call_get_discovery_filters_sync(BluezAdapter1 * proxy, gchar *** out_filters, GCancellable * cancellable, + GError ** error); + +void bluez_adapter1_call_connect_device(BluezAdapter1 * proxy, GVariant * arg_properties, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_adapter1_call_connect_device_finish(BluezAdapter1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_adapter1_call_connect_device_sync(BluezAdapter1 * proxy, GVariant * arg_properties, GCancellable * cancellable, + GError ** error); + +/* D-Bus property accessors: */ +const gchar * bluez_adapter1_get_address(BluezAdapter1 * object); +gchar * bluez_adapter1_dup_address(BluezAdapter1 * object); +void bluez_adapter1_set_address(BluezAdapter1 * object, const gchar * value); + +const gchar * bluez_adapter1_get_address_type(BluezAdapter1 * object); +gchar * bluez_adapter1_dup_address_type(BluezAdapter1 * object); +void bluez_adapter1_set_address_type(BluezAdapter1 * object, const gchar * value); + +const gchar * bluez_adapter1_get_name(BluezAdapter1 * object); +gchar * bluez_adapter1_dup_name(BluezAdapter1 * object); +void bluez_adapter1_set_name(BluezAdapter1 * object, const gchar * value); + +const gchar * bluez_adapter1_get_alias(BluezAdapter1 * object); +gchar * bluez_adapter1_dup_alias(BluezAdapter1 * object); +void bluez_adapter1_set_alias(BluezAdapter1 * object, const gchar * value); + +guint bluez_adapter1_get_class(BluezAdapter1 * object); +void bluez_adapter1_set_class(BluezAdapter1 * object, guint value); + +gboolean bluez_adapter1_get_powered(BluezAdapter1 * object); +void bluez_adapter1_set_powered(BluezAdapter1 * object, gboolean value); + +gboolean bluez_adapter1_get_discoverable(BluezAdapter1 * object); +void bluez_adapter1_set_discoverable(BluezAdapter1 * object, gboolean value); + +guint bluez_adapter1_get_discoverable_timeout(BluezAdapter1 * object); +void bluez_adapter1_set_discoverable_timeout(BluezAdapter1 * object, guint value); + +gboolean bluez_adapter1_get_pairable(BluezAdapter1 * object); +void bluez_adapter1_set_pairable(BluezAdapter1 * object, gboolean value); + +guint bluez_adapter1_get_pairable_timeout(BluezAdapter1 * object); +void bluez_adapter1_set_pairable_timeout(BluezAdapter1 * object, guint value); + +gboolean bluez_adapter1_get_discovering(BluezAdapter1 * object); +void bluez_adapter1_set_discovering(BluezAdapter1 * object, gboolean value); + +const gchar * const * bluez_adapter1_get_uuids(BluezAdapter1 * object); +gchar ** bluez_adapter1_dup_uuids(BluezAdapter1 * object); +void bluez_adapter1_set_uuids(BluezAdapter1 * object, const gchar * const * value); + +const gchar * bluez_adapter1_get_modalias(BluezAdapter1 * object); +gchar * bluez_adapter1_dup_modalias(BluezAdapter1 * object); +void bluez_adapter1_set_modalias(BluezAdapter1 * object, const gchar * value); + +const gchar * const * bluez_adapter1_get_roles(BluezAdapter1 * object); +gchar ** bluez_adapter1_dup_roles(BluezAdapter1 * object); +void bluez_adapter1_set_roles(BluezAdapter1 * object, const gchar * const * value); + +/* ---- */ + +#define BLUEZ_TYPE_ADAPTER1_PROXY (bluez_adapter1_proxy_get_type()) +#define BLUEZ_ADAPTER1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_ADAPTER1_PROXY, BluezAdapter1Proxy)) +#define BLUEZ_ADAPTER1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_ADAPTER1_PROXY, BluezAdapter1ProxyClass)) +#define BLUEZ_ADAPTER1_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_ADAPTER1_PROXY, BluezAdapter1ProxyClass)) +#define BLUEZ_IS_ADAPTER1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_ADAPTER1_PROXY)) +#define BLUEZ_IS_ADAPTER1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_ADAPTER1_PROXY)) + +typedef struct _BluezAdapter1Proxy BluezAdapter1Proxy; +typedef struct _BluezAdapter1ProxyClass BluezAdapter1ProxyClass; +typedef struct _BluezAdapter1ProxyPrivate BluezAdapter1ProxyPrivate; + +struct _BluezAdapter1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezAdapter1ProxyPrivate * priv; +}; + +struct _BluezAdapter1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_adapter1_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezAdapter1Proxy, g_object_unref) +#endif + +void bluez_adapter1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); +BluezAdapter1 * bluez_adapter1_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezAdapter1 * bluez_adapter1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error); + +void bluez_adapter1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); +BluezAdapter1 * bluez_adapter1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error); +BluezAdapter1 * bluez_adapter1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_ADAPTER1_SKELETON (bluez_adapter1_skeleton_get_type()) +#define BLUEZ_ADAPTER1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_ADAPTER1_SKELETON, BluezAdapter1Skeleton)) +#define BLUEZ_ADAPTER1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_ADAPTER1_SKELETON, BluezAdapter1SkeletonClass)) +#define BLUEZ_ADAPTER1_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_ADAPTER1_SKELETON, BluezAdapter1SkeletonClass)) +#define BLUEZ_IS_ADAPTER1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_ADAPTER1_SKELETON)) +#define BLUEZ_IS_ADAPTER1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_ADAPTER1_SKELETON)) + +typedef struct _BluezAdapter1Skeleton BluezAdapter1Skeleton; +typedef struct _BluezAdapter1SkeletonClass BluezAdapter1SkeletonClass; +typedef struct _BluezAdapter1SkeletonPrivate BluezAdapter1SkeletonPrivate; + +struct _BluezAdapter1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezAdapter1SkeletonPrivate * priv; +}; + +struct _BluezAdapter1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_adapter1_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezAdapter1Skeleton, g_object_unref) +#endif + +BluezAdapter1 * bluez_adapter1_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.Device1 */ + +#define BLUEZ_TYPE_DEVICE1 (bluez_device1_get_type()) +#define BLUEZ_DEVICE1(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_DEVICE1, BluezDevice1)) +#define BLUEZ_IS_DEVICE1(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_DEVICE1)) +#define BLUEZ_DEVICE1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_DEVICE1, BluezDevice1Iface)) + +struct _BluezDevice1; +typedef struct _BluezDevice1 BluezDevice1; +typedef struct _BluezDevice1Iface BluezDevice1Iface; + +struct _BluezDevice1Iface +{ + GTypeInterface parent_iface; + + gboolean (*handle_cancel_pairing)(BluezDevice1 * object, GDBusMethodInvocation * invocation); + + gboolean (*handle_connect)(BluezDevice1 * object, GDBusMethodInvocation * invocation); + + gboolean (*handle_connect_profile)(BluezDevice1 * object, GDBusMethodInvocation * invocation, const gchar * arg_UUID); + + gboolean (*handle_disconnect)(BluezDevice1 * object, GDBusMethodInvocation * invocation); + + gboolean (*handle_disconnect_profile)(BluezDevice1 * object, GDBusMethodInvocation * invocation, const gchar * arg_UUID); + + gboolean (*handle_pair)(BluezDevice1 * object, GDBusMethodInvocation * invocation); + + const gchar * (*get_adapter)(BluezDevice1 * object); + + const gchar * (*get_address)(BluezDevice1 * object); + + const gchar * (*get_address_type)(BluezDevice1 * object); + + GVariant * (*get_advertising_data)(BluezDevice1 * object); + + const gchar * (*get_advertising_flags)(BluezDevice1 * object); + + const gchar * (*get_alias)(BluezDevice1 * object); + + guint16 (*get_appearance)(BluezDevice1 * object); + + gboolean (*get_blocked)(BluezDevice1 * object); + + guint (*get_class)(BluezDevice1 * object); + + gboolean (*get_connected)(BluezDevice1 * object); + + const gchar * (*get_icon)(BluezDevice1 * object); + + gboolean (*get_legacy_pairing)(BluezDevice1 * object); + + GVariant * (*get_manufacturer_data)(BluezDevice1 * object); + + const gchar * (*get_modalias)(BluezDevice1 * object); + + const gchar * (*get_name)(BluezDevice1 * object); + + gboolean (*get_paired)(BluezDevice1 * object); + + gint16 (*get_rssi)(BluezDevice1 * object); + + GVariant * (*get_service_data)(BluezDevice1 * object); + + gboolean (*get_services_resolved)(BluezDevice1 * object); + + gboolean (*get_trusted)(BluezDevice1 * object); + + gint16 (*get_tx_power)(BluezDevice1 * object); + + const gchar * const * (*get_uuids)(BluezDevice1 * object); + + gboolean (*get_wake_allowed)(BluezDevice1 * object); +}; + +GType bluez_device1_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_device1_interface_info(void); +guint bluez_device1_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_device1_complete_disconnect(BluezDevice1 * object, GDBusMethodInvocation * invocation); + +void bluez_device1_complete_connect(BluezDevice1 * object, GDBusMethodInvocation * invocation); + +void bluez_device1_complete_connect_profile(BluezDevice1 * object, GDBusMethodInvocation * invocation); + +void bluez_device1_complete_disconnect_profile(BluezDevice1 * object, GDBusMethodInvocation * invocation); + +void bluez_device1_complete_pair(BluezDevice1 * object, GDBusMethodInvocation * invocation); + +void bluez_device1_complete_cancel_pairing(BluezDevice1 * object, GDBusMethodInvocation * invocation); + +/* D-Bus method calls: */ +void bluez_device1_call_disconnect(BluezDevice1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_device1_call_disconnect_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_device1_call_disconnect_sync(BluezDevice1 * proxy, GCancellable * cancellable, GError ** error); + +void bluez_device1_call_connect(BluezDevice1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_device1_call_connect_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_device1_call_connect_sync(BluezDevice1 * proxy, GCancellable * cancellable, GError ** error); + +void bluez_device1_call_connect_profile(BluezDevice1 * proxy, const gchar * arg_UUID, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_device1_call_connect_profile_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_device1_call_connect_profile_sync(BluezDevice1 * proxy, const gchar * arg_UUID, GCancellable * cancellable, + GError ** error); + +void bluez_device1_call_disconnect_profile(BluezDevice1 * proxy, const gchar * arg_UUID, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_device1_call_disconnect_profile_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_device1_call_disconnect_profile_sync(BluezDevice1 * proxy, const gchar * arg_UUID, GCancellable * cancellable, + GError ** error); + +void bluez_device1_call_pair(BluezDevice1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_device1_call_pair_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_device1_call_pair_sync(BluezDevice1 * proxy, GCancellable * cancellable, GError ** error); + +void bluez_device1_call_cancel_pairing(BluezDevice1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_device1_call_cancel_pairing_finish(BluezDevice1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_device1_call_cancel_pairing_sync(BluezDevice1 * proxy, GCancellable * cancellable, GError ** error); + +/* D-Bus property accessors: */ +const gchar * bluez_device1_get_address(BluezDevice1 * object); +gchar * bluez_device1_dup_address(BluezDevice1 * object); +void bluez_device1_set_address(BluezDevice1 * object, const gchar * value); + +const gchar * bluez_device1_get_address_type(BluezDevice1 * object); +gchar * bluez_device1_dup_address_type(BluezDevice1 * object); +void bluez_device1_set_address_type(BluezDevice1 * object, const gchar * value); + +const gchar * bluez_device1_get_name(BluezDevice1 * object); +gchar * bluez_device1_dup_name(BluezDevice1 * object); +void bluez_device1_set_name(BluezDevice1 * object, const gchar * value); + +const gchar * bluez_device1_get_alias(BluezDevice1 * object); +gchar * bluez_device1_dup_alias(BluezDevice1 * object); +void bluez_device1_set_alias(BluezDevice1 * object, const gchar * value); + +guint bluez_device1_get_class(BluezDevice1 * object); +void bluez_device1_set_class(BluezDevice1 * object, guint value); + +guint16 bluez_device1_get_appearance(BluezDevice1 * object); +void bluez_device1_set_appearance(BluezDevice1 * object, guint16 value); + +const gchar * bluez_device1_get_icon(BluezDevice1 * object); +gchar * bluez_device1_dup_icon(BluezDevice1 * object); +void bluez_device1_set_icon(BluezDevice1 * object, const gchar * value); + +gboolean bluez_device1_get_paired(BluezDevice1 * object); +void bluez_device1_set_paired(BluezDevice1 * object, gboolean value); + +gboolean bluez_device1_get_trusted(BluezDevice1 * object); +void bluez_device1_set_trusted(BluezDevice1 * object, gboolean value); + +gboolean bluez_device1_get_blocked(BluezDevice1 * object); +void bluez_device1_set_blocked(BluezDevice1 * object, gboolean value); + +gboolean bluez_device1_get_legacy_pairing(BluezDevice1 * object); +void bluez_device1_set_legacy_pairing(BluezDevice1 * object, gboolean value); + +gint16 bluez_device1_get_rssi(BluezDevice1 * object); +void bluez_device1_set_rssi(BluezDevice1 * object, gint16 value); + +gboolean bluez_device1_get_connected(BluezDevice1 * object); +void bluez_device1_set_connected(BluezDevice1 * object, gboolean value); + +const gchar * const * bluez_device1_get_uuids(BluezDevice1 * object); +gchar ** bluez_device1_dup_uuids(BluezDevice1 * object); +void bluez_device1_set_uuids(BluezDevice1 * object, const gchar * const * value); + +const gchar * bluez_device1_get_modalias(BluezDevice1 * object); +gchar * bluez_device1_dup_modalias(BluezDevice1 * object); +void bluez_device1_set_modalias(BluezDevice1 * object, const gchar * value); + +const gchar * bluez_device1_get_adapter(BluezDevice1 * object); +gchar * bluez_device1_dup_adapter(BluezDevice1 * object); +void bluez_device1_set_adapter(BluezDevice1 * object, const gchar * value); + +GVariant * bluez_device1_get_manufacturer_data(BluezDevice1 * object); +GVariant * bluez_device1_dup_manufacturer_data(BluezDevice1 * object); +void bluez_device1_set_manufacturer_data(BluezDevice1 * object, GVariant * value); + +GVariant * bluez_device1_get_service_data(BluezDevice1 * object); +GVariant * bluez_device1_dup_service_data(BluezDevice1 * object); +void bluez_device1_set_service_data(BluezDevice1 * object, GVariant * value); + +gint16 bluez_device1_get_tx_power(BluezDevice1 * object); +void bluez_device1_set_tx_power(BluezDevice1 * object, gint16 value); + +gboolean bluez_device1_get_services_resolved(BluezDevice1 * object); +void bluez_device1_set_services_resolved(BluezDevice1 * object, gboolean value); + +const gchar * bluez_device1_get_advertising_flags(BluezDevice1 * object); +gchar * bluez_device1_dup_advertising_flags(BluezDevice1 * object); +void bluez_device1_set_advertising_flags(BluezDevice1 * object, const gchar * value); + +GVariant * bluez_device1_get_advertising_data(BluezDevice1 * object); +GVariant * bluez_device1_dup_advertising_data(BluezDevice1 * object); +void bluez_device1_set_advertising_data(BluezDevice1 * object, GVariant * value); + +gboolean bluez_device1_get_wake_allowed(BluezDevice1 * object); +void bluez_device1_set_wake_allowed(BluezDevice1 * object, gboolean value); + +/* ---- */ + +#define BLUEZ_TYPE_DEVICE1_PROXY (bluez_device1_proxy_get_type()) +#define BLUEZ_DEVICE1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_DEVICE1_PROXY, BluezDevice1Proxy)) +#define BLUEZ_DEVICE1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_DEVICE1_PROXY, BluezDevice1ProxyClass)) +#define BLUEZ_DEVICE1_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_DEVICE1_PROXY, BluezDevice1ProxyClass)) +#define BLUEZ_IS_DEVICE1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_DEVICE1_PROXY)) +#define BLUEZ_IS_DEVICE1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_DEVICE1_PROXY)) + +typedef struct _BluezDevice1Proxy BluezDevice1Proxy; +typedef struct _BluezDevice1ProxyClass BluezDevice1ProxyClass; +typedef struct _BluezDevice1ProxyPrivate BluezDevice1ProxyPrivate; + +struct _BluezDevice1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezDevice1ProxyPrivate * priv; +}; + +struct _BluezDevice1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_device1_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezDevice1Proxy, g_object_unref) +#endif + +void bluez_device1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); +BluezDevice1 * bluez_device1_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezDevice1 * bluez_device1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error); + +void bluez_device1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); +BluezDevice1 * bluez_device1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error); +BluezDevice1 * bluez_device1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_DEVICE1_SKELETON (bluez_device1_skeleton_get_type()) +#define BLUEZ_DEVICE1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_DEVICE1_SKELETON, BluezDevice1Skeleton)) +#define BLUEZ_DEVICE1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_DEVICE1_SKELETON, BluezDevice1SkeletonClass)) +#define BLUEZ_DEVICE1_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_DEVICE1_SKELETON, BluezDevice1SkeletonClass)) +#define BLUEZ_IS_DEVICE1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_DEVICE1_SKELETON)) +#define BLUEZ_IS_DEVICE1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_DEVICE1_SKELETON)) + +typedef struct _BluezDevice1Skeleton BluezDevice1Skeleton; +typedef struct _BluezDevice1SkeletonClass BluezDevice1SkeletonClass; +typedef struct _BluezDevice1SkeletonPrivate BluezDevice1SkeletonPrivate; + +struct _BluezDevice1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezDevice1SkeletonPrivate * priv; +}; + +struct _BluezDevice1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_device1_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezDevice1Skeleton, g_object_unref) +#endif + +BluezDevice1 * bluez_device1_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.GattManager1 */ + +#define BLUEZ_TYPE_GATT_MANAGER1 (bluez_gatt_manager1_get_type()) +#define BLUEZ_GATT_MANAGER1(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_MANAGER1, BluezGattManager1)) +#define BLUEZ_IS_GATT_MANAGER1(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_MANAGER1)) +#define BLUEZ_GATT_MANAGER1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_GATT_MANAGER1, BluezGattManager1Iface)) + +struct _BluezGattManager1; +typedef struct _BluezGattManager1 BluezGattManager1; +typedef struct _BluezGattManager1Iface BluezGattManager1Iface; + +struct _BluezGattManager1Iface +{ + GTypeInterface parent_iface; + + gboolean (*handle_register_application)(BluezGattManager1 * object, GDBusMethodInvocation * invocation, + const gchar * arg_application, GVariant * arg_options); + + gboolean (*handle_unregister_application)(BluezGattManager1 * object, GDBusMethodInvocation * invocation, + const gchar * arg_application); +}; + +GType bluez_gatt_manager1_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_gatt_manager1_interface_info(void); +guint bluez_gatt_manager1_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_gatt_manager1_complete_register_application(BluezGattManager1 * object, GDBusMethodInvocation * invocation); + +void bluez_gatt_manager1_complete_unregister_application(BluezGattManager1 * object, GDBusMethodInvocation * invocation); + +/* D-Bus method calls: */ +void bluez_gatt_manager1_call_register_application(BluezGattManager1 * proxy, const gchar * arg_application, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_manager1_call_register_application_finish(BluezGattManager1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_manager1_call_register_application_sync(BluezGattManager1 * proxy, const gchar * arg_application, + GVariant * arg_options, GCancellable * cancellable, GError ** error); + +void bluez_gatt_manager1_call_unregister_application(BluezGattManager1 * proxy, const gchar * arg_application, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_manager1_call_unregister_application_finish(BluezGattManager1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_manager1_call_unregister_application_sync(BluezGattManager1 * proxy, const gchar * arg_application, + GCancellable * cancellable, GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_GATT_MANAGER1_PROXY (bluez_gatt_manager1_proxy_get_type()) +#define BLUEZ_GATT_MANAGER1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_MANAGER1_PROXY, BluezGattManager1Proxy)) +#define BLUEZ_GATT_MANAGER1_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_GATT_MANAGER1_PROXY, BluezGattManager1ProxyClass)) +#define BLUEZ_GATT_MANAGER1_PROXY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_GATT_MANAGER1_PROXY, BluezGattManager1ProxyClass)) +#define BLUEZ_IS_GATT_MANAGER1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_MANAGER1_PROXY)) +#define BLUEZ_IS_GATT_MANAGER1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_GATT_MANAGER1_PROXY)) + +typedef struct _BluezGattManager1Proxy BluezGattManager1Proxy; +typedef struct _BluezGattManager1ProxyClass BluezGattManager1ProxyClass; +typedef struct _BluezGattManager1ProxyPrivate BluezGattManager1ProxyPrivate; + +struct _BluezGattManager1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezGattManager1ProxyPrivate * priv; +}; + +struct _BluezGattManager1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_gatt_manager1_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezGattManager1Proxy, g_object_unref) +#endif + +void bluez_gatt_manager1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezGattManager1 * bluez_gatt_manager1_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezGattManager1 * bluez_gatt_manager1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error); + +void bluez_gatt_manager1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); +BluezGattManager1 * bluez_gatt_manager1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error); +BluezGattManager1 * bluez_gatt_manager1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_GATT_MANAGER1_SKELETON (bluez_gatt_manager1_skeleton_get_type()) +#define BLUEZ_GATT_MANAGER1_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_MANAGER1_SKELETON, BluezGattManager1Skeleton)) +#define BLUEZ_GATT_MANAGER1_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_GATT_MANAGER1_SKELETON, BluezGattManager1SkeletonClass)) +#define BLUEZ_GATT_MANAGER1_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_GATT_MANAGER1_SKELETON, BluezGattManager1SkeletonClass)) +#define BLUEZ_IS_GATT_MANAGER1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_MANAGER1_SKELETON)) +#define BLUEZ_IS_GATT_MANAGER1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_GATT_MANAGER1_SKELETON)) + +typedef struct _BluezGattManager1Skeleton BluezGattManager1Skeleton; +typedef struct _BluezGattManager1SkeletonClass BluezGattManager1SkeletonClass; +typedef struct _BluezGattManager1SkeletonPrivate BluezGattManager1SkeletonPrivate; + +struct _BluezGattManager1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezGattManager1SkeletonPrivate * priv; +}; + +struct _BluezGattManager1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_gatt_manager1_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezGattManager1Skeleton, g_object_unref) +#endif + +BluezGattManager1 * bluez_gatt_manager1_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.GattService1 */ + +#define BLUEZ_TYPE_GATT_SERVICE1 (bluez_gatt_service1_get_type()) +#define BLUEZ_GATT_SERVICE1(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_SERVICE1, BluezGattService1)) +#define BLUEZ_IS_GATT_SERVICE1(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_SERVICE1)) +#define BLUEZ_GATT_SERVICE1_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_GATT_SERVICE1, BluezGattService1Iface)) + +struct _BluezGattService1; +typedef struct _BluezGattService1 BluezGattService1; +typedef struct _BluezGattService1Iface BluezGattService1Iface; + +struct _BluezGattService1Iface +{ + GTypeInterface parent_iface; + + const gchar * (*get_device)(BluezGattService1 * object); + + gboolean (*get_primary)(BluezGattService1 * object); + + const gchar * (*get_uuid)(BluezGattService1 * object); +}; + +GType bluez_gatt_service1_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_gatt_service1_interface_info(void); +guint bluez_gatt_service1_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus property accessors: */ +const gchar * bluez_gatt_service1_get_uuid(BluezGattService1 * object); +gchar * bluez_gatt_service1_dup_uuid(BluezGattService1 * object); +void bluez_gatt_service1_set_uuid(BluezGattService1 * object, const gchar * value); + +const gchar * bluez_gatt_service1_get_device(BluezGattService1 * object); +gchar * bluez_gatt_service1_dup_device(BluezGattService1 * object); +void bluez_gatt_service1_set_device(BluezGattService1 * object, const gchar * value); + +gboolean bluez_gatt_service1_get_primary(BluezGattService1 * object); +void bluez_gatt_service1_set_primary(BluezGattService1 * object, gboolean value); + +/* ---- */ + +#define BLUEZ_TYPE_GATT_SERVICE1_PROXY (bluez_gatt_service1_proxy_get_type()) +#define BLUEZ_GATT_SERVICE1_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_SERVICE1_PROXY, BluezGattService1Proxy)) +#define BLUEZ_GATT_SERVICE1_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_GATT_SERVICE1_PROXY, BluezGattService1ProxyClass)) +#define BLUEZ_GATT_SERVICE1_PROXY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_GATT_SERVICE1_PROXY, BluezGattService1ProxyClass)) +#define BLUEZ_IS_GATT_SERVICE1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_SERVICE1_PROXY)) +#define BLUEZ_IS_GATT_SERVICE1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_GATT_SERVICE1_PROXY)) + +typedef struct _BluezGattService1Proxy BluezGattService1Proxy; +typedef struct _BluezGattService1ProxyClass BluezGattService1ProxyClass; +typedef struct _BluezGattService1ProxyPrivate BluezGattService1ProxyPrivate; + +struct _BluezGattService1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezGattService1ProxyPrivate * priv; +}; + +struct _BluezGattService1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_gatt_service1_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezGattService1Proxy, g_object_unref) +#endif + +void bluez_gatt_service1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezGattService1 * bluez_gatt_service1_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezGattService1 * bluez_gatt_service1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error); + +void bluez_gatt_service1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, const gchar * object_path, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); +BluezGattService1 * bluez_gatt_service1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error); +BluezGattService1 * bluez_gatt_service1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_GATT_SERVICE1_SKELETON (bluez_gatt_service1_skeleton_get_type()) +#define BLUEZ_GATT_SERVICE1_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_SERVICE1_SKELETON, BluezGattService1Skeleton)) +#define BLUEZ_GATT_SERVICE1_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_GATT_SERVICE1_SKELETON, BluezGattService1SkeletonClass)) +#define BLUEZ_GATT_SERVICE1_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_GATT_SERVICE1_SKELETON, BluezGattService1SkeletonClass)) +#define BLUEZ_IS_GATT_SERVICE1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_SERVICE1_SKELETON)) +#define BLUEZ_IS_GATT_SERVICE1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_GATT_SERVICE1_SKELETON)) + +typedef struct _BluezGattService1Skeleton BluezGattService1Skeleton; +typedef struct _BluezGattService1SkeletonClass BluezGattService1SkeletonClass; +typedef struct _BluezGattService1SkeletonPrivate BluezGattService1SkeletonPrivate; + +struct _BluezGattService1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezGattService1SkeletonPrivate * priv; +}; + +struct _BluezGattService1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_gatt_service1_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezGattService1Skeleton, g_object_unref) +#endif + +BluezGattService1 * bluez_gatt_service1_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.GattCharacteristic1 */ + +#define BLUEZ_TYPE_GATT_CHARACTERISTIC1 (bluez_gatt_characteristic1_get_type()) +#define BLUEZ_GATT_CHARACTERISTIC1(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_CHARACTERISTIC1, BluezGattCharacteristic1)) +#define BLUEZ_IS_GATT_CHARACTERISTIC1(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_CHARACTERISTIC1)) +#define BLUEZ_GATT_CHARACTERISTIC1_GET_IFACE(o) \ + (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_GATT_CHARACTERISTIC1, BluezGattCharacteristic1Iface)) + +struct _BluezGattCharacteristic1; +typedef struct _BluezGattCharacteristic1 BluezGattCharacteristic1; +typedef struct _BluezGattCharacteristic1Iface BluezGattCharacteristic1Iface; + +struct _BluezGattCharacteristic1Iface +{ + GTypeInterface parent_iface; + + gboolean (*handle_acquire_notify)(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, + GVariant * arg_options); + + gboolean (*handle_acquire_write)(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, GVariant * arg_options); + + gboolean (*handle_confirm)(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation); + + gboolean (*handle_read_value)(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, GVariant * arg_options); + + gboolean (*handle_start_notify)(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation); + + gboolean (*handle_stop_notify)(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation); + + gboolean (*handle_write_value)(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, GVariant * arg_value, + GVariant * arg_options); + + const gchar * const * (*get_flags)(BluezGattCharacteristic1 * object); + + gboolean (*get_notify_acquired)(BluezGattCharacteristic1 * object); + + gboolean (*get_notifying)(BluezGattCharacteristic1 * object); + + const gchar * (*get_service)(BluezGattCharacteristic1 * object); + + const gchar * (*get_uuid)(BluezGattCharacteristic1 * object); + + GVariant * (*get_value)(BluezGattCharacteristic1 * object); + + gboolean (*get_write_acquired)(BluezGattCharacteristic1 * object); +}; + +GType bluez_gatt_characteristic1_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_gatt_characteristic1_interface_info(void); +guint bluez_gatt_characteristic1_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_gatt_characteristic1_complete_read_value(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, + GVariant * value); + +void bluez_gatt_characteristic1_complete_write_value(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation); + +void bluez_gatt_characteristic1_complete_acquire_write(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, + GVariant * fd, guint16 mtu); + +void bluez_gatt_characteristic1_complete_acquire_notify(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation, + GVariant * fd, guint16 mtu); + +void bluez_gatt_characteristic1_complete_start_notify(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation); + +void bluez_gatt_characteristic1_complete_stop_notify(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation); + +void bluez_gatt_characteristic1_complete_confirm(BluezGattCharacteristic1 * object, GDBusMethodInvocation * invocation); + +/* D-Bus method calls: */ +void bluez_gatt_characteristic1_call_read_value(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_characteristic1_call_read_value_finish(BluezGattCharacteristic1 * proxy, GVariant ** out_value, + GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_characteristic1_call_read_value_sync(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GVariant ** out_value, GCancellable * cancellable, GError ** error); + +void bluez_gatt_characteristic1_call_write_value(BluezGattCharacteristic1 * proxy, GVariant * arg_value, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_characteristic1_call_write_value_finish(BluezGattCharacteristic1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_characteristic1_call_write_value_sync(BluezGattCharacteristic1 * proxy, GVariant * arg_value, + GVariant * arg_options, GCancellable * cancellable, GError ** error); + +void bluez_gatt_characteristic1_call_acquire_write(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_characteristic1_call_acquire_write_finish(BluezGattCharacteristic1 * proxy, GVariant ** out_fd, + guint16 * out_mtu, GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_characteristic1_call_acquire_write_sync(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GVariant ** out_fd, guint16 * out_mtu, GCancellable * cancellable, + GError ** error); + +void bluez_gatt_characteristic1_call_acquire_notify(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_characteristic1_call_acquire_notify_finish(BluezGattCharacteristic1 * proxy, GVariant ** out_fd, + guint16 * out_mtu, GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_characteristic1_call_acquire_notify_sync(BluezGattCharacteristic1 * proxy, GVariant * arg_options, + GVariant ** out_fd, guint16 * out_mtu, GCancellable * cancellable, + GError ** error); + +void bluez_gatt_characteristic1_call_start_notify(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_characteristic1_call_start_notify_finish(BluezGattCharacteristic1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_characteristic1_call_start_notify_sync(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GError ** error); + +void bluez_gatt_characteristic1_call_stop_notify(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_characteristic1_call_stop_notify_finish(BluezGattCharacteristic1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_characteristic1_call_stop_notify_sync(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GError ** error); + +void bluez_gatt_characteristic1_call_confirm(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_characteristic1_call_confirm_finish(BluezGattCharacteristic1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_characteristic1_call_confirm_sync(BluezGattCharacteristic1 * proxy, GCancellable * cancellable, + GError ** error); + +/* D-Bus property accessors: */ +const gchar * bluez_gatt_characteristic1_get_uuid(BluezGattCharacteristic1 * object); +gchar * bluez_gatt_characteristic1_dup_uuid(BluezGattCharacteristic1 * object); +void bluez_gatt_characteristic1_set_uuid(BluezGattCharacteristic1 * object, const gchar * value); + +const gchar * bluez_gatt_characteristic1_get_service(BluezGattCharacteristic1 * object); +gchar * bluez_gatt_characteristic1_dup_service(BluezGattCharacteristic1 * object); +void bluez_gatt_characteristic1_set_service(BluezGattCharacteristic1 * object, const gchar * value); + +GVariant * bluez_gatt_characteristic1_get_value(BluezGattCharacteristic1 * object); +GVariant * bluez_gatt_characteristic1_dup_value(BluezGattCharacteristic1 * object); +void bluez_gatt_characteristic1_set_value(BluezGattCharacteristic1 * object, GVariant * value); + +gboolean bluez_gatt_characteristic1_get_notifying(BluezGattCharacteristic1 * object); +void bluez_gatt_characteristic1_set_notifying(BluezGattCharacteristic1 * object, gboolean value); + +const gchar * const * bluez_gatt_characteristic1_get_flags(BluezGattCharacteristic1 * object); +gchar ** bluez_gatt_characteristic1_dup_flags(BluezGattCharacteristic1 * object); +void bluez_gatt_characteristic1_set_flags(BluezGattCharacteristic1 * object, const gchar * const * value); + +gboolean bluez_gatt_characteristic1_get_write_acquired(BluezGattCharacteristic1 * object); +void bluez_gatt_characteristic1_set_write_acquired(BluezGattCharacteristic1 * object, gboolean value); + +gboolean bluez_gatt_characteristic1_get_notify_acquired(BluezGattCharacteristic1 * object); +void bluez_gatt_characteristic1_set_notify_acquired(BluezGattCharacteristic1 * object, gboolean value); + +/* ---- */ + +#define BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY (bluez_gatt_characteristic1_proxy_get_type()) +#define BLUEZ_GATT_CHARACTERISTIC1_PROXY(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY, BluezGattCharacteristic1Proxy)) +#define BLUEZ_GATT_CHARACTERISTIC1_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY, BluezGattCharacteristic1ProxyClass)) +#define BLUEZ_GATT_CHARACTERISTIC1_PROXY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY, BluezGattCharacteristic1ProxyClass)) +#define BLUEZ_IS_GATT_CHARACTERISTIC1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY)) +#define BLUEZ_IS_GATT_CHARACTERISTIC1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_GATT_CHARACTERISTIC1_PROXY)) + +typedef struct _BluezGattCharacteristic1Proxy BluezGattCharacteristic1Proxy; +typedef struct _BluezGattCharacteristic1ProxyClass BluezGattCharacteristic1ProxyClass; +typedef struct _BluezGattCharacteristic1ProxyPrivate BluezGattCharacteristic1ProxyPrivate; + +struct _BluezGattCharacteristic1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezGattCharacteristic1ProxyPrivate * priv; +}; + +struct _BluezGattCharacteristic1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_gatt_characteristic1_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezGattCharacteristic1Proxy, g_object_unref) +#endif + +void bluez_gatt_characteristic1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezGattCharacteristic1 * bluez_gatt_characteristic1_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezGattCharacteristic1 * bluez_gatt_characteristic1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error); + +void bluez_gatt_characteristic1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +BluezGattCharacteristic1 * bluez_gatt_characteristic1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error); +BluezGattCharacteristic1 * bluez_gatt_characteristic1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_GATT_CHARACTERISTIC1_SKELETON (bluez_gatt_characteristic1_skeleton_get_type()) +#define BLUEZ_GATT_CHARACTERISTIC1_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_CHARACTERISTIC1_SKELETON, BluezGattCharacteristic1Skeleton)) +#define BLUEZ_GATT_CHARACTERISTIC1_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_GATT_CHARACTERISTIC1_SKELETON, BluezGattCharacteristic1SkeletonClass)) +#define BLUEZ_GATT_CHARACTERISTIC1_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_GATT_CHARACTERISTIC1_SKELETON, BluezGattCharacteristic1SkeletonClass)) +#define BLUEZ_IS_GATT_CHARACTERISTIC1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_CHARACTERISTIC1_SKELETON)) +#define BLUEZ_IS_GATT_CHARACTERISTIC1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_GATT_CHARACTERISTIC1_SKELETON)) + +typedef struct _BluezGattCharacteristic1Skeleton BluezGattCharacteristic1Skeleton; +typedef struct _BluezGattCharacteristic1SkeletonClass BluezGattCharacteristic1SkeletonClass; +typedef struct _BluezGattCharacteristic1SkeletonPrivate BluezGattCharacteristic1SkeletonPrivate; + +struct _BluezGattCharacteristic1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezGattCharacteristic1SkeletonPrivate * priv; +}; + +struct _BluezGattCharacteristic1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_gatt_characteristic1_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezGattCharacteristic1Skeleton, g_object_unref) +#endif + +BluezGattCharacteristic1 * bluez_gatt_characteristic1_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.GattDescriptor1 */ + +#define BLUEZ_TYPE_GATT_DESCRIPTOR1 (bluez_gatt_descriptor1_get_type()) +#define BLUEZ_GATT_DESCRIPTOR1(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_DESCRIPTOR1, BluezGattDescriptor1)) +#define BLUEZ_IS_GATT_DESCRIPTOR1(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_DESCRIPTOR1)) +#define BLUEZ_GATT_DESCRIPTOR1_GET_IFACE(o) \ + (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_GATT_DESCRIPTOR1, BluezGattDescriptor1Iface)) + +struct _BluezGattDescriptor1; +typedef struct _BluezGattDescriptor1 BluezGattDescriptor1; +typedef struct _BluezGattDescriptor1Iface BluezGattDescriptor1Iface; + +struct _BluezGattDescriptor1Iface +{ + GTypeInterface parent_iface; + + gboolean (*handle_read_value)(BluezGattDescriptor1 * object, GDBusMethodInvocation * invocation, GVariant * arg_options); + + gboolean (*handle_write_value)(BluezGattDescriptor1 * object, GDBusMethodInvocation * invocation, GVariant * arg_value, + GVariant * arg_options); + + const gchar * (*get_characteristic)(BluezGattDescriptor1 * object); + + const gchar * (*get_uuid)(BluezGattDescriptor1 * object); + + GVariant * (*get_value)(BluezGattDescriptor1 * object); +}; + +GType bluez_gatt_descriptor1_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_gatt_descriptor1_interface_info(void); +guint bluez_gatt_descriptor1_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_gatt_descriptor1_complete_read_value(BluezGattDescriptor1 * object, GDBusMethodInvocation * invocation, + GVariant * value); + +void bluez_gatt_descriptor1_complete_write_value(BluezGattDescriptor1 * object, GDBusMethodInvocation * invocation); + +/* D-Bus method calls: */ +void bluez_gatt_descriptor1_call_read_value(BluezGattDescriptor1 * proxy, GVariant * arg_options, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_descriptor1_call_read_value_finish(BluezGattDescriptor1 * proxy, GVariant ** out_value, GAsyncResult * res, + GError ** error); + +gboolean bluez_gatt_descriptor1_call_read_value_sync(BluezGattDescriptor1 * proxy, GVariant * arg_options, GVariant ** out_value, + GCancellable * cancellable, GError ** error); + +void bluez_gatt_descriptor1_call_write_value(BluezGattDescriptor1 * proxy, GVariant * arg_value, GVariant * arg_options, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_gatt_descriptor1_call_write_value_finish(BluezGattDescriptor1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_gatt_descriptor1_call_write_value_sync(BluezGattDescriptor1 * proxy, GVariant * arg_value, GVariant * arg_options, + GCancellable * cancellable, GError ** error); + +/* D-Bus property accessors: */ +const gchar * bluez_gatt_descriptor1_get_uuid(BluezGattDescriptor1 * object); +gchar * bluez_gatt_descriptor1_dup_uuid(BluezGattDescriptor1 * object); +void bluez_gatt_descriptor1_set_uuid(BluezGattDescriptor1 * object, const gchar * value); + +const gchar * bluez_gatt_descriptor1_get_characteristic(BluezGattDescriptor1 * object); +gchar * bluez_gatt_descriptor1_dup_characteristic(BluezGattDescriptor1 * object); +void bluez_gatt_descriptor1_set_characteristic(BluezGattDescriptor1 * object, const gchar * value); + +GVariant * bluez_gatt_descriptor1_get_value(BluezGattDescriptor1 * object); +GVariant * bluez_gatt_descriptor1_dup_value(BluezGattDescriptor1 * object); +void bluez_gatt_descriptor1_set_value(BluezGattDescriptor1 * object, GVariant * value); + +/* ---- */ + +#define BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY (bluez_gatt_descriptor1_proxy_get_type()) +#define BLUEZ_GATT_DESCRIPTOR1_PROXY(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY, BluezGattDescriptor1Proxy)) +#define BLUEZ_GATT_DESCRIPTOR1_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY, BluezGattDescriptor1ProxyClass)) +#define BLUEZ_GATT_DESCRIPTOR1_PROXY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY, BluezGattDescriptor1ProxyClass)) +#define BLUEZ_IS_GATT_DESCRIPTOR1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY)) +#define BLUEZ_IS_GATT_DESCRIPTOR1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_GATT_DESCRIPTOR1_PROXY)) + +typedef struct _BluezGattDescriptor1Proxy BluezGattDescriptor1Proxy; +typedef struct _BluezGattDescriptor1ProxyClass BluezGattDescriptor1ProxyClass; +typedef struct _BluezGattDescriptor1ProxyPrivate BluezGattDescriptor1ProxyPrivate; + +struct _BluezGattDescriptor1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezGattDescriptor1ProxyPrivate * priv; +}; + +struct _BluezGattDescriptor1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_gatt_descriptor1_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezGattDescriptor1Proxy, g_object_unref) +#endif + +void bluez_gatt_descriptor1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezGattDescriptor1 * bluez_gatt_descriptor1_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezGattDescriptor1 * bluez_gatt_descriptor1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error); + +void bluez_gatt_descriptor1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezGattDescriptor1 * bluez_gatt_descriptor1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error); +BluezGattDescriptor1 * bluez_gatt_descriptor1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_GATT_DESCRIPTOR1_SKELETON (bluez_gatt_descriptor1_skeleton_get_type()) +#define BLUEZ_GATT_DESCRIPTOR1_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_GATT_DESCRIPTOR1_SKELETON, BluezGattDescriptor1Skeleton)) +#define BLUEZ_GATT_DESCRIPTOR1_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_GATT_DESCRIPTOR1_SKELETON, BluezGattDescriptor1SkeletonClass)) +#define BLUEZ_GATT_DESCRIPTOR1_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_GATT_DESCRIPTOR1_SKELETON, BluezGattDescriptor1SkeletonClass)) +#define BLUEZ_IS_GATT_DESCRIPTOR1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_GATT_DESCRIPTOR1_SKELETON)) +#define BLUEZ_IS_GATT_DESCRIPTOR1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_GATT_DESCRIPTOR1_SKELETON)) + +typedef struct _BluezGattDescriptor1Skeleton BluezGattDescriptor1Skeleton; +typedef struct _BluezGattDescriptor1SkeletonClass BluezGattDescriptor1SkeletonClass; +typedef struct _BluezGattDescriptor1SkeletonPrivate BluezGattDescriptor1SkeletonPrivate; + +struct _BluezGattDescriptor1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezGattDescriptor1SkeletonPrivate * priv; +}; + +struct _BluezGattDescriptor1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_gatt_descriptor1_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezGattDescriptor1Skeleton, g_object_unref) +#endif + +BluezGattDescriptor1 * bluez_gatt_descriptor1_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.LEAdvertisement1 */ + +#define BLUEZ_TYPE_LEADVERTISEMENT1 (bluez_leadvertisement1_get_type()) +#define BLUEZ_LEADVERTISEMENT1(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_LEADVERTISEMENT1, BluezLEAdvertisement1)) +#define BLUEZ_IS_LEADVERTISEMENT1(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_LEADVERTISEMENT1)) +#define BLUEZ_LEADVERTISEMENT1_GET_IFACE(o) \ + (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_LEADVERTISEMENT1, BluezLEAdvertisement1Iface)) + +struct _BluezLEAdvertisement1; +typedef struct _BluezLEAdvertisement1 BluezLEAdvertisement1; +typedef struct _BluezLEAdvertisement1Iface BluezLEAdvertisement1Iface; + +struct _BluezLEAdvertisement1Iface +{ + GTypeInterface parent_iface; + + gboolean (*handle_release)(BluezLEAdvertisement1 * object, GDBusMethodInvocation * invocation); + + guint16 (*get_appearance)(BluezLEAdvertisement1 * object); + + GVariant * (*get_data)(BluezLEAdvertisement1 * object); + + gboolean (*get_discoverable)(BluezLEAdvertisement1 * object); + + guint16 (*get_discoverable_timeout)(BluezLEAdvertisement1 * object); + + guint16 (*get_duration)(BluezLEAdvertisement1 * object); + + const gchar * const * (*get_includes)(BluezLEAdvertisement1 * object); + + const gchar * (*get_local_name)(BluezLEAdvertisement1 * object); + + GVariant * (*get_manufacturer_data)(BluezLEAdvertisement1 * object); + + GVariant * (*get_service_data)(BluezLEAdvertisement1 * object); + + const gchar * const * (*get_service_uuids)(BluezLEAdvertisement1 * object); + + const gchar * const * (*get_solicit_uuids)(BluezLEAdvertisement1 * object); + + guint16 (*get_timeout)(BluezLEAdvertisement1 * object); + + const gchar * (*get_type_)(BluezLEAdvertisement1 * object); +}; + +GType bluez_leadvertisement1_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_leadvertisement1_interface_info(void); +guint bluez_leadvertisement1_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_leadvertisement1_complete_release(BluezLEAdvertisement1 * object, GDBusMethodInvocation * invocation); + +/* D-Bus method calls: */ +void bluez_leadvertisement1_call_release(BluezLEAdvertisement1 * proxy, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_leadvertisement1_call_release_finish(BluezLEAdvertisement1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_leadvertisement1_call_release_sync(BluezLEAdvertisement1 * proxy, GCancellable * cancellable, GError ** error); + +/* D-Bus property accessors: */ +const gchar * bluez_leadvertisement1_get_type_(BluezLEAdvertisement1 * object); +gchar * bluez_leadvertisement1_dup_type_(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_type_(BluezLEAdvertisement1 * object, const gchar * value); + +const gchar * const * bluez_leadvertisement1_get_service_uuids(BluezLEAdvertisement1 * object); +gchar ** bluez_leadvertisement1_dup_service_uuids(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_service_uuids(BluezLEAdvertisement1 * object, const gchar * const * value); + +GVariant * bluez_leadvertisement1_get_manufacturer_data(BluezLEAdvertisement1 * object); +GVariant * bluez_leadvertisement1_dup_manufacturer_data(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_manufacturer_data(BluezLEAdvertisement1 * object, GVariant * value); + +const gchar * const * bluez_leadvertisement1_get_solicit_uuids(BluezLEAdvertisement1 * object); +gchar ** bluez_leadvertisement1_dup_solicit_uuids(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_solicit_uuids(BluezLEAdvertisement1 * object, const gchar * const * value); + +GVariant * bluez_leadvertisement1_get_service_data(BluezLEAdvertisement1 * object); +GVariant * bluez_leadvertisement1_dup_service_data(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_service_data(BluezLEAdvertisement1 * object, GVariant * value); + +GVariant * bluez_leadvertisement1_get_data(BluezLEAdvertisement1 * object); +GVariant * bluez_leadvertisement1_dup_data(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_data(BluezLEAdvertisement1 * object, GVariant * value); + +gboolean bluez_leadvertisement1_get_discoverable(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_discoverable(BluezLEAdvertisement1 * object, gboolean value); + +guint16 bluez_leadvertisement1_get_discoverable_timeout(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_discoverable_timeout(BluezLEAdvertisement1 * object, guint16 value); + +const gchar * const * bluez_leadvertisement1_get_includes(BluezLEAdvertisement1 * object); +gchar ** bluez_leadvertisement1_dup_includes(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_includes(BluezLEAdvertisement1 * object, const gchar * const * value); + +const gchar * bluez_leadvertisement1_get_local_name(BluezLEAdvertisement1 * object); +gchar * bluez_leadvertisement1_dup_local_name(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_local_name(BluezLEAdvertisement1 * object, const gchar * value); + +guint16 bluez_leadvertisement1_get_appearance(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_appearance(BluezLEAdvertisement1 * object, guint16 value); + +guint16 bluez_leadvertisement1_get_duration(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_duration(BluezLEAdvertisement1 * object, guint16 value); + +guint16 bluez_leadvertisement1_get_timeout(BluezLEAdvertisement1 * object); +void bluez_leadvertisement1_set_timeout(BluezLEAdvertisement1 * object, guint16 value); + +/* ---- */ + +#define BLUEZ_TYPE_LEADVERTISEMENT1_PROXY (bluez_leadvertisement1_proxy_get_type()) +#define BLUEZ_LEADVERTISEMENT1_PROXY(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_LEADVERTISEMENT1_PROXY, BluezLEAdvertisement1Proxy)) +#define BLUEZ_LEADVERTISEMENT1_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_LEADVERTISEMENT1_PROXY, BluezLEAdvertisement1ProxyClass)) +#define BLUEZ_LEADVERTISEMENT1_PROXY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_LEADVERTISEMENT1_PROXY, BluezLEAdvertisement1ProxyClass)) +#define BLUEZ_IS_LEADVERTISEMENT1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_LEADVERTISEMENT1_PROXY)) +#define BLUEZ_IS_LEADVERTISEMENT1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_LEADVERTISEMENT1_PROXY)) + +typedef struct _BluezLEAdvertisement1Proxy BluezLEAdvertisement1Proxy; +typedef struct _BluezLEAdvertisement1ProxyClass BluezLEAdvertisement1ProxyClass; +typedef struct _BluezLEAdvertisement1ProxyPrivate BluezLEAdvertisement1ProxyPrivate; + +struct _BluezLEAdvertisement1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezLEAdvertisement1ProxyPrivate * priv; +}; + +struct _BluezLEAdvertisement1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_leadvertisement1_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezLEAdvertisement1Proxy, g_object_unref) +#endif + +void bluez_leadvertisement1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezLEAdvertisement1 * bluez_leadvertisement1_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezLEAdvertisement1 * bluez_leadvertisement1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error); + +void bluez_leadvertisement1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezLEAdvertisement1 * bluez_leadvertisement1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error); +BluezLEAdvertisement1 * bluez_leadvertisement1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_LEADVERTISEMENT1_SKELETON (bluez_leadvertisement1_skeleton_get_type()) +#define BLUEZ_LEADVERTISEMENT1_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_LEADVERTISEMENT1_SKELETON, BluezLEAdvertisement1Skeleton)) +#define BLUEZ_LEADVERTISEMENT1_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_LEADVERTISEMENT1_SKELETON, BluezLEAdvertisement1SkeletonClass)) +#define BLUEZ_LEADVERTISEMENT1_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_LEADVERTISEMENT1_SKELETON, BluezLEAdvertisement1SkeletonClass)) +#define BLUEZ_IS_LEADVERTISEMENT1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_LEADVERTISEMENT1_SKELETON)) +#define BLUEZ_IS_LEADVERTISEMENT1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_LEADVERTISEMENT1_SKELETON)) + +typedef struct _BluezLEAdvertisement1Skeleton BluezLEAdvertisement1Skeleton; +typedef struct _BluezLEAdvertisement1SkeletonClass BluezLEAdvertisement1SkeletonClass; +typedef struct _BluezLEAdvertisement1SkeletonPrivate BluezLEAdvertisement1SkeletonPrivate; + +struct _BluezLEAdvertisement1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezLEAdvertisement1SkeletonPrivate * priv; +}; + +struct _BluezLEAdvertisement1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_leadvertisement1_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezLEAdvertisement1Skeleton, g_object_unref) +#endif + +BluezLEAdvertisement1 * bluez_leadvertisement1_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.LEAdvertisingManager1 */ + +#define BLUEZ_TYPE_LEADVERTISING_MANAGER1 (bluez_leadvertising_manager1_get_type()) +#define BLUEZ_LEADVERTISING_MANAGER1(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_LEADVERTISING_MANAGER1, BluezLEAdvertisingManager1)) +#define BLUEZ_IS_LEADVERTISING_MANAGER1(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_LEADVERTISING_MANAGER1)) +#define BLUEZ_LEADVERTISING_MANAGER1_GET_IFACE(o) \ + (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_LEADVERTISING_MANAGER1, BluezLEAdvertisingManager1Iface)) + +struct _BluezLEAdvertisingManager1; +typedef struct _BluezLEAdvertisingManager1 BluezLEAdvertisingManager1; +typedef struct _BluezLEAdvertisingManager1Iface BluezLEAdvertisingManager1Iface; + +struct _BluezLEAdvertisingManager1Iface +{ + GTypeInterface parent_iface; + + gboolean (*handle_register_advertisement)(BluezLEAdvertisingManager1 * object, GDBusMethodInvocation * invocation, + const gchar * arg_advertisement, GVariant * arg_options); + + gboolean (*handle_unregister_advertisement)(BluezLEAdvertisingManager1 * object, GDBusMethodInvocation * invocation, + const gchar * arg_service); + + guchar (*get_active_instances)(BluezLEAdvertisingManager1 * object); + + const gchar * const * (*get_supported_includes)(BluezLEAdvertisingManager1 * object); + + guchar (*get_supported_instances)(BluezLEAdvertisingManager1 * object); + + const gchar * const * (*get_supported_secondary_channels)(BluezLEAdvertisingManager1 * object); +}; + +GType bluez_leadvertising_manager1_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_leadvertising_manager1_interface_info(void); +guint bluez_leadvertising_manager1_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_leadvertising_manager1_complete_register_advertisement(BluezLEAdvertisingManager1 * object, + GDBusMethodInvocation * invocation); + +void bluez_leadvertising_manager1_complete_unregister_advertisement(BluezLEAdvertisingManager1 * object, + GDBusMethodInvocation * invocation); + +/* D-Bus method calls: */ +void bluez_leadvertising_manager1_call_register_advertisement(BluezLEAdvertisingManager1 * proxy, const gchar * arg_advertisement, + GVariant * arg_options, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_leadvertising_manager1_call_register_advertisement_finish(BluezLEAdvertisingManager1 * proxy, GAsyncResult * res, + GError ** error); + +gboolean bluez_leadvertising_manager1_call_register_advertisement_sync(BluezLEAdvertisingManager1 * proxy, + const gchar * arg_advertisement, GVariant * arg_options, + GCancellable * cancellable, GError ** error); + +void bluez_leadvertising_manager1_call_unregister_advertisement(BluezLEAdvertisingManager1 * proxy, const gchar * arg_service, + GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_leadvertising_manager1_call_unregister_advertisement_finish(BluezLEAdvertisingManager1 * proxy, GAsyncResult * res, + GError ** error); + +gboolean bluez_leadvertising_manager1_call_unregister_advertisement_sync(BluezLEAdvertisingManager1 * proxy, + const gchar * arg_service, GCancellable * cancellable, + GError ** error); + +/* D-Bus property accessors: */ +guchar bluez_leadvertising_manager1_get_active_instances(BluezLEAdvertisingManager1 * object); +void bluez_leadvertising_manager1_set_active_instances(BluezLEAdvertisingManager1 * object, guchar value); + +guchar bluez_leadvertising_manager1_get_supported_instances(BluezLEAdvertisingManager1 * object); +void bluez_leadvertising_manager1_set_supported_instances(BluezLEAdvertisingManager1 * object, guchar value); + +const gchar * const * bluez_leadvertising_manager1_get_supported_includes(BluezLEAdvertisingManager1 * object); +gchar ** bluez_leadvertising_manager1_dup_supported_includes(BluezLEAdvertisingManager1 * object); +void bluez_leadvertising_manager1_set_supported_includes(BluezLEAdvertisingManager1 * object, const gchar * const * value); + +const gchar * const * bluez_leadvertising_manager1_get_supported_secondary_channels(BluezLEAdvertisingManager1 * object); +gchar ** bluez_leadvertising_manager1_dup_supported_secondary_channels(BluezLEAdvertisingManager1 * object); +void bluez_leadvertising_manager1_set_supported_secondary_channels(BluezLEAdvertisingManager1 * object, + const gchar * const * value); + +/* ---- */ + +#define BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY (bluez_leadvertising_manager1_proxy_get_type()) +#define BLUEZ_LEADVERTISING_MANAGER1_PROXY(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY, BluezLEAdvertisingManager1Proxy)) +#define BLUEZ_LEADVERTISING_MANAGER1_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY, BluezLEAdvertisingManager1ProxyClass)) +#define BLUEZ_LEADVERTISING_MANAGER1_PROXY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY, BluezLEAdvertisingManager1ProxyClass)) +#define BLUEZ_IS_LEADVERTISING_MANAGER1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY)) +#define BLUEZ_IS_LEADVERTISING_MANAGER1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_LEADVERTISING_MANAGER1_PROXY)) + +typedef struct _BluezLEAdvertisingManager1Proxy BluezLEAdvertisingManager1Proxy; +typedef struct _BluezLEAdvertisingManager1ProxyClass BluezLEAdvertisingManager1ProxyClass; +typedef struct _BluezLEAdvertisingManager1ProxyPrivate BluezLEAdvertisingManager1ProxyPrivate; + +struct _BluezLEAdvertisingManager1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezLEAdvertisingManager1ProxyPrivate * priv; +}; + +struct _BluezLEAdvertisingManager1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_leadvertising_manager1_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezLEAdvertisingManager1Proxy, g_object_unref) +#endif + +void bluez_leadvertising_manager1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error); + +void bluez_leadvertising_manager1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error); +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_LEADVERTISING_MANAGER1_SKELETON (bluez_leadvertising_manager1_skeleton_get_type()) +#define BLUEZ_LEADVERTISING_MANAGER1_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_LEADVERTISING_MANAGER1_SKELETON, BluezLEAdvertisingManager1Skeleton)) +#define BLUEZ_LEADVERTISING_MANAGER1_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_LEADVERTISING_MANAGER1_SKELETON, BluezLEAdvertisingManager1SkeletonClass)) +#define BLUEZ_LEADVERTISING_MANAGER1_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_LEADVERTISING_MANAGER1_SKELETON, BluezLEAdvertisingManager1SkeletonClass)) +#define BLUEZ_IS_LEADVERTISING_MANAGER1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_LEADVERTISING_MANAGER1_SKELETON)) +#define BLUEZ_IS_LEADVERTISING_MANAGER1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_LEADVERTISING_MANAGER1_SKELETON)) + +typedef struct _BluezLEAdvertisingManager1Skeleton BluezLEAdvertisingManager1Skeleton; +typedef struct _BluezLEAdvertisingManager1SkeletonClass BluezLEAdvertisingManager1SkeletonClass; +typedef struct _BluezLEAdvertisingManager1SkeletonPrivate BluezLEAdvertisingManager1SkeletonPrivate; + +struct _BluezLEAdvertisingManager1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezLEAdvertisingManager1SkeletonPrivate * priv; +}; + +struct _BluezLEAdvertisingManager1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_leadvertising_manager1_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezLEAdvertisingManager1Skeleton, g_object_unref) +#endif + +BluezLEAdvertisingManager1 * bluez_leadvertising_manager1_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.DBus.Properties */ + +#define BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES (bluez_org_freedesktop_dbus_properties_get_type()) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES, BluezOrgFreedesktopDBusProperties)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_PROPERTIES(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_GET_IFACE(o) \ + (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES, BluezOrgFreedesktopDBusPropertiesIface)) + +struct _BluezOrgFreedesktopDBusProperties; +typedef struct _BluezOrgFreedesktopDBusProperties BluezOrgFreedesktopDBusProperties; +typedef struct _BluezOrgFreedesktopDBusPropertiesIface BluezOrgFreedesktopDBusPropertiesIface; + +struct _BluezOrgFreedesktopDBusPropertiesIface +{ + GTypeInterface parent_iface; + + gboolean (*handle_get)(BluezOrgFreedesktopDBusProperties * object, GDBusMethodInvocation * invocation, + const gchar * arg_interface, const gchar * arg_name); + + gboolean (*handle_get_all)(BluezOrgFreedesktopDBusProperties * object, GDBusMethodInvocation * invocation, + const gchar * arg_interface); + + gboolean (*handle_set)(BluezOrgFreedesktopDBusProperties * object, GDBusMethodInvocation * invocation, + const gchar * arg_interface, const gchar * arg_name, GVariant * arg_value); + + void (*properties_changed)(BluezOrgFreedesktopDBusProperties * object, const gchar * arg_interface, + GVariant * arg_changed_properties, const gchar * const * arg_invalidated_properties); +}; + +GType bluez_org_freedesktop_dbus_properties_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_org_freedesktop_dbus_properties_interface_info(void); +guint bluez_org_freedesktop_dbus_properties_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_org_freedesktop_dbus_properties_complete_get(BluezOrgFreedesktopDBusProperties * object, + GDBusMethodInvocation * invocation, GVariant * value); + +void bluez_org_freedesktop_dbus_properties_complete_set(BluezOrgFreedesktopDBusProperties * object, + GDBusMethodInvocation * invocation); + +void bluez_org_freedesktop_dbus_properties_complete_get_all(BluezOrgFreedesktopDBusProperties * object, + GDBusMethodInvocation * invocation, GVariant * properties); + +/* D-Bus signal emissions functions: */ +void bluez_org_freedesktop_dbus_properties_emit_properties_changed(BluezOrgFreedesktopDBusProperties * object, + const gchar * arg_interface, GVariant * arg_changed_properties, + const gchar * const * arg_invalidated_properties); + +/* D-Bus method calls: */ +void bluez_org_freedesktop_dbus_properties_call_get(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + const gchar * arg_name, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_org_freedesktop_dbus_properties_call_get_finish(BluezOrgFreedesktopDBusProperties * proxy, GVariant ** out_value, + GAsyncResult * res, GError ** error); + +gboolean bluez_org_freedesktop_dbus_properties_call_get_sync(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + const gchar * arg_name, GVariant ** out_value, + GCancellable * cancellable, GError ** error); + +void bluez_org_freedesktop_dbus_properties_call_set(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + const gchar * arg_name, GVariant * arg_value, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_org_freedesktop_dbus_properties_call_set_finish(BluezOrgFreedesktopDBusProperties * proxy, GAsyncResult * res, + GError ** error); + +gboolean bluez_org_freedesktop_dbus_properties_call_set_sync(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + const gchar * arg_name, GVariant * arg_value, + GCancellable * cancellable, GError ** error); + +void bluez_org_freedesktop_dbus_properties_call_get_all(BluezOrgFreedesktopDBusProperties * proxy, const gchar * arg_interface, + GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_org_freedesktop_dbus_properties_call_get_all_finish(BluezOrgFreedesktopDBusProperties * proxy, + GVariant ** out_properties, GAsyncResult * res, GError ** error); + +gboolean bluez_org_freedesktop_dbus_properties_call_get_all_sync(BluezOrgFreedesktopDBusProperties * proxy, + const gchar * arg_interface, GVariant ** out_properties, + GCancellable * cancellable, GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY (bluez_org_freedesktop_dbus_properties_proxy_get_type()) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY, BluezOrgFreedesktopDBusPropertiesProxy)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY, BluezOrgFreedesktopDBusPropertiesProxyClass)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY, BluezOrgFreedesktopDBusPropertiesProxyClass)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY(o) \ + (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_PROXY)) + +typedef struct _BluezOrgFreedesktopDBusPropertiesProxy BluezOrgFreedesktopDBusPropertiesProxy; +typedef struct _BluezOrgFreedesktopDBusPropertiesProxyClass BluezOrgFreedesktopDBusPropertiesProxyClass; +typedef struct _BluezOrgFreedesktopDBusPropertiesProxyPrivate BluezOrgFreedesktopDBusPropertiesProxyPrivate; + +struct _BluezOrgFreedesktopDBusPropertiesProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezOrgFreedesktopDBusPropertiesProxyPrivate * priv; +}; + +struct _BluezOrgFreedesktopDBusPropertiesProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_org_freedesktop_dbus_properties_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezOrgFreedesktopDBusPropertiesProxy, g_object_unref) +#endif + +void bluez_org_freedesktop_dbus_properties_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +BluezOrgFreedesktopDBusProperties * bluez_org_freedesktop_dbus_properties_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezOrgFreedesktopDBusProperties * +bluez_org_freedesktop_dbus_properties_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error); + +void bluez_org_freedesktop_dbus_properties_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +BluezOrgFreedesktopDBusProperties * bluez_org_freedesktop_dbus_properties_proxy_new_for_bus_finish(GAsyncResult * res, + GError ** error); +BluezOrgFreedesktopDBusProperties * +bluez_org_freedesktop_dbus_properties_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON (bluez_org_freedesktop_dbus_properties_skeleton_get_type()) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON, \ + BluezOrgFreedesktopDBusPropertiesSkeleton)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON, \ + BluezOrgFreedesktopDBusPropertiesSkeletonClass)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON, \ + BluezOrgFreedesktopDBusPropertiesSkeletonClass)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_PROPERTIES_SKELETON)) + +typedef struct _BluezOrgFreedesktopDBusPropertiesSkeleton BluezOrgFreedesktopDBusPropertiesSkeleton; +typedef struct _BluezOrgFreedesktopDBusPropertiesSkeletonClass BluezOrgFreedesktopDBusPropertiesSkeletonClass; +typedef struct _BluezOrgFreedesktopDBusPropertiesSkeletonPrivate BluezOrgFreedesktopDBusPropertiesSkeletonPrivate; + +struct _BluezOrgFreedesktopDBusPropertiesSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezOrgFreedesktopDBusPropertiesSkeletonPrivate * priv; +}; + +struct _BluezOrgFreedesktopDBusPropertiesSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_org_freedesktop_dbus_properties_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezOrgFreedesktopDBusPropertiesSkeleton, g_object_unref) +#endif + +BluezOrgFreedesktopDBusProperties * bluez_org_freedesktop_dbus_properties_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.bluez.ProfileManager1 */ + +#define BLUEZ_TYPE_PROFILE_MANAGER1 (bluez_profile_manager1_get_type()) +#define BLUEZ_PROFILE_MANAGER1(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_PROFILE_MANAGER1, BluezProfileManager1)) +#define BLUEZ_IS_PROFILE_MANAGER1(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_PROFILE_MANAGER1)) +#define BLUEZ_PROFILE_MANAGER1_GET_IFACE(o) \ + (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_PROFILE_MANAGER1, BluezProfileManager1Iface)) + +struct _BluezProfileManager1; +typedef struct _BluezProfileManager1 BluezProfileManager1; +typedef struct _BluezProfileManager1Iface BluezProfileManager1Iface; + +struct _BluezProfileManager1Iface +{ + GTypeInterface parent_iface; + + gboolean (*handle_register_profile)(BluezProfileManager1 * object, GDBusMethodInvocation * invocation, + const gchar * arg_profile, const gchar * arg_UUID, GVariant * arg_options); + + gboolean (*handle_unregister_profile)(BluezProfileManager1 * object, GDBusMethodInvocation * invocation, + const gchar * arg_profile); +}; + +GType bluez_profile_manager1_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_profile_manager1_interface_info(void); +guint bluez_profile_manager1_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_profile_manager1_complete_register_profile(BluezProfileManager1 * object, GDBusMethodInvocation * invocation); + +void bluez_profile_manager1_complete_unregister_profile(BluezProfileManager1 * object, GDBusMethodInvocation * invocation); + +/* D-Bus method calls: */ +void bluez_profile_manager1_call_register_profile(BluezProfileManager1 * proxy, const gchar * arg_profile, const gchar * arg_UUID, + GVariant * arg_options, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_profile_manager1_call_register_profile_finish(BluezProfileManager1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_profile_manager1_call_register_profile_sync(BluezProfileManager1 * proxy, const gchar * arg_profile, + const gchar * arg_UUID, GVariant * arg_options, + GCancellable * cancellable, GError ** error); + +void bluez_profile_manager1_call_unregister_profile(BluezProfileManager1 * proxy, const gchar * arg_profile, + GCancellable * cancellable, GAsyncReadyCallback callback, gpointer user_data); + +gboolean bluez_profile_manager1_call_unregister_profile_finish(BluezProfileManager1 * proxy, GAsyncResult * res, GError ** error); + +gboolean bluez_profile_manager1_call_unregister_profile_sync(BluezProfileManager1 * proxy, const gchar * arg_profile, + GCancellable * cancellable, GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_PROFILE_MANAGER1_PROXY (bluez_profile_manager1_proxy_get_type()) +#define BLUEZ_PROFILE_MANAGER1_PROXY(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_PROFILE_MANAGER1_PROXY, BluezProfileManager1Proxy)) +#define BLUEZ_PROFILE_MANAGER1_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_PROFILE_MANAGER1_PROXY, BluezProfileManager1ProxyClass)) +#define BLUEZ_PROFILE_MANAGER1_PROXY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_PROFILE_MANAGER1_PROXY, BluezProfileManager1ProxyClass)) +#define BLUEZ_IS_PROFILE_MANAGER1_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_PROFILE_MANAGER1_PROXY)) +#define BLUEZ_IS_PROFILE_MANAGER1_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_PROFILE_MANAGER1_PROXY)) + +typedef struct _BluezProfileManager1Proxy BluezProfileManager1Proxy; +typedef struct _BluezProfileManager1ProxyClass BluezProfileManager1ProxyClass; +typedef struct _BluezProfileManager1ProxyPrivate BluezProfileManager1ProxyPrivate; + +struct _BluezProfileManager1Proxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezProfileManager1ProxyPrivate * priv; +}; + +struct _BluezProfileManager1ProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_profile_manager1_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezProfileManager1Proxy, g_object_unref) +#endif + +void bluez_profile_manager1_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezProfileManager1 * bluez_profile_manager1_proxy_new_finish(GAsyncResult * res, GError ** error); +BluezProfileManager1 * bluez_profile_manager1_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error); + +void bluez_profile_manager1_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +BluezProfileManager1 * bluez_profile_manager1_proxy_new_for_bus_finish(GAsyncResult * res, GError ** error); +BluezProfileManager1 * bluez_profile_manager1_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_PROFILE_MANAGER1_SKELETON (bluez_profile_manager1_skeleton_get_type()) +#define BLUEZ_PROFILE_MANAGER1_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_PROFILE_MANAGER1_SKELETON, BluezProfileManager1Skeleton)) +#define BLUEZ_PROFILE_MANAGER1_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_PROFILE_MANAGER1_SKELETON, BluezProfileManager1SkeletonClass)) +#define BLUEZ_PROFILE_MANAGER1_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_PROFILE_MANAGER1_SKELETON, BluezProfileManager1SkeletonClass)) +#define BLUEZ_IS_PROFILE_MANAGER1_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_PROFILE_MANAGER1_SKELETON)) +#define BLUEZ_IS_PROFILE_MANAGER1_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_PROFILE_MANAGER1_SKELETON)) + +typedef struct _BluezProfileManager1Skeleton BluezProfileManager1Skeleton; +typedef struct _BluezProfileManager1SkeletonClass BluezProfileManager1SkeletonClass; +typedef struct _BluezProfileManager1SkeletonPrivate BluezProfileManager1SkeletonPrivate; + +struct _BluezProfileManager1Skeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezProfileManager1SkeletonPrivate * priv; +}; + +struct _BluezProfileManager1SkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_profile_manager1_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezProfileManager1Skeleton, g_object_unref) +#endif + +BluezProfileManager1 * bluez_profile_manager1_skeleton_new(void); + +/* ------------------------------------------------------------------------ */ +/* Declarations for org.freedesktop.DBus.ObjectManager */ + +#define BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER (bluez_org_freedesktop_dbus_object_manager_get_type()) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER, BluezOrgFreedesktopDBusObjectManager)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER(o) \ + (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_GET_IFACE(o) \ + (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER, BluezOrgFreedesktopDBusObjectManagerIface)) + +struct _BluezOrgFreedesktopDBusObjectManager; +typedef struct _BluezOrgFreedesktopDBusObjectManager BluezOrgFreedesktopDBusObjectManager; +typedef struct _BluezOrgFreedesktopDBusObjectManagerIface BluezOrgFreedesktopDBusObjectManagerIface; + +struct _BluezOrgFreedesktopDBusObjectManagerIface +{ + GTypeInterface parent_iface; + + gboolean (*handle_get_managed_objects)(BluezOrgFreedesktopDBusObjectManager * object, GDBusMethodInvocation * invocation); + + void (*interfaces_added)(BluezOrgFreedesktopDBusObjectManager * object, const gchar * arg_object, GVariant * arg_interfaces); + + void (*interfaces_removed)(BluezOrgFreedesktopDBusObjectManager * object, const gchar * arg_object, + const gchar * const * arg_interfaces); +}; + +GType bluez_org_freedesktop_dbus_object_manager_get_type(void) G_GNUC_CONST; + +GDBusInterfaceInfo * bluez_org_freedesktop_dbus_object_manager_interface_info(void); +guint bluez_org_freedesktop_dbus_object_manager_override_properties(GObjectClass * klass, guint property_id_begin); + +/* D-Bus method call completion functions: */ +void bluez_org_freedesktop_dbus_object_manager_complete_get_managed_objects(BluezOrgFreedesktopDBusObjectManager * object, + GDBusMethodInvocation * invocation, GVariant * objects); + +/* D-Bus signal emissions functions: */ +void bluez_org_freedesktop_dbus_object_manager_emit_interfaces_added(BluezOrgFreedesktopDBusObjectManager * object, + const gchar * arg_object, GVariant * arg_interfaces); + +void bluez_org_freedesktop_dbus_object_manager_emit_interfaces_removed(BluezOrgFreedesktopDBusObjectManager * object, + const gchar * arg_object, + const gchar * const * arg_interfaces); + +/* D-Bus method calls: */ +void bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects(BluezOrgFreedesktopDBusObjectManager * proxy, + GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +gboolean bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects_finish(BluezOrgFreedesktopDBusObjectManager * proxy, + GVariant ** out_objects, GAsyncResult * res, + GError ** error); + +gboolean bluez_org_freedesktop_dbus_object_manager_call_get_managed_objects_sync(BluezOrgFreedesktopDBusObjectManager * proxy, + GVariant ** out_objects, + GCancellable * cancellable, GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY (bluez_org_freedesktop_dbus_object_manager_proxy_get_type()) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY, \ + BluezOrgFreedesktopDBusObjectManagerProxy)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY, \ + BluezOrgFreedesktopDBusObjectManagerProxyClass)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY, \ + BluezOrgFreedesktopDBusObjectManagerProxyClass)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY(o) \ + (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY_CLASS(k) \ + (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_PROXY)) + +typedef struct _BluezOrgFreedesktopDBusObjectManagerProxy BluezOrgFreedesktopDBusObjectManagerProxy; +typedef struct _BluezOrgFreedesktopDBusObjectManagerProxyClass BluezOrgFreedesktopDBusObjectManagerProxyClass; +typedef struct _BluezOrgFreedesktopDBusObjectManagerProxyPrivate BluezOrgFreedesktopDBusObjectManagerProxyPrivate; + +struct _BluezOrgFreedesktopDBusObjectManagerProxy +{ + /*< private >*/ + GDBusProxy parent_instance; + BluezOrgFreedesktopDBusObjectManagerProxyPrivate * priv; +}; + +struct _BluezOrgFreedesktopDBusObjectManagerProxyClass +{ + GDBusProxyClass parent_class; +}; + +GType bluez_org_freedesktop_dbus_object_manager_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezOrgFreedesktopDBusObjectManagerProxy, g_object_unref) +#endif + +void bluez_org_freedesktop_dbus_object_manager_proxy_new(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +BluezOrgFreedesktopDBusObjectManager * bluez_org_freedesktop_dbus_object_manager_proxy_new_finish(GAsyncResult * res, + GError ** error); +BluezOrgFreedesktopDBusObjectManager * +bluez_org_freedesktop_dbus_object_manager_proxy_new_sync(GDBusConnection * connection, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GError ** error); + +void bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +BluezOrgFreedesktopDBusObjectManager * bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus_finish(GAsyncResult * res, + GError ** error); +BluezOrgFreedesktopDBusObjectManager * +bluez_org_freedesktop_dbus_object_manager_proxy_new_for_bus_sync(GBusType bus_type, GDBusProxyFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, + GError ** error); + +/* ---- */ + +#define BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON (bluez_org_freedesktop_dbus_object_manager_skeleton_get_type()) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON, \ + BluezOrgFreedesktopDBusObjectManagerSkeleton)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON, \ + BluezOrgFreedesktopDBusObjectManagerSkeletonClass)) +#define BLUEZ_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON, \ + BluezOrgFreedesktopDBusObjectManagerSkeletonClass)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON(o) \ + (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON)) +#define BLUEZ_IS_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON_CLASS(k) \ + (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_ORG_FREEDESKTOP_DBUS_OBJECT_MANAGER_SKELETON)) + +typedef struct _BluezOrgFreedesktopDBusObjectManagerSkeleton BluezOrgFreedesktopDBusObjectManagerSkeleton; +typedef struct _BluezOrgFreedesktopDBusObjectManagerSkeletonClass BluezOrgFreedesktopDBusObjectManagerSkeletonClass; +typedef struct _BluezOrgFreedesktopDBusObjectManagerSkeletonPrivate BluezOrgFreedesktopDBusObjectManagerSkeletonPrivate; + +struct _BluezOrgFreedesktopDBusObjectManagerSkeleton +{ + /*< private >*/ + GDBusInterfaceSkeleton parent_instance; + BluezOrgFreedesktopDBusObjectManagerSkeletonPrivate * priv; +}; + +struct _BluezOrgFreedesktopDBusObjectManagerSkeletonClass +{ + GDBusInterfaceSkeletonClass parent_class; +}; + +GType bluez_org_freedesktop_dbus_object_manager_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezOrgFreedesktopDBusObjectManagerSkeleton, g_object_unref) +#endif + +BluezOrgFreedesktopDBusObjectManager * bluez_org_freedesktop_dbus_object_manager_skeleton_new(void); + +/* ---- */ + +#define BLUEZ_TYPE_OBJECT (bluez_object_get_type()) +#define BLUEZ_OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_OBJECT, BluezObject)) +#define BLUEZ_IS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_OBJECT)) +#define BLUEZ_OBJECT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), BLUEZ_TYPE_OBJECT, BluezObject)) + +struct _BluezObject; +typedef struct _BluezObject BluezObject; +typedef struct _BluezObjectIface BluezObjectIface; + +struct _BluezObjectIface +{ + GTypeInterface parent_iface; +}; + +GType bluez_object_get_type(void) G_GNUC_CONST; + +BluezAdapter1 * bluez_object_get_adapter1(BluezObject * object); +BluezDevice1 * bluez_object_get_device1(BluezObject * object); +BluezGattManager1 * bluez_object_get_gatt_manager1(BluezObject * object); +BluezGattService1 * bluez_object_get_gatt_service1(BluezObject * object); +BluezGattCharacteristic1 * bluez_object_get_gatt_characteristic1(BluezObject * object); +BluezGattDescriptor1 * bluez_object_get_gatt_descriptor1(BluezObject * object); +BluezLEAdvertisement1 * bluez_object_get_leadvertisement1(BluezObject * object); +BluezLEAdvertisingManager1 * bluez_object_get_leadvertising_manager1(BluezObject * object); +BluezOrgFreedesktopDBusProperties * bluez_object_get_org_freedesktop_dbus_properties(BluezObject * object); +BluezProfileManager1 * bluez_object_get_profile_manager1(BluezObject * object); +BluezOrgFreedesktopDBusObjectManager * bluez_object_get_org_freedesktop_dbus_object_manager(BluezObject * object); +BluezAdapter1 * bluez_object_peek_adapter1(BluezObject * object); +BluezDevice1 * bluez_object_peek_device1(BluezObject * object); +BluezGattManager1 * bluez_object_peek_gatt_manager1(BluezObject * object); +BluezGattService1 * bluez_object_peek_gatt_service1(BluezObject * object); +BluezGattCharacteristic1 * bluez_object_peek_gatt_characteristic1(BluezObject * object); +BluezGattDescriptor1 * bluez_object_peek_gatt_descriptor1(BluezObject * object); +BluezLEAdvertisement1 * bluez_object_peek_leadvertisement1(BluezObject * object); +BluezLEAdvertisingManager1 * bluez_object_peek_leadvertising_manager1(BluezObject * object); +BluezOrgFreedesktopDBusProperties * bluez_object_peek_org_freedesktop_dbus_properties(BluezObject * object); +BluezProfileManager1 * bluez_object_peek_profile_manager1(BluezObject * object); +BluezOrgFreedesktopDBusObjectManager * bluez_object_peek_org_freedesktop_dbus_object_manager(BluezObject * object); + +#define BLUEZ_TYPE_OBJECT_PROXY (bluez_object_proxy_get_type()) +#define BLUEZ_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_OBJECT_PROXY, BluezObjectProxy)) +#define BLUEZ_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_OBJECT_PROXY, BluezObjectProxyClass)) +#define BLUEZ_OBJECT_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_OBJECT_PROXY, BluezObjectProxyClass)) +#define BLUEZ_IS_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_OBJECT_PROXY)) +#define BLUEZ_IS_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_OBJECT_PROXY)) + +typedef struct _BluezObjectProxy BluezObjectProxy; +typedef struct _BluezObjectProxyClass BluezObjectProxyClass; +typedef struct _BluezObjectProxyPrivate BluezObjectProxyPrivate; + +struct _BluezObjectProxy +{ + /*< private >*/ + GDBusObjectProxy parent_instance; + BluezObjectProxyPrivate * priv; +}; + +struct _BluezObjectProxyClass +{ + GDBusObjectProxyClass parent_class; +}; + +GType bluez_object_proxy_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezObjectProxy, g_object_unref) +#endif + +BluezObjectProxy * bluez_object_proxy_new(GDBusConnection * connection, const gchar * object_path); + +#define BLUEZ_TYPE_OBJECT_SKELETON (bluez_object_skeleton_get_type()) +#define BLUEZ_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_OBJECT_SKELETON, BluezObjectSkeleton)) +#define BLUEZ_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_OBJECT_SKELETON, BluezObjectSkeletonClass)) +#define BLUEZ_OBJECT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_OBJECT_SKELETON, BluezObjectSkeletonClass)) +#define BLUEZ_IS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_OBJECT_SKELETON)) +#define BLUEZ_IS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_OBJECT_SKELETON)) + +typedef struct _BluezObjectSkeleton BluezObjectSkeleton; +typedef struct _BluezObjectSkeletonClass BluezObjectSkeletonClass; +typedef struct _BluezObjectSkeletonPrivate BluezObjectSkeletonPrivate; + +struct _BluezObjectSkeleton +{ + /*< private >*/ + GDBusObjectSkeleton parent_instance; + BluezObjectSkeletonPrivate * priv; +}; + +struct _BluezObjectSkeletonClass +{ + GDBusObjectSkeletonClass parent_class; +}; + +GType bluez_object_skeleton_get_type(void) G_GNUC_CONST; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezObjectSkeleton, g_object_unref) +#endif + +BluezObjectSkeleton * bluez_object_skeleton_new(const gchar * object_path); +void bluez_object_skeleton_set_adapter1(BluezObjectSkeleton * object, BluezAdapter1 * interface_); +void bluez_object_skeleton_set_device1(BluezObjectSkeleton * object, BluezDevice1 * interface_); +void bluez_object_skeleton_set_gatt_manager1(BluezObjectSkeleton * object, BluezGattManager1 * interface_); +void bluez_object_skeleton_set_gatt_service1(BluezObjectSkeleton * object, BluezGattService1 * interface_); +void bluez_object_skeleton_set_gatt_characteristic1(BluezObjectSkeleton * object, BluezGattCharacteristic1 * interface_); +void bluez_object_skeleton_set_gatt_descriptor1(BluezObjectSkeleton * object, BluezGattDescriptor1 * interface_); +void bluez_object_skeleton_set_leadvertisement1(BluezObjectSkeleton * object, BluezLEAdvertisement1 * interface_); +void bluez_object_skeleton_set_leadvertising_manager1(BluezObjectSkeleton * object, BluezLEAdvertisingManager1 * interface_); +void bluez_object_skeleton_set_org_freedesktop_dbus_properties(BluezObjectSkeleton * object, + BluezOrgFreedesktopDBusProperties * interface_); +void bluez_object_skeleton_set_profile_manager1(BluezObjectSkeleton * object, BluezProfileManager1 * interface_); +void bluez_object_skeleton_set_org_freedesktop_dbus_object_manager(BluezObjectSkeleton * object, + BluezOrgFreedesktopDBusObjectManager * interface_); + +/* ---- */ + +#define BLUEZ_TYPE_OBJECT_MANAGER_CLIENT (bluez_object_manager_client_get_type()) +#define BLUEZ_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, BluezObjectManagerClient)) +#define BLUEZ_OBJECT_MANAGER_CLIENT_CLASS(k) \ + (G_TYPE_CHECK_CLASS_CAST((k), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, BluezObjectManagerClientClass)) +#define BLUEZ_OBJECT_MANAGER_CLIENT_GET_CLASS(o) \ + (G_TYPE_INSTANCE_GET_CLASS((o), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT, BluezObjectManagerClientClass)) +#define BLUEZ_IS_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT)) +#define BLUEZ_IS_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), BLUEZ_TYPE_OBJECT_MANAGER_CLIENT)) + +typedef struct _BluezObjectManagerClient BluezObjectManagerClient; +typedef struct _BluezObjectManagerClientClass BluezObjectManagerClientClass; +typedef struct _BluezObjectManagerClientPrivate BluezObjectManagerClientPrivate; + +struct _BluezObjectManagerClient +{ + /*< private >*/ + GDBusObjectManagerClient parent_instance; + BluezObjectManagerClientPrivate * priv; +}; + +struct _BluezObjectManagerClientClass +{ + GDBusObjectManagerClientClass parent_class; +}; + +#if GLIB_CHECK_VERSION(2, 44, 0) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(BluezObjectManagerClient, g_object_unref) +#endif + +GType bluez_object_manager_client_get_type(void) G_GNUC_CONST; + +GType bluez_object_manager_client_get_proxy_type(GDBusObjectManagerClient * manager, const gchar * object_path, + const gchar * interface_name, gpointer user_data); + +void bluez_object_manager_client_new(GDBusConnection * connection, GDBusObjectManagerClientFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +GDBusObjectManager * bluez_object_manager_client_new_finish(GAsyncResult * res, GError ** error); +GDBusObjectManager * bluez_object_manager_client_new_sync(GDBusConnection * connection, GDBusObjectManagerClientFlags flags, + const gchar * name, const gchar * object_path, GCancellable * cancellable, + GError ** error); + +void bluez_object_manager_client_new_for_bus(GBusType bus_type, GDBusObjectManagerClientFlags flags, const gchar * name, + const gchar * object_path, GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +GDBusObjectManager * bluez_object_manager_client_new_for_bus_finish(GAsyncResult * res, GError ** error); +GDBusObjectManager * bluez_object_manager_client_new_for_bus_sync(GBusType bus_type, GDBusObjectManagerClientFlags flags, + const gchar * name, const gchar * object_path, + GCancellable * cancellable, GError ** error); + +G_END_DECLS + +#endif /* __DBUSBLUEZ_H__ */ diff --git a/src/platform/Linux/dbus/org.bluez.xml b/src/platform/Linux/dbus/org.bluez.xml index 8a17dcfa6a41f1..6f1b8197fd1132 100644 --- a/src/platform/Linux/dbus/org.bluez.xml +++ b/src/platform/Linux/dbus/org.bluez.xml @@ -112,17 +112,21 @@ - + - - + + + + - - + + + + @@ -136,9 +140,12 @@ + - + + + @@ -147,16 +154,40 @@ - - + + + + - - + + + + - + + + + + + + + + + + + + + + + + + + + + diff --git a/src/platform/Makefile.am b/src/platform/Makefile.am index 51f471785fe842..7fe679da77af20 100644 --- a/src/platform/Makefile.am +++ b/src/platform/Makefile.am @@ -231,6 +231,7 @@ Linux/gen/DbusBluez.c: Linux/dbus/org.bluez.xml nodist_libDeviceLayer_a_SOURCES += \ Linux/gen/DbusBluez.c \ + Linux/CHIPBluezHelper.cpp \ $(NULL) endif #CONFIG_BLE_PLATFORM_BLUEZ diff --git a/src/platform/tests/Makefile.am b/src/platform/tests/Makefile.am index 18cb2e28710a2a..1263c44fd5aa96 100644 --- a/src/platform/tests/Makefile.am +++ b/src/platform/tests/Makefile.am @@ -88,6 +88,19 @@ dist_libPlatformTests_a_HEADERS += \ $(NULL) endif # CHIP_WITH_OT_BR_POSIX + +if CONFIG_BLE_PLATFORM_BLUEZ +AM_CPPFLAGS += \ + $(DBUS_CFLAGS) \ + $(NULL) + +libPlatformTests_a_SOURCES += TestCHIPoBLEStackMgr.cpp + +dist_libPlatformTests_a_HEADERS += \ + TestCHIPoBLEStackMgr.h \ + $(NULL) +endif # CONFIG_BLE_PLATFORM_BLUEZ + endif # CHIP_DEVICE_LAYER_TARGET_LINUX @@ -97,6 +110,7 @@ CHIP_LDADD = \ $(top_builddir)/src/system/libSystemLayer.a \ $(top_builddir)/src/crypto/libChipCrypto.a \ $(top_builddir)/src/lib/support/libSupportLayer.a \ + $(top_builddir)/src/ble/libBleLayer.a \ $(NULL) if CHIP_DEVICE_LAYER_TARGET_LINUX @@ -129,6 +143,16 @@ check_PROGRAMS = \ TestConfigurationMgr \ $(NULL) +if CHIP_DEVICE_LAYER_TARGET_LINUX +if CONFIG_BLE_PLATFORM_BLUEZ +check_PROGRAMS += TestCHIPoBLEStackMgr + +TestCHIPoBLEStackMgr_LDADD = $(COMMON_LDADD) +TestCHIPoBLEStackMgr_SOURCES = TestCHIPoBLEStackMgrDriver.cpp + +endif # CONFIG_BLE_PLATFORM_BLUEZ +endif # CHIP_DEVICE_LAYER_TARGET_LINUX + if CHIP_DEVICE_LAYER_TARGET_LINUX if CHIP_WITH_OT_BR_POSIX check_PROGRAMS += TestThreadStackMgr @@ -144,6 +168,7 @@ endif # 'check' target is run. # TestThreadStackMgr requires additional daemon to be launched +# TestCHIPoBLEStackMgr requires additional daemon to be launched TESTS = \ TestPlatformTime \ TestPlatformMgr \ diff --git a/src/platform/tests/TestCHIPoBLEStackMgr.cpp b/src/platform/tests/TestCHIPoBLEStackMgr.cpp new file mode 100644 index 00000000000000..05ba02f3a4d051 --- /dev/null +++ b/src/platform/tests/TestCHIPoBLEStackMgr.cpp @@ -0,0 +1,68 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "platform/internal/CHIPDeviceLayerInternal.h" +#include +#include +#include +#include + +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#include "platform/PlatformManager.h" +#include "platform/internal/BLEManager.h" + +#if CHIP_DEVICE_LAYER_TARGET == LINUX +#include + +struct DBusConnectionDeleter +{ + void operator()(DBusConnection * aConnection) { dbus_connection_unref(aConnection); } +}; + +using UniqueDBusConnection = std::unique_ptr; +#endif + +void EventHandler(const chip::DeviceLayer::ChipDeviceEvent * event, intptr_t arg) +{ + (void) arg; + if (event->Type == chip::DeviceLayer::DeviceEventType::kCHIPoBLEConnectionEstablished) + { + ChipLogProgress(DeviceLayer, "Receive kCHIPoBLEConnectionEstablished"); + // exit(0); + } +} + +int TestCHIPoBLEStackManager(void) +{ + chip::DeviceLayer::PlatformMgrImpl().InitChipStack(); + + chip::DeviceLayer::PlatformMgrImpl().AddEventHandler(EventHandler, 0); + + chip::DeviceLayer::ConnectivityMgr().SetBLEDeviceName("CHIP0001"); + + chip::DeviceLayer::Internal::BLEMgrImpl().ConfigureBle(1, false); + + chip::DeviceLayer::ConnectivityMgr().SetBLEAdvertisingEnabled( + chip::DeviceLayer::ConnectivityManager::kCHIPoBLEServiceMode_Enabled); + + ChipLogProgress(DeviceLayer, "Start Chip Over Ble task done"); + + chip::DeviceLayer::PlatformMgrImpl().RunEventLoop(); + + return -1; +} +#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/tests/TestCHIPoBLEStackMgr.h b/src/platform/tests/TestCHIPoBLEStackMgr.h new file mode 100644 index 00000000000000..f87ed33cfaa8bb --- /dev/null +++ b/src/platform/tests/TestCHIPoBLEStackMgr.h @@ -0,0 +1,30 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file declares test entry point for CHIP over BLE code unit tests in Linux + * + */ + +#ifndef CHIP_TEST_CHIP_BLE_STACK_MGR_H +#define CHIP_TEST_CHIP_BLE_STACK_MGR_H + +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +int TestCHIPoBLEStackManager(void); +#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +#endif // CHIP_TEST_CHIP_BLE_STACK_MGR_H diff --git a/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp b/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp new file mode 100644 index 00000000000000..67f12d70ff84ab --- /dev/null +++ b/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp @@ -0,0 +1,25 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "TestCHIPoBLEStackMgr.h" + +int main() +{ +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + TestCHIPoBLEStackManager(); +#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE +}