From 171181b6ef6c94aefc828dc7fd8de136b9f97532 Mon Sep 17 00:00:00 2001 From: Alexander Orlenko Date: Fri, 23 Sep 2011 16:23:00 +1100 Subject: Part of previous commit --- .gitignore | 1 + contrib/bluez-api-4.75-fixed/adapter-api.txt | 274 ------------- contrib/bluez-api-4.75-fixed/agent-api.txt | 91 ----- contrib/bluez-api-4.75-fixed/agent.xml | 32 -- contrib/bluez-api-4.75-fixed/assigned-numbers.txt | 23 -- contrib/bluez-api-4.75-fixed/attribute-api.txt | 156 -------- contrib/bluez-api-4.75-fixed/audio-api.txt | 458 ---------------------- contrib/bluez-api-4.75-fixed/control-api.txt | 140 ------- contrib/bluez-api-4.75-fixed/device-api.txt | 199 ---------- contrib/bluez-api-4.75-fixed/hfp-api.txt | 86 ---- contrib/bluez-api-4.75-fixed/input-api.txt | 44 --- contrib/bluez-api-4.75-fixed/manager-api.txt | 74 ---- contrib/bluez-api-4.75-fixed/network-api.txt | 88 ----- contrib/bluez-api-4.75-fixed/serial-api.txt | 41 -- contrib/bluez-api-4.75-fixed/service-api.txt | 62 --- contrib/gen-dbus-gobject.pl | 200 +++++----- contrib/generate-bluez-gobjects.sh | 2 +- contrib/generate-obexd-gobjects.sh | 2 +- contrib/obexd-api-0.34-fixed/agent-api.txt | 30 -- contrib/obexd-api-0.34-fixed/agent.xml | 35 -- contrib/obexd-api-0.34-fixed/client-api.txt | 329 ---------------- contrib/obexd-api-0.34-fixed/obexd-api.txt | 90 ----- src/bt-agent.c | 2 +- src/bt-network.c | 27 +- 24 files changed, 130 insertions(+), 2356 deletions(-) delete mode 100644 contrib/bluez-api-4.75-fixed/adapter-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/agent-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/agent.xml delete mode 100644 contrib/bluez-api-4.75-fixed/assigned-numbers.txt delete mode 100644 contrib/bluez-api-4.75-fixed/attribute-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/audio-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/control-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/device-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/hfp-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/input-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/manager-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/network-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/serial-api.txt delete mode 100644 contrib/bluez-api-4.75-fixed/service-api.txt delete mode 100644 contrib/obexd-api-0.34-fixed/agent-api.txt delete mode 100644 contrib/obexd-api-0.34-fixed/agent.xml delete mode 100644 contrib/obexd-api-0.34-fixed/client-api.txt delete mode 100644 contrib/obexd-api-0.34-fixed/obexd-api.txt diff --git a/.gitignore b/.gitignore index 80994da..9c20b45 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ src/bt-obex src/bt-serial stamp-h1 test_* +tmp/ diff --git a/contrib/bluez-api-4.75-fixed/adapter-api.txt b/contrib/bluez-api-4.75-fixed/adapter-api.txt deleted file mode 100644 index 2e7308f..0000000 --- a/contrib/bluez-api-4.75-fixed/adapter-api.txt +++ /dev/null @@ -1,274 +0,0 @@ -BlueZ D-Bus Adapter API description -*********************************** - -Copyright (C) 2004-2010 Marcel Holtmann -Copyright (C) 2005-2006 Johan Hedberg -Copyright (C) 2005-2006 Claudio Takahasi -Copyright (C) 2006-2007 Luiz von Dentz - - -Adapter hierarchy -================= - -Service org.bluez -Interface org.bluez.Adapter -Object path [variable prefix]/{hci0,hci1,...} - -Methods dict GetProperties() - - Returns all properties for the adapter. See the - properties section for available properties. - - Possible Errors: org.bluez.Error.NotReady - - void SetProperty(string name, variant value) - - Changes the value of the specified property. Only - properties that are listed a read-write are changeable. - On success this will emit a PropertyChanged signal. - - Possible Errors: org.bluez.Error.InvalidArguments - - void RequestSession() {unneeded_in_bluez_tools} - - This method will request a client session that - provides operational Bluetooth. A possible mode - change must be confirmed by the user via the agent. - - Possible Errors: org.bluez.Error.Rejected - - void ReleaseSession() {unneeded_in_bluez_tools} - - Release a previous requested session. - - Possible Errors: org.bluez.Error.DoesNotExist - - void StartDiscovery() - - This method starts the device discovery session. This - includes an inquiry procedure and remote device name - resolving. Use StopDiscovery to release the sessions - acquired. - - This process will start emitting DeviceFound and - PropertyChanged "Discovering" signals. - - Possible errors: org.bluez.Error.NotReady - org.bluez.Error.Failed - - void StopDiscovery() - - This method will cancel any previous StartDiscovery - transaction. - - Note that a discovery procedure is shared between all - discovery sessions thus calling StopDiscovery will only - release a single session. - - Possible errors: org.bluez.Error.NotReady - org.bluez.Error.Failed - org.bluez.Error.NotAuthorized - - object FindDevice(string address) - - Returns the object path of device for given address. - The device object needs to be first created via - CreateDevice or CreatePairedDevice. - - Possible Errors: org.bluez.Error.DoesNotExist - org.bluez.Error.InvalidArguments - - array{object} ListDevices() {deprecated} - - Returns list of device object paths. - This method is deprecated, instead use the Devices - Property to get the list of devices object paths. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.Failed - org.bluez.Error.OutOfMemory - - object CreateDevice(string address) - - Creates a new object path for a remote device. This - method will connect to the remote device and retrieve - all SDP records. - - If the object for the remote device already exists - this method will fail. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.Failed - - object CreatePairedDevice(string address, object agent, string capability) [async] - - Creates a new object path for a remote device. This - method will connect to the remote device and retrieve - all SDP records and then initiate the pairing. - - If previously CreateDevice was used successfully, - this method will only initiate the pairing. - - Compared to CreateDevice this method will fail if - the pairing already exists, but not if the object - path already has been created. This allows applications - to use CreateDevice first and the if needed use - CreatePairedDevice to initiate pairing. - - The agent object path is assumed to reside within the - process (D-Bus connection instance) that calls this - method. No separate registration procedure is needed - for it and it gets automatically released once the - pairing operation is complete. - - The capability parameter is the same as for the - RegisterAgent method. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.Failed - - void CancelDeviceCreation(string address) - - Aborts either a CreateDevice call or a - CreatePairedDevice call. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.NotInProgress - - void RemoveDevice(object device) - - This removes the remote device object at the given - path. It will remove also the pairing information. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.Failed - - void RegisterAgent(object agent, string capability) - - This registers the adapter wide agent. - - The object path defines the path the of the agent - that will be called when user input is needed. - - If an application disconnects from the bus all - of its registered agents will be removed. - - The capability parameter can have the values - "DisplayOnly", "DisplayYesNo", "KeyboardOnly" and - "NoInputNoOutput" which reflects the input and output - capabilities of the agent. If an empty string is - used it will fallback to "DisplayYesNo". - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.AlreadyExists - - void UnregisterAgent(object agent) - - This unregisters the agent that has been previously - registered. The object path parameter must match the - same value that has been used on registration. - - Possible errors: org.bluez.Error.DoesNotExist - -Signals PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - - DeviceFound(string address, dict values) - - This signal will be send every time an inquiry result - has been found by the service daemon. In general they - only appear during a device discovery. - - The dictionary can contain bascially the same values - that we be returned by the GetProperties method - from the org.bluez.Device interface. In addition there - can be values for the RSSI and the TX power level. - - DeviceDisappeared(string address) - - This signal will be send when an inquiry session for - a periodic discovery finishes and previously found - devices are no longer in range or visible. - - DeviceCreated(object device) - - Parameter is object path of created device. - - DeviceRemoved(object device) - - Parameter is object path of removed device. - -Properties string Address [readonly] - - The Bluetooth device address. - - string Name [readwrite] - - The Bluetooth friendly name. This value can be - changed and a PropertyChanged signal will be emitted. - - uint32 Class [readonly] - - The Bluetooth class of device. - - boolean Powered [readwrite] - - Switch an adapter on or off. This will also set the - appropiate connectable state. - - boolean Discoverable [readwrite] - - Switch an adapter to discoverable or non-discoverable - to either make it visible or hide it. This is a global - setting and should only be used by the settings - application. - - If the DiscoverableTimeout is set to a non-zero - value then the system will set this value back to - false after the timer expired. - - In case the adapter is switched off, setting this - value will fail. - - When changing the Powered property the new state of - this property will be updated via a PropertyChanged - signal. - - boolean Pairable [readwrite] - - Switch an adapter to pairable or non-pairable. This is - a global setting and should only be used by the - settings application. - - Note that this property only affects incoming pairing - requests. - - uint32 PairableTimeout [readwrite] - - The pairable timeout in seconds. A value of zero - means that the timeout is disabled and it will stay in - pareable mode forever. - - uint32 DiscoverableTimeout [readwrite] - - The discoverable timeout in seconds. A value of zero - means that the timeout is disabled and it will stay in - discoverable/limited mode forever. - - The default value for the discoverable timeout should - be 180 seconds (3 minutes). - - boolean Discovering [readonly] - - Indicates that a device discovery procedure is active. - - array{object} Devices [readonly] - - List of device object paths. - - array{string} UUIDs [readonly] - - List of 128-bit UUIDs that represents the available - local services. diff --git a/contrib/bluez-api-4.75-fixed/agent-api.txt b/contrib/bluez-api-4.75-fixed/agent-api.txt deleted file mode 100644 index d8d35c0..0000000 --- a/contrib/bluez-api-4.75-fixed/agent-api.txt +++ /dev/null @@ -1,91 +0,0 @@ -BlueZ D-Bus Agent API description -********************************** - -Copyright (C) 2004-2010 Marcel Holtmann -Copyright (C) 2005-2006 Johan Hedberg - - -Agent hierarchy -=============== - -Service unique name -Interface org.bluez.Agent -Object path freely definable - -Methods void Release() - - This method gets called when the service daemon - unregisters the agent. An agent can use it to do - cleanup tasks. There is no need to unregister the - agent, because when this method gets called it has - already been unregistered. - - string RequestPinCode(object device) - - This method gets called when the service daemon - needs to get the passkey for an authentication. - - The return value should be a string of 1-16 characters - length. The string can be alphanumeric. - - Possible errors: org.bluez.Error.Rejected - org.bluez.Error.Canceled - - uint32 RequestPasskey(object device) - - This method gets called when the service daemon - needs to get the passkey for an authentication. - - The return value should be a numeric value - between 0-999999. - - Possible errors: org.bluez.Error.Rejected - org.bluez.Error.Canceled - - void DisplayPasskey(object device, uint32 passkey, uint8 entered) - - This method gets called when the service daemon - needs to display a passkey for an authentication. - - The entered parameter indicates the number of already - typed keys on the remote side. - - An empty reply should be returned. When the passkey - needs no longer to be displayed, the Cancel method - of the agent will be called. - - During the pairing process this method might be - called multiple times to update the entered value. - - void RequestConfirmation(object device, uint32 passkey) - - This method gets called when the service daemon - needs to confirm a passkey for an authentication. - - To confirm the value it should return an empty reply - or an error in case the passkey is invalid. - - Possible errors: org.bluez.Error.Rejected - org.bluez.Error.Canceled - - void Authorize(object device, string uuid) - - This method gets called when the service daemon - needs to authorize a connection/service request. - - Possible errors: org.bluez.Error.Rejected - org.bluez.Error.Canceled - - void ConfirmModeChange(string mode) - - This method gets called if a mode change is requested - that needs to be confirmed by the user. An example - would be leaving flight mode. - - Possible errors: org.bluez.Error.Rejected - org.bluez.Error.Canceled - - void Cancel() - - This method gets called to indicate that the agent - request failed before a reply was returned. diff --git a/contrib/bluez-api-4.75-fixed/agent.xml b/contrib/bluez-api-4.75-fixed/agent.xml deleted file mode 100644 index 86e442b..0000000 --- a/contrib/bluez-api-4.75-fixed/agent.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/bluez-api-4.75-fixed/assigned-numbers.txt b/contrib/bluez-api-4.75-fixed/assigned-numbers.txt deleted file mode 100644 index cda934c..0000000 --- a/contrib/bluez-api-4.75-fixed/assigned-numbers.txt +++ /dev/null @@ -1,23 +0,0 @@ -RFCOMM Channels -=============== - -Since there are a limited amount of possible RFCOMM channels (1-31) -they've been pre-allocated for currently known profiles in order to -avoid conflicts. - -Profile Channel ------------------------ -DUN 1 -HFP HF 7 -OPP 9 -FTP 10 -BIP 11 -HSP AG 12 -HFP AG 13 -SYNCH (IrMC) 14 -PBAP 15 -MAP 16 -SyncEvolution 19 -PC/Ovi Suite 24 -SyncML Client 25 -SyncML Server 26 diff --git a/contrib/bluez-api-4.75-fixed/attribute-api.txt b/contrib/bluez-api-4.75-fixed/attribute-api.txt deleted file mode 100644 index 23808e6..0000000 --- a/contrib/bluez-api-4.75-fixed/attribute-api.txt +++ /dev/null @@ -1,156 +0,0 @@ -BlueZ D-Bus Attribute API description -************************************* - -Copyright (C) 2004-2010 Marcel Holtmann - -Service details ---------------- - -One service object path for every remote SDP record or service in the -attribute database. One service object path for every local SDP record -or service from attribute database. - -Local services are children of the adapter object path. Remote services -are children of the remote device object path. This doesn't solve the -problem where local atttributes can have different instances based on -the remote device. - -In general the idea is to also represent SDP records as services so that -new style application can just use the service interfaces to retrieve the -needed information. That way the usage of SDP and GATT would be mostly -fully transparent and a differentiation becomes unimportant in the future. - -A service consists of some generic service information and a set of -characteristics. All characteristic are presented as object path as well. - - -Local Service hierarchy -======================= - -Service org.bluez -Interface org.bluez.Service - org.bluez.Characteristic -Object path [prefix]/{hci0}/{service0, service1, ...} - -Methods - -Properties - - -Device Service hierarchy -======================== - -Service org.bluez -Interface org.bluez.Characteristic -Object path [prefix]/{hci0}/{device0}/{service0, service1, ...} - [prefix]/{hci0}/{device1}/{service0, service1, ...} - -Methods dict GetProperties() - - Returns all properties for the interface. See the - Properties section for the available properties. - - RegisterCharacteristicsWatcher(object agent) - - Register a watcher to monitor characteristic changes. - - A watcher will be registered for this service and will - notify about any changed characteristics in the service. - This also notifies about any included characteristics. - - UnregisterCharacteristicsWatcher(object agent) - - Unregister a watcher. - -Properties string Name (mandatory) [readonly] - - General name of service - - string Description (optional) [readonly] - - Description of service - - string UUID (mandatory) [readonly] - - UUID of service. Service class value for SDP and GATT - UUID for attribute based services. - - array{object} Characteristics [readonly] - - This list contains the characteristics owned by this - specific service and other characteristics from service - includes. That way no complicated service includes array - is needed. - - -Device Characteristic hierarchy -=============================== - -Service org.bluez -Interface org.bluez.Characteristic -Object path [prefix]/{hci0}/{device0}/{service0}/{characteristic0,...} - [prefix]/{hci0}/{device0}/{service1}/{characteristic0,...} - -Methods dict GetProperties() - - Returns all properties for the characteristic. See the - properties section for available properties. - - void SetProperty(string name, variant value) - - Changes the value of the specified property. Only - read-write properties can be changed. On success - this will emit a PropertyChanged signal. - - Possible Errors: org.bluez.Error.InvalidArguments - -Properties string UUID [readonly] - - UUID128 of this characteristic. - - string Name [readonly] - - Optional field containing a friendly name for the - Characteristic UUID. - - string Description [readonly] - - Textual optional characteristic descriptor describing - the Characteristic Value. - - struct Format [readonly] - - Optional Characteristic descriptor which defines the - format of the Characteristic Value. For numeric - values, the actual value can be value * 10^Exponent. - NameSpace and Description are defined on the Assigned - Number Specification. - - uint8 | Format: format of the value - uint8 | Exponent: Field to determine how the value is - | further formatted. - uint16 | Unit: unit of the characteristic - uint8 | NameSpace: Name space of description. - uint16 | Description: Description of the characteristic defined - | in a high layer profile. - - array{byte} Value [readwrite] - - Raw value of the Characteristic Value attribute. - - string Representation (of the binary Value) [readonly] - - Friendly representation of the Characteristic Value - based on the format attribute. - - -Characteristic Watcher hierarchy -=============================== - -Service unique name -Interface org.bluez.Watcher -Object path freely definable - -Methods void ValueChanged(object characteristic, array{byte}) - - New raw value of the Characteristic Value attribute. diff --git a/contrib/bluez-api-4.75-fixed/audio-api.txt b/contrib/bluez-api-4.75-fixed/audio-api.txt deleted file mode 100644 index 80c0b5d..0000000 --- a/contrib/bluez-api-4.75-fixed/audio-api.txt +++ /dev/null @@ -1,458 +0,0 @@ -BlueZ D-Bus Audio API description -********************************* - -Copyright (C) 2004-2010 Marcel Holtmann -Copyright (C) 2005-2007 Johan Hedberg -Copyright (C) 2005-2006 Brad Midgley - -Audio hierarchy -=============== - -Service org.bluez -Interface org.bluez.Audio -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -This is a generic audio interface that abstracts the different audio profiles. - -Methods void Connect() - - Connect all supported audio profiles on the device. - - void Disconnect() - - Disconnect all audio profiles on the device - - dict GetProperties() - - Returns all properties for the interface. See the - properties section for available properties. - -Signals PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - -Properties string State [readonly] - - Possible values: "disconnected", "connecting", - "connected" - - "disconnected" -> "connecting" - Either an incoming or outgoing connection - attempt ongoing. - - "connecting" -> "disconnected" - Connection attempt failed - - "connecting" -> "connected" - Successfully connected - - "connected" -> "disconnected" - Disconnected from the remote device - -Headset hierarchy -================= - -Service org.bluez -Interface org.bluez.Headset -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -Methods void Connect() - - Connect to the HSP/HFP service on the remote device. - - void Disconnect() - - Disconnect from the HSP/HFP service on the remote - device. - - boolean IsConnected() {deprecated} - - Returns TRUE if there is a active connection to the - HSP/HFP connection on the remote device. - - void IndicateCall() - - Indicate an incoming call on the headset - connected to the stream. Will continue to - ring the headset about every 3 seconds. - - void CancelCall() - - Cancel the incoming call indication. - - void Play() - - Open the audio connection to the headset. - - void Stop() - - Close the audio connection. - - boolean IsPlaying() {deprecated} - - Returns true if an audio connection to the headset - is active. - - uint16 GetSpeakerGain() {deprecated} - - Returns the current speaker gain if available, - otherwise returns the error NotAvailable. - - uint16 GetMicrophoneGain() {deprecated} - - Returns the current microphone gain if available, - otherwise returns the error NotAvailable. - - void SetSpeakerGain(uint16 gain) {deprecated} - - Changes the current speaker gain if possible. - - void SetMicrophoneGain(uint16 gain) {deprecated} - - Changes the current speaker gain if possible. - - dict GetProperties() - - Returns all properties for the interface. See the - properties section for available properties. - - Possible Errors: org.bluez.Error.InvalidArguments - - void SetProperty(string name, variant value) - - Changes the value of the specified property. Only - properties that are listed a read-write are changeable. - On success this will emit a PropertyChanged signal. - - Possible Errors: org.bluez.Error.DoesNotExist - org.bluez.Error.InvalidArguments - -Signals AnswerRequested() - - Sent when the answer button is pressed on the headset - - Connected() {deprecated} - - Sent when the device has been connected to. - - Disconnected() {deprecated} - - Sent when the device has been disconnected from. - - Stopped() {deprecated} - - Sent when the audio connection is closed - - Playing() {deprecated} - - Sent when the audio connection is opened - - SpeakerGainChanged(uint16 gain) {deprecated} - - The speaker gain changed. - - MicrophoneGainChanged(uint16 gain) {deprecated} - - The microphone gain changed. - - PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - -Properties string State [readonly] - - Possible values: "disconnected", "connecting", - "connected", "playing" - - "disconnected" -> "connecting" - Either an incoming or outgoing connection - attempt ongoing. - - "connecting" -> "disconnected" - Connection attempt failed - - "connecting" -> "connected" - Successfully connected - - "connected" -> "playing" - SCO audio connection successfully opened - - "playing" -> "connected" - SCO audio connection closed - - "connected" -> "disconnected" - "playing" -> "disconnected" - Disconnected from the remote device - - boolean Connected [readonly] - - Indicates if there is a active connection to the - HSP/HFP connection on the remote device. - - boolean Playing [readonly] - - Indicates if an audio connection to the headset - is active. - - uint16 SpeakerGain [readwrite] - - The speaker gain when available. - - uint16 MicrophoneGain [readwrite] - - The speaker gain when available. - - -AudioSink hierarchy -=================== - -Service org.bluez -Interface org.bluez.AudioSink -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -Methods void Connect() - - Connect and setup a stream to a A2DP sink on the - remote device. - - void Disconnect() - - Disconnect from the remote device. - - boolean IsConnected() {deprecated} - - Returns TRUE if a stream is setup to a A2DP sink on - the remote device. - - dict GetProperties() - - Returns all properties for the interface. See the - properties section for available properties. - - Possible Errors: org.bluez.Error.InvalidArguments - -Signals Connected() {deprecated} - - Sent when a successful connection has been made to the - remote A2DP Sink - - Disconnected() {deprecated} - - Sent when the device has been disconnected from. - - Playing() {deprecated} - - Sent when a stream with remote device is started. - - Stopped() {deprecated} - - Sent when a stream with remote device is suspended. - - PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - -Properties string State [readonly] - - Possible values: "disconnected", "connecting", - "connected", "playing" - - "disconnected" -> "connecting" - Either an incoming or outgoing connection - attempt ongoing. - - "connecting" -> "disconnected" - Connection attempt failed - - "connecting" -> "connected" - Successfully connected - - "connected" -> "playing" - Audio stream active - - "playing" -> "connected" - Audio stream suspended - - "connected" -> "disconnected" - "playing" -> "disconnected" - Disconnected from the remote device - - boolean Connected [readonly] - - Indicates if a stream is setup to a A2DP sink on - the remote device. - - boolean Playing [readonly] - - Indicates if a stream is active to a A2DP sink on - the remote device. - -AudioSource hierarchy -===================== - -Service org.bluez -Interface org.bluez.AudioSource -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -Methods void Connect() - - Connect and setup a stream to a A2DP source on the - remote device. - - void Disconnect() - - Disconnect from the remote device. - - dict GetProperties() - - Returns all properties for the interface. See the - properties section for available properties. - - Possible Errors: org.bluez.Error.InvalidArguments - -Signals PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - -Properties string State [readonly] - - Possible values: "disconnected", "connecting", - "connected", "playing" - - "disconnected" -> "connecting" - Either an incoming or outgoing connection - attempt ongoing. - - "connecting" -> "disconnected" - Connection attempt failed - - "connecting" -> "connected" - Successfully connected - - "connected" -> "playing" - Audio stream active - - "playing" -> "connected" - Audio stream suspended - - "connected" -> "disconnected" - "playing" -> "disconnected" - Disconnected from the remote device - - -HeadsetGateway hierarchy -======================== - -Service org.bluez -Interface org.bluez.HeadsetGateway -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -This interface is available for remote devices which can function in the Audio -Gateway role of the HFP profiles. - -Methods void Connect() - - Connect to the AG service on the remote device. - - void Disconnect() - - Disconnect from the AG service on the remote device - - void AnswerCall() - - It has to called only after Ring signal received. - - void TerminateCall() - - Terminate call which is running or reject an incoming - call. This has nothing with any 3-way situation incl. - RaH. Just plain old PDH. - - void Call(string number) - - Dial a number 'number'. No number processing is done - thus if AG would reject to dial it don't blame me :) - - string GetOperatorName() - - Find out the name of the currently selected network - operator by AG. - - void SendDTMF(string digits) - - Will send each digit in the 'digits' sequentially. Would - send nothing if there is non-dtmf digit. - - string GetSubscriberNumber() - - Get the voicecall subscriber number of AG - - dict GetProperties() - - Returns all properties for the interface. See the - properties section for available properties. - -Signals Ring(string number) - - Someone's calling from 'number'. - Caller number is provided as received from AG. - - CallTerminated() - - Call failed to set up. It means that we tried to call - someone or someone tried to call us but call was not - accepted. - - CallStarted() - - Call set up successfully. - - CallEnded() - - Call was started and now ended. In contrast with - CallTerminated where call didn't started - - PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - -Properties boolean Connected [readonly] - - Indicates if there is an active connection to the - AG service on the remote device. - - uint16 RegistrationStatus [readonly] - - Service availability indicatior of AG, where: - 0 implies no service. No Home/Roam network available. - 1 implies presense of service. Home/Roam network - available. - - uint16 SignalStrength [readonly] - - Signal strength indicator of AG, the value ranges from - 0 to 5. - - uint16 RoamingStatus [readonly] - - Roaming status indicator of AG, where: - 0 means roaming is not active - 1 means a roaming is active - - uint16 BatteryCharge [readonly] - - Battery Charge indicator of AG, the value ranges from - 0 to 5. - - uint16 SpeakerGain [readonly] - - The speaker gain when available. - - uint16 MicrophoneGain [readonly] - - The speaker gain when available. diff --git a/contrib/bluez-api-4.75-fixed/control-api.txt b/contrib/bluez-api-4.75-fixed/control-api.txt deleted file mode 100644 index ce9d2bd..0000000 --- a/contrib/bluez-api-4.75-fixed/control-api.txt +++ /dev/null @@ -1,140 +0,0 @@ -BlueZ D-Bus Control API description -*********************************** - -Copyright (C) 2004-2010 Marcel Holtmann -Copyright (C) 2007-2008 David Stockwell - - -Control hierarchy -================= - -Service org.bluez -Interface org.bluez.Control -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -Methods void Connect() - - Connect to remote device (CT or TG). - - void Disconnect() - - Disconnect remote device. - - dict GetProperties() - - Returns all properties for the interface. See the - properties section for available properties. - - void VolumeUp() - - Adjust remote volume one step up - - void VolumeDown() - - Adjust remote volume one step down - - boolean SendPassthrough(avc_operation_id key, boolean state, string op_data) - - Called to send Passthrough commands. ONLY valid if - BlueZ device is in CT role. - - boolean SendVendorDependent(string op_data) - - Called to send VendorDependent commands, other than - Metadata or Events defined in the AVRCP+Metadata - specification. - - void ChangePlayback(string status, uint32 elapsed) - - The status can be "playing", "stopped", "paused", - "forward-seek", "reverse-seek" or "error". Elapsed is - the position within the track in milliseconds. - - void ChangeTrack(dict metadata) - - Called to send the mandated TrackChange event and - potential metadata information. - - Current defined metadata information are represented - with the following keys: - - Title string (mandatory) - Artist string - Album string - Genre string - NumberOfTracks uint32 - TrackNumber uint32 - TrackDuration uint32 (in milliseconds) - - void ChangeSetting(string setting, variant value) - - Called to transmit Application Settings, CT Status - and the like. - - Currenet defined settings are represented with the - following keys: - - Equalizer off, on - Repeat off, singletrack, alltracks, group - Shuffle off, alltracks, group - Scan off, alltracks, group - Battery normal, warning, critical, external, fullcharge - System powered, unpowered, unplugged - Volume uint8 - -Signals Connected() - - Sent when a successful AVRCP connection has been made - to the remote device. - - Disconnected() - - Sent when the AVRCP connection to the remote device - has been disconnected. - - Passthrough(uint8 key, boolean state, int32 company_id, string op_data) - - Called when Passthrough command is received from - connected device. - - NOTE: according to the AV/C Subpanel Spec, company_id - and op_data are passed ONLY when the key is - "Vendor_Unique", or 0x7E. - - When the key is NOT 0x7E, the signal returns - company_id=-1, and zero-length op_data. - - VendorDependentReceived(string op_data) - - Called when VendorDependent message is received from - connected device (except for Metadata defined in - Bluetooth SIG AVRCP+Metadata spec). - - TrackChanged(dict metadata) - - Called when Metadata is received from connected device. - May be multiple meta attribute/element pairs. - - PlaybackChanged(string status, uint32 elapsed) - - SettingChanged(string setting, variant value) - -Properties uint8 SubUnitID [readonly] - - The three-bit Subunit ID from the connected device. - - uint8 SubUnitType [readonly] - - The five-bit Subunit Type from the connected device. - - boolean Connected [readonly] - - array{uint32} CompanyIDs [readonly] - - List of three-byte Company IDs (OUI) supported by the - connected device. Note that Bluetooth SIG Company - ID (0x001958) is always included. - - array{string} Capabilities [readonly] - - List of Capabilities provided by the connected device. diff --git a/contrib/bluez-api-4.75-fixed/device-api.txt b/contrib/bluez-api-4.75-fixed/device-api.txt deleted file mode 100644 index ab1875d..0000000 --- a/contrib/bluez-api-4.75-fixed/device-api.txt +++ /dev/null @@ -1,199 +0,0 @@ -BlueZ D-Bus Device API description -********************************** - -Copyright (C) 2004-2010 Marcel Holtmann -Copyright (C) 2005-2006 Johan Hedberg -Copyright (C) 2005-2006 Claudio Takahasi -Copyright (C) 2006-2007 Luiz von Dentz - - -Device hierarchy -================ - -Service org.bluez -Interface org.bluez.Device -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -Methods dict GetProperties() - - Returns all properties for the device. See the - properties section for available properties. - - Possible Errors: org.bluez.Error.DoesNotExist - org.bluez.Error.InvalidArguments - - void SetProperty(string name, variant value) - - Changes the value of the specified property. Only - properties that are listed a read-write are changeable. - On success this will emit a PropertyChanged signal. - - Possible Errors: org.bluez.Error.DoesNotExist - org.bluez.Error.InvalidArguments - - dict{u,s} DiscoverServices(string pattern) - - This method starts the service discovery to retrieve - remote service records. The pattern parameter can - be used to specify specific UUIDs. And empty string - will look for the public browse group. - - The return value is a dictionary with the record - handles as keys and the service record in XML format - as values. The key is uint32 and the value a string - for this dictionary. - - Possible errors: org.bluez.Error.NotReady - org.bluez.Error.Failed - org.bluez.Error.InProgress - - void CancelDiscovery() - - This method will cancel any previous DiscoverServices - transaction. - - Possible errors: org.bluez.Error.NotReady - org.bluez.Error.Failed - org.bluez.Error.NotAuthorized - - void Disconnect() - - This method disconnects a specific remote device by - terminating the low-level ACL connection. The use of - this method should be restricted to administrator - use. - - A DisconnectRequested signal will be sent and the - actual disconnection will only happen 2 seconds later. - This enables upper-level applications to terminate - their connections gracefully before the ACL connection - is terminated. - - Possible errors: org.bluez.Error.NotConnected - - array{object} ListNodes() {deprecated} {unimplemented} - - Returns list of device node object paths. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.Failed - org.bluez.Error.OutOfMemory - - object CreateNode(string uuid) {unimplemented} - - Creates a persistent device node binding with a - remote device. The actual support for the specified - UUID depends if the device driver has support for - persistent binding. At the moment only RFCOMM TTY - nodes are supported. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.NotSupported - - void RemoveNode(object node) {unimplemented} - - Removes a persistent device node binding. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.DoesNotExist - -Signals PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - - DisconnectRequested() - - This signal will be sent when a low level - disconnection to a remote device has been requested. - The actual disconnection will happen 2 seconds later. - - NodeCreated(object node) {unimplemented} - - Parameter is object path of created device node. - - NodeRemoved(object node) {unimplemented} - - Parameter is object path of removed device node. - -Properties string Address [readonly] - - The Bluetooth device address of the remote device. - - string Name [readonly] - - The Bluetooth remote name. This value can not be - changed. Use the Alias property instead. - - string Icon [readonly] - - Proposed icon name according to the freedesktop.org - icon naming specification. - - uint32 Class [readonly] - - The Bluetooth class of device of the remote device. - - array{string} UUIDs [readonly] - - List of 128-bit UUIDs that represents the available - remote services. - - array{object} Services [readonly] - - List of characteristics based services. - - boolean Paired [readonly] - - Indicates if the remote device is paired. - - boolean Connected [readonly] - - Indicates if the remote device is currently connected. - A PropertyChanged signal indicate changes to this - status. - - boolean Trusted [readwrite] - - Indicates if the remote is seen as trusted. This - setting can be changed by the application. - - boolean Blocked [readwrite] - - If set to true any incoming connections from the - device will be immediately rejected. Any device - drivers will also be removed and no new ones will - be probed as long as the device is blocked. - - string Alias [readwrite] - - The name alias for the remote device. The alias can - be used to have a different friendly name for the - remote device. - - In case no alias is set, it will return the remote - device name. Setting an empty string as alias will - convert it back to the remote device name. - - When reseting the alias with an empty string, the - emitted PropertyChanged signal will show the remote - name again. - - array{object} Nodes [readonly] {unimplemented} - - List of device node object paths. - - object Adapter [readonly] - - The object path of the adpater the device belongs to. - - boolean LegacyPairing [readonly] - - Set to true if the device only supports the pre-2.1 - pairing mechanism. This property is useful in the - Adapter.DeviceFound signal to anticipate whether - legacy or simple pairing will occur. - - Note that this property can exhibit false-positives - in the case of Bluetooth 2.1 (or newer) devices that - have disabled Extended Inquiry Response support. diff --git a/contrib/bluez-api-4.75-fixed/hfp-api.txt b/contrib/bluez-api-4.75-fixed/hfp-api.txt deleted file mode 100644 index 93251e8..0000000 --- a/contrib/bluez-api-4.75-fixed/hfp-api.txt +++ /dev/null @@ -1,86 +0,0 @@ -Gateway hierarchy -======================== - -Service org.bluez -Interface org.bluez.HandsfreeGateway -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -This interface is available for remote devices which can function in the Audio -Gateway role of the HFP profiles. It is intended to be used with external -telephony stacks / handlers of the HFP protocol. - -Methods void Connect() - - Connect to the AG service on the remote device. - - void Disconnect() - - Disconnect from the AG service on the remote device - - dict GetProperties() - - Returns all properties for the interface. See the - properties section for available properties. - - void RegisterAgent(object path) - - The object path defines the path the of the agent - that will be called when a new Handsfree connection - is established. - - If an application disconnects from the bus all of its - registered agents will be removed. - - void UnregisterAgent(object path) - - This unregisters the agent that has been previously - registered. The object path parameter must match the - same value that has been used on registration. - - Possible Errors: org.bluez.Error.Failed - org.bluez.Error.InvalidArguments - - -Signals PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - -Properties string State [readonly] - - Indicates the state of the connection. Possible - values are: - "disconnected" - "connecting" - "connected" - "playing" - -HandsfreeAgent hierarchy -=============== - -Service unique name -Interface org.bluez.HandsfreeAgent -Object path freely definable - -Methods void NewConnection(filedescriptor fd) - - This method gets called whenever a new handsfree - connection has been established. The objectpath - contains the object path of the remote device. This - method assumes that DBus daemon with file descriptor - passing capability is being used. - - The agent should only return successfully once the - establishment of the service level connection (SLC) - has been completed. In the case of Handsfree this - means that BRSF exchange has been performed and - necessary initialization has been done. - - Possible Errors: org.bluez.Error.InvalidArguments - org.bluez.Error.Failed - - void Release() - - This method gets called whenever the service daemon - unregisters the agent or whenever the Adapter where - the HandsfreeAgent registers itself is removed. diff --git a/contrib/bluez-api-4.75-fixed/input-api.txt b/contrib/bluez-api-4.75-fixed/input-api.txt deleted file mode 100644 index 7c3a4b2..0000000 --- a/contrib/bluez-api-4.75-fixed/input-api.txt +++ /dev/null @@ -1,44 +0,0 @@ -BlueZ D-Bus Input API description -********************************* - -Copyright (C) 2004-2010 Marcel Holtmann - - -Input hierarchy -=============== - -Service org.bluez -Interface org.bluez.Input -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -Methods void Connect() - - Connect to the input device. - - Possible errors: org.bluez.Error.AlreadyConnected - org.bluez.Error.ConnectionAttemptFailed - - void Disconnect() - - Disconnect from the input device. - - To abort a connection attempt in case of errors or - timeouts in the client it is fine to call this method. - - Possible errors: org.bluez.Error.Failed - - dict GetProperties() - - Returns all properties for the interface. See the - properties section for available properties. - - Possible Errors: org.bluez.Error.InvalidArguments - -Signals PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - -Properties boolean Connected [readonly] - - Indicates if the device is connected. diff --git a/contrib/bluez-api-4.75-fixed/manager-api.txt b/contrib/bluez-api-4.75-fixed/manager-api.txt deleted file mode 100644 index d2c1caf..0000000 --- a/contrib/bluez-api-4.75-fixed/manager-api.txt +++ /dev/null @@ -1,74 +0,0 @@ -BlueZ D-Bus Manager API description -*********************************** - -Copyright (C) 2004-2010 Marcel Holtmann -Copyright (C) 2005-2006 Johan Hedberg -Copyright (C) 2005-2006 Claudio Takahasi -Copyright (C) 2006-2007 Luiz von Dentz - - -Manager hierarchy -================= - -Service org.bluez -Interface org.bluez.Manager -Object path / - -Methods dict GetProperties() - - Returns all global properties. See the - properties section for available properties. - - Possible Errors: org.bluez.Error.DoesNotExist - org.bluez.Error.InvalidArguments - - object DefaultAdapter() - - Returns object path for the default adapter. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.NoSuchAdapter - - object FindAdapter(string pattern) - - Returns object path for the specified adapter. Valid - patterns are "hci0" or "00:11:22:33:44:55". - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.NoSuchAdapter - - array{object} ListAdapters() {deprecated} - - Returns list of adapter object paths under /org/bluez. - This method is deprecated, instead use the Adapters - Property to get the list of adapter object paths. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.Failed - org.bluez.Error.OutOfMemory - -Signals PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - - AdapterAdded(object adapter) - - Parameter is object path of added adapter. - - AdapterRemoved(object adapter) - - Parameter is object path of removed adapter. - - DefaultAdapterChanged(object adapter) - - Parameter is object path of the new default adapter. - - In case all adapters are removed this signal will not - be emitted. The AdapterRemoved signal has to be used - to detect that no default adapter is selected or - available anymore. - -Properties array{object} Adapters [readonly] - - List of adapter object paths. diff --git a/contrib/bluez-api-4.75-fixed/network-api.txt b/contrib/bluez-api-4.75-fixed/network-api.txt deleted file mode 100644 index 4dd3e58..0000000 --- a/contrib/bluez-api-4.75-fixed/network-api.txt +++ /dev/null @@ -1,88 +0,0 @@ -BlueZ D-Bus Network API description -*********************************** - -Copyright (C) 2004-2010 Marcel Holtmann - - -Network hierarchy -================= - -Service org.bluez -Interface org.bluez.Network -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -Methods string Connect(string uuid) - - Connect to the network device and return the network - interface name. Examples of the interface name are - bnep0, bnep1 etc. - - uuid can be either one of "gn", "panu" or "nap" (case - insensitive) or a traditional string representation of - UUID or a hexadecimal number. - - The connection will be closed and network device - released either upon calling Disconnect() or when - the client disappears from the message bus. - - Possible errors: org.bluez.Error.AlreadyConnected - org.bluez.Error.ConnectionAttemptFailed - - void Disconnect() - - Disconnect from the network device. - - To abort a connection attempt in case of errors or - timeouts in the client it is fine to call this method. - - Possible errors: org.bluez.Error.Failed - - dict GetProperties() - - Returns all properties for the interface. See the - properties section for available properties. - -Signals PropertyChanged(string name, variant value) - - This signal indicates a changed value of the given - property. - -Properties boolean Connected [readonly] - - Indicates if the device is connected. - - string Interface [readonly] - - Indicates the network interface name when available. - - string UUID [readonly] - - Indicates the connection role when available. - - -Network server hierarchy -======================== - -Service org.bluez -Interface org.bluez.NetworkServer -Object path /org/bluez/{hci0,hci1,...} - -Methods void Register(string uuid, string bridge) - - Register server for the provided UUID. Every new - connection to this server will be added the bridge - interface. - - Valid UUIDs are "gn", "panu" or "nap". - - Initially no network server SDP is provided. Only - after this method a SDP record will be available - and the BNEP server will be ready for incoming - connections. - - void Unregister(string uuid) - - Unregister the server for provided UUID. - - All servers will be automatically unregistered when - the calling application terminates. diff --git a/contrib/bluez-api-4.75-fixed/serial-api.txt b/contrib/bluez-api-4.75-fixed/serial-api.txt deleted file mode 100644 index 5f9bd5f..0000000 --- a/contrib/bluez-api-4.75-fixed/serial-api.txt +++ /dev/null @@ -1,41 +0,0 @@ -BlueZ D-Bus Serial API description -********************************** - -Copyright (C) 2004-2010 Marcel Holtmann - - -Serial hierarchy -================ - -Service org.bluez -Interface org.bluez.Serial -Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX - -Methods string Connect(string pattern) - - Connects to a specific RFCOMM based service on a - remote device and then creates a RFCOMM TTY - device for it. The RFCOMM TTY device is returned. - - Possible patterns: UUID 128 bit as string - Profile short names, e.g: spp, dun - RFCOMM channel as string, 1-30 - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.InProgress - org.bluez.Error.ConnectionAttemptFailed - org.bluez.Error.NotSupported - - void Disconnect(string device) - - Disconnect a RFCOMM TTY device that has been - created by Connect method. - - To abort a connection attempt in case of errors or - timeouts in the client it is fine to call this method. - - In that case one of patterns of the Connect method should - be suplied instead of the TTY device. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.DoesNotExist diff --git a/contrib/bluez-api-4.75-fixed/service-api.txt b/contrib/bluez-api-4.75-fixed/service-api.txt deleted file mode 100644 index 5c8c7f3..0000000 --- a/contrib/bluez-api-4.75-fixed/service-api.txt +++ /dev/null @@ -1,62 +0,0 @@ -BlueZ D-Bus Adapter API description -*********************************** - -Copyright (C) 2004-2010 Marcel Holtmann -Copyright (C) 2005-2006 Johan Hedberg -Copyright (C) 2005-2006 Claudio Takahasi -Copyright (C) 2006-2007 Luiz von Dentz - - -Service hierarchy -================= - -Service org.bluez -Interface org.bluez.Service -Object path [variable prefix]/{hci0,hci1,...} - -Methods uint32 AddRecord(string record) - - Adds a new service record from the XML description - and returns the assigned record handle. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.Failed - - void UpdateRecord(uint32 handle, string record) - - Updates a given service record provided in the - XML format. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.NotAvailable - org.bluez.Error.Failed - - void RemoveRecord(uint32 handle) - - Remove a service record identified by its handle. - - It is only possible to remove service records that - where added by the current connection. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.NotAuthorized - org.bluez.Error.DoesNotExist - org.bluez.Error.Failed - - void RequestAuthorization(string address, uint32 handle) - - Request an authorization for an incoming connection - for a specific service record. The service record - needs to be registered via AddRecord first. - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.NotAuthorized - org.bluez.Error.DoesNotExist - org.bluez.Error.Failed - - void CancelAuthorization() - - Possible errors: org.bluez.Error.InvalidArguments - org.bluez.Error.NotAuthorized - org.bluez.Error.DoesNotExist - org.bluez.Error.Failed diff --git a/contrib/gen-dbus-gobject.pl b/contrib/gen-dbus-gobject.pl index be2d85f..dc8a3c1 100755 --- a/contrib/gen-dbus-gobject.pl +++ b/contrib/gen-dbus-gobject.pl @@ -27,11 +27,11 @@ die "usage: -header|source FILE \n" unless $ARGV[0] && $ARGV[1] && $ARGV[0] sub parse_doc_api { my ($doc_api_file, $hierarchy_id) = @_; - + $hierarchy_id = 1 unless defined $hierarchy_id && $hierarchy_id > 0; - + my %data; - + open INPUT, "<$doc_api_file" or die "Can't open '$doc_api_file': $!\n"; my $n = 0; my $hierarchy_n = 0; @@ -39,32 +39,32 @@ sub parse_doc_api { while() { $n++; s/\s+$//; - - if ($n == 1) { - if (/^BlueZ D-Bus \S+ API description$/) { - $data{'dbus_conn'} = 'system_conn'; - } elsif (/^obex.*?API description$/i) { - $data{'dbus_conn'} = 'session_conn'; - } elsif (/^ODS API description$/) { - $data{'dbus_conn'} = 'system_conn'; - } else { - die "invalid file format (1)\n"; - } - - next; - } - + + if ($n == 1) { + if (/^BlueZ D-Bus \S+ API description$/) { + $data{'dbus_conn'} = 'system_conn'; + } elsif (/^obex.*?API description$/i) { + $data{'dbus_conn'} = 'session_conn'; + } elsif (/^ODS API description$/) { + $data{'dbus_conn'} = 'system_conn'; + } else { + die "invalid file format (1)\n"; + } + + next; + } + /^\s*$/ && next; - + if (/^(.+) hierarchy$/) { my $hierarchy = $1; $section = 'hierarchy'; $hierarchy_n++; - my $dbus_conn = $data{'dbus_conn'}; + my $dbus_conn = $data{'dbus_conn'}; undef %data if $hierarchy_n == $hierarchy_id; last if $hierarchy_n == $hierarchy_id+1; $data{'hierarchy'} = $hierarchy; - $data{'dbus_conn'} = $dbus_conn; + $data{'dbus_conn'} = $dbus_conn; } elsif (/^Service\s*(.+)$/) { my $service = $1; die "invalid file format (2)\n" unless $section eq 'hierarchy'; @@ -75,7 +75,7 @@ sub parse_doc_api { die "invalid file format (3)\n" unless $section eq 'hierarchy'; die "invalid interface: $intf\n" unless $intf =~ /^org\.(bluez|openobex)/; $data{'intf'} = $intf; - + $data{$intf} = undef; $data{$intf}{'methods'} = undef; $data{$intf}{'signals'} = undef; @@ -101,14 +101,14 @@ sub parse_doc_api { $section = 'properties'; s/Properties/ /; } - + if (defined $section && $section eq 'methods' && /^\s+((\S+) (\w+)\((.*)\)( \[(\w+)\])?)$/) { my $decl = $1; my $ret = $2; my $name = $3; my $args = $4; my $flag = $6; - + $data{$data{'intf'}}{'methods'}{$name}{'decl'} = $decl; $data{$data{'intf'}}{'methods'}{$name}{'ret'} = $ret; $data{$data{'intf'}}{'methods'}{$name}{'flag'} = $flag; @@ -117,7 +117,7 @@ sub parse_doc_api { my $decl = $1; my $name = $2; my $args = $3; - + $data{$data{'intf'}}{'signals'}{$name}{'decl'} = $decl; @{$data{$data{'intf'}}{'signals'}{$name}{'args'}} = map {type => (split / /, $_)[0], name => (split / /, $_)[1]}, (split /, /, $args); } elsif (defined $section && $section eq 'properties' && /^\s+((\S+) (\w+) \[(readonly|readwrite)\])$/) { @@ -125,16 +125,16 @@ sub parse_doc_api { my $type = $2; my $name = $3; my $mode = $4; - + $data{$data{'intf'}}{'properties'}{$name}{'decl'} = $decl; $data{$data{'intf'}}{'properties'}{$name}{'type'} = $type; $data{$data{'intf'}}{'properties'}{$name}{'mode'} = $mode; - - die "can't find method 'GetProperties'\n" unless defined $data{$data{'intf'}}{'methods'}{'GetProperties'}; - die "can't find method 'SetProperty'" if $mode eq 'readwrite' && !defined $data{$data{'intf'}}{'methods'}{'SetProperty'}; + + die "can't find method 'GetProperties'\n" unless defined $data{$data{'intf'}}{'methods'}{'GetProperties'}; + die "can't find method 'SetProperty'" if $mode eq 'readwrite' && !defined $data{$data{'intf'}}{'methods'}{'SetProperty'}; } } - + return \%data; } @@ -166,7 +166,7 @@ EOH sub get_g_type { my $obj_type = shift; my $g_type; - + $g_type = 'void ' if $obj_type eq 'void'; $g_type = 'gchar *' if $obj_type eq 'object' || $obj_type eq 'string'; $g_type = 'GHashTable *' if $obj_type =~ /^dict/; @@ -179,16 +179,16 @@ sub get_g_type { $g_type = 'GPtrArray *' if $obj_type eq 'array{object}' || $obj_type eq 'array{dict}'; $g_type = 'gchar **' if $obj_type eq 'array{string}'; $g_type = 'guchar ' if $obj_type eq 'byte'; - + die "unknown object type (1): $obj_type\n" unless defined $g_type; - + return $g_type; } sub get_g_type_name { my $obj_type = shift; my $g_type_name; - + $g_type_name = 'DBUS_TYPE_G_OBJECT_PATH' if $obj_type eq 'object'; $g_type_name = 'G_TYPE_STRING' if $obj_type eq 'string'; $g_type_name = 'G_TYPE_VALUE' if $obj_type eq 'variant'; @@ -203,22 +203,22 @@ sub get_g_type_name { $g_type_name = 'G_TYPE_STRV' if $obj_type eq 'array{string}'; $g_type_name = 'G_TYPE_UCHAR' if $obj_type eq 'byte'; $g_type_name = 'DBUS_TYPE_G_HASH_TABLE_ARRAY' if $obj_type eq 'array{dict}'; - + die "unknown object type (2): $obj_type\n" unless defined $g_type_name; - + return $g_type_name; } sub get_default_value { my $c_type = shift; my $default_value; - + $default_value = 'NULL' if $c_type =~ /\*$/; $default_value = 'FALSE' if $c_type =~ /boolean/; $default_value = '0' if $c_type =~ /int/; - + die "unknown C type (3): $c_type\n" unless defined $default_value; - + return $default_value; } @@ -268,23 +268,23 @@ GType {\$object}_get_type(void) G_GNUC_CONST; #endif /* __{\$OBJECT}_H */ EOT - + my $intf = $node->{'intf'}; my $obj = exists $node->{'objectName'} ? $node->{'objectName'} : (split /\./, $intf)[-1]; my $obj_lc = lc join('_', $obj =~ /([A-Z]+[a-z]*)/g); my $obj_uc = uc join('_', $obj =~ /([A-Z]+[a-z]*)/g); - + my $dbus_object_defs = ""; $dbus_object_defs .= "#define {\$OBJECT}_DBUS_PATH \"$node->{'objectPath'}\"\n" if defined $node->{'objectPath'}; $dbus_object_defs .= "#define {\$OBJECT}_DBUS_INTERFACE \"$node->{'intf'}\""; - + my $method_defs = ""; - + for my $method (sort keys %{$node->{$intf}{'methods'}}) { my @a = $method =~ /([A-Z]+[a-z]*)/g; - my %m = %{$node->{$intf}{'methods'}{$method}}; - - my $in_args = join ', ', (map "const ".get_g_type($_->{'type'}).$_->{'name'}, @{$m{'args'}}); + my %m = %{$node->{$intf}{'methods'}{$method}}; + + my $in_args = join ', ', (map "const ".get_g_type($_->{'type'}).$_->{'name'}, @{$m{'args'}}); if (defined $m{'flag'} && $m{'flag'} eq 'async') { $method_defs .= "void {\$object}_".(join '_', (map lc $_, @a))."_begin({\$Object} *self, void (*AsyncNotifyFunc)(gpointer data), gpointer data". @@ -297,31 +297,31 @@ EOT } } $method_defs .= "\n"; - + $method_defs .= "const gchar *{\$object}_get_dbus_object_path({\$Object} *self);\n" unless defined $node->{'objectPath'}; for my $property (sort keys %{$node->{$intf}{'properties'}}) { my @a = $property =~ /([A-Z]+[a-z]*)/g; my %p = %{$node->{$intf}{'properties'}{$property}}; - + $method_defs .= "const ".get_g_type($p{'type'})."{\$object}_get_".(join '_', (map lc $_, @a))."({\$Object} *self);\n"; $method_defs .= "void {\$object}_set_".(join '_', (map lc $_, @a))."({\$Object} *self, const ".get_g_type($p{'type'})."value);\n" if $p{'mode'} eq 'readwrite'; } - + $method_defs =~ s/\s+$//s; - + my $output = "$HEADER\n$HEADER_TEMPLATE\n"; $output =~ s/{DBUS_OBJECT_DEFS}/$dbus_object_defs/; $output =~ s/{METHOD_DEFS}/$method_defs/; $output =~ s/{\$OBJECT}/$obj_uc/g; $output =~ s/{\$Object}/$obj/g; $output =~ s/{\$object}/$obj_lc/g; - + return $output; } sub generate_source { my $node = shift; - + my $SOURCE_TEMPLATE = < @@ -579,18 +579,18 @@ EOT my $obj = exists $node->{'objectName'} ? $node->{'objectName'} : (split /\./, $intf)[-1]; my $obj_lc = lc join('_', $obj =~ /([A-Z]+[a-z]*)/g); my $obj_uc = uc join('_', $obj =~ /([A-Z]+[a-z]*)/g); - + my $methods = ""; my $async_flag = 0; my $priv_async_calls = ''; my $priv_async_calls_init = ''; for my $method (sort keys %{$node->{$intf}{'methods'}}) { my @a = $method =~ /([A-Z]+[a-z]*)/g; - my %m = %{$node->{$intf}{'methods'}{$method}}; - - my $in_args = join ', ', (map "const ".get_g_type($_->{'type'}).$_->{'name'}, @{$m{'args'}}); + my %m = %{$node->{$intf}{'methods'}{$method}}; + + my $in_args = join ', ', (map "const ".get_g_type($_->{'type'}).$_->{'name'}, @{$m{'args'}}); my $in_args2 = join ', ', (map get_g_type_name($_->{'type'}).", $_->{'name'}", @{$m{'args'}}); - + if (defined $m{'flag'} && $m{'flag'} eq 'async') { $async_flag = 1; $priv_async_calls .= "\tDBusGProxyCall *".(join '_', (map lc $_, @a))."_call;\n"; @@ -625,7 +625,7 @@ EOT my $method_def = get_g_type($m{'ret'})."{\$object}_".(join '_', (map lc $_, @a))."({\$Object} *self, ". ($in_args eq '' ? "" : "$in_args, ")."GError **error)"; - + $methods .= "/* $m{'decl'} */\n". "$method_def\n". @@ -644,7 +644,7 @@ EOT $priv_async_calls =~ s/^\t(.+?)\s+$/$1/s; $priv_async_calls_init =~ s/^\t(.+?)\s+$/$1/s; $methods =~ s/\s+$//s; - + my $enum_signals = ""; my $signals_handlers_def = ""; my $signals_registration = ""; @@ -654,18 +654,18 @@ EOT for my $signal (sort keys %{$node->{$intf}{'signals'}}) { my @a = $signal =~ /([A-Z]+[a-z]*)/g; my %s = %{$node->{$intf}{'signals'}{$signal}}; - + my $enum = join '_', (map uc $_, @a); my $handler_name = (join '_', (map lc $_, @a))."_handler"; - my $in_args = join ', ', map(($_->{'type'} ne 'dict' ? "const " : "").get_g_type($_->{'type'}).$_->{'name'}, @{$s{'args'}}); + my $in_args = join ', ', map(($_->{'type'} ne 'dict' ? "const " : "").get_g_type($_->{'type'}).$_->{'name'}, @{$s{'args'}}); my $handler = "static void $handler_name(DBusGProxy *dbus_g_proxy, ".($in_args eq '' ? "" : "$in_args, ")."gpointer data)"; - + $signals_registration .= "\tsignals[$enum] = g_signal_new(\"$signal\",\n". "\t\t\tG_TYPE_FROM_CLASS(gobject_class),\n". "\t\t\tG_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,\n". "\t\t\t0, NULL, NULL,\n"; - # TODO: fix this + # TODO: fix this my $arg_t = join '_', map($_->{'type'}, @{$s{'args'}}); if ($arg_t eq '') { $signals_registration .= @@ -710,16 +710,16 @@ EOT } else { die "unknown signal arguments: $arg_t\n"; } - - my $in_args2 = join ', ', (map get_g_type_name($_->{'type'}), @{$s{'args'}}); + + my $in_args2 = join ', ', (map get_g_type_name($_->{'type'}), @{$s{'args'}}); $signals_connection .= "\t/* $s{'decl'} */\n". "\tdbus_g_proxy_add_signal(self->priv->dbus_g_proxy, \"$signal\", ".($in_args2 eq '' ? "" : "$in_args2, ")."G_TYPE_INVALID);\n". "\tdbus_g_proxy_connect_signal(self->priv->dbus_g_proxy, \"$signal\", G_CALLBACK($handler_name), self, NULL);\n\n"; - + $signals_disconnection .= "\tdbus_g_proxy_disconnect_signal(self->priv->dbus_g_proxy, \"$signal\", G_CALLBACK($handler_name), self);\n"; - + my $args = join ', ', map($_->{'name'}, @{$s{'args'}}); $signals_handlers .= "$handler\n". "{\n". @@ -727,7 +727,7 @@ EOT ($handler_name eq 'property_changed_handler' ? "\t{PROPERTIES_CHANGED_HANDLER}\n\n" : ""). "\tg_signal_emit(self, signals[$enum], 0".($args eq '' ? "" : ", $args").");\n". "}\n\n"; - + $enum_signals .= "\t$enum,\n"; $signals_handlers_def .= "$handler;\n"; } @@ -737,7 +737,7 @@ EOT $signals_connection =~ s/^\t(.+?)\s+$/$1/s; $signals_disconnection =~ s/^\t(.+?)\s+$/$1/s; $signals_handlers =~ s/\s+$//s; - + my $priv_properties = ""; my $enum_properties = ""; my $properties_registration = ""; @@ -759,17 +759,17 @@ EOT "\t/* object DBusObjectPath [readwrite, construct only] */\n". "\tpspec = g_param_spec_string(\"DBusObjectPath\", \"dbus_object_path\", \"Adapter D-Bus object path\", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);\n". "\tg_object_class_install_property(gobject_class, PROP_DBUS_OBJECT_PATH, pspec);\n\n"; - + $get_properties .= "\tcase PROP_DBUS_OBJECT_PATH:\n". "\t\tg_value_set_string(value, {\$object}_get_dbus_object_path(self));\n". "\t\tbreak;\n\n"; - + $set_properties .= "\tcase PROP_DBUS_OBJECT_PATH:\n". - "\t\t{\$object}_post_init(self, g_value_get_string(value));\n". + "\t\t{\$object}_post_init(self, g_value_get_string(value));\n". "\t\tbreak;\n\n"; - + $properties_access_methods .= "const gchar *{\$object}_get_dbus_object_path({\$Object} *self)\n". "{\n". @@ -780,12 +780,12 @@ EOT for my $property (sort keys %{$node->{$intf}{'properties'}}) { my @a = $property =~ /([A-Z]+[a-z]*)/g; my %p = %{$node->{$intf}{'properties'}{$property}}; - + my $property_var = join '_', (map lc $_, @a); my $enum = "PROP_".(join '_', (map uc $_, @a)); my $property_get_method = "{\$object}_get_$property_var"; my $property_set_method = "{\$object}_set_$property_var"; - + $priv_properties .= "\t".get_g_type($p{'type'})."$property_var;\n"; $enum_properties .= "\t$enum, /* $p{'mode'} */\n"; $properties_registration .= "\t/* $p{'decl'} */\n"; @@ -796,12 +796,12 @@ EOT "\tg_assert({\$OBJECT}_IS(self));\n\n". "\treturn self->priv->$property_var;\n". "}\n\n"; - + $properties_changed_handler .= "\"$property\") == 0) {\n"; $get_properties .= "\tcase $enum:\n"; if ($p{'type'} eq 'string') { $properties_registration .= "\tpspec = g_param_spec_string(\"$property\", NULL, NULL, NULL, ".($p{'mode'} eq 'readonly' ? 'G_PARAM_READABLE' : 'G_PARAM_READWRITE').");\n"; - $properties_init .= + $properties_init .= "\tif (g_hash_table_lookup(properties, \"$property\")) {\n". "\t\tself->priv->$property_var = g_value_dup_string(g_hash_table_lookup(properties, \"$property\"));\n". "\t} else {\n". @@ -814,7 +814,7 @@ EOT "\t\tself->priv->$property_var = g_value_dup_string(value);\n"; } elsif ($p{'type'} eq 'object') { $properties_registration .= "\tpspec = g_param_spec_string(\"$property\", NULL, NULL, NULL, ".($p{'mode'} eq 'readonly' ? 'G_PARAM_READABLE' : 'G_PARAM_READWRITE').");\n"; - $properties_init .= + $properties_init .= "\tif (g_hash_table_lookup(properties, \"$property\")) {\n". "\t\tself->priv->$property_var = (gchar *) g_value_dup_boxed(g_hash_table_lookup(properties, \"$property\"));\n". "\t} else {\n". @@ -827,7 +827,7 @@ EOT "\t\tself->priv->$property_var = (gchar *) g_value_dup_boxed(value);\n"; } elsif ($p{'type'} eq 'array{object}') { $properties_registration .= "\tpspec = g_param_spec_boxed(\"$property\", NULL, NULL, G_TYPE_PTR_ARRAY, ".($p{'mode'} eq 'readonly' ? 'G_PARAM_READABLE' : 'G_PARAM_READWRITE').");\n"; - $properties_init .= + $properties_init .= "\tif (g_hash_table_lookup(properties, \"$property\")) {\n". "\t\tself->priv->$property_var = g_value_dup_boxed(g_hash_table_lookup(properties, \"$property\"));\n". "\t} else {\n". @@ -840,7 +840,7 @@ EOT "\t\tself->priv->$property_var = g_value_dup_boxed(value);\n"; } elsif ($p{'type'} eq 'array{string}') { $properties_registration .= "\tpspec = g_param_spec_boxed(\"$property\", NULL, NULL, G_TYPE_STRV, ".($p{'mode'} eq 'readonly' ? 'G_PARAM_READABLE' : 'G_PARAM_READWRITE').");\n"; - $properties_init .= + $properties_init .= "\tif (g_hash_table_lookup(properties, \"$property\")) {\n". "\t\tself->priv->$property_var = (gchar **) g_value_dup_boxed(g_hash_table_lookup(properties, \"$property\"));\n". "\t} else {\n". @@ -854,7 +854,7 @@ EOT "\t\tself->priv->$property_var = (gchar **) g_value_dup_boxed(value);\n"; } elsif ($p{'type'} eq 'uint32') { $properties_registration .= "\tpspec = g_param_spec_uint(\"$property\", NULL, NULL, 0, 0xFFFFFFFF, 0, ".($p{'mode'} eq 'readonly' ? 'G_PARAM_READABLE' : 'G_PARAM_READWRITE').");\n"; - $properties_init .= + $properties_init .= "\tif (g_hash_table_lookup(properties, \"$property\")) {\n". "\t\tself->priv->$property_var = g_value_get_uint(g_hash_table_lookup(properties, \"$property\"));\n". "\t} else {\n". @@ -864,7 +864,7 @@ EOT $properties_changed_handler .= "\t\tself->priv->$property_var = g_value_get_uint(value);\n"; } elsif ($p{'type'} eq 'uint64') { $properties_registration .= "\tpspec = g_param_spec_uint64(\"$property\", NULL, NULL, 0, 0xFFFFFFFFFFFFFFFF, 0, ".($p{'mode'} eq 'readonly' ? 'G_PARAM_READABLE' : 'G_PARAM_READWRITE').");\n"; - $properties_init .= + $properties_init .= "\tif (g_hash_table_lookup(properties, \"$property\")) {\n". "\t\tself->priv->$property_var = g_value_get_uint64(g_hash_table_lookup(properties, \"$property\"));\n". "\t} else {\n". @@ -874,7 +874,7 @@ EOT $properties_changed_handler .= "\t\tself->priv->$property_var = g_value_get_uint64(value);\n"; } elsif ($p{'type'} eq 'boolean') { $properties_registration .= "\tpspec = g_param_spec_boolean(\"$property\", NULL, NULL, FALSE, ".($p{'mode'} eq 'readonly' ? 'G_PARAM_READABLE' : 'G_PARAM_READWRITE').");\n"; - $properties_init .= + $properties_init .= "\tif (g_hash_table_lookup(properties, \"$property\")) {\n". "\t\tself->priv->$property_var = g_value_get_boolean(g_hash_table_lookup(properties, \"$property\"));\n". "\t} else {\n". @@ -884,7 +884,7 @@ EOT $properties_changed_handler .= "\t\tself->priv->$property_var = g_value_get_boolean(value);\n"; } elsif ($p{'type'} eq 'byte') { $properties_registration .= "\tpspec = g_param_spec_uchar(\"$property\", NULL, NULL, 0, 0xFF, 0, ".($p{'mode'} eq 'readonly' ? 'G_PARAM_READABLE' : 'G_PARAM_READWRITE').");\n"; - $properties_init .= + $properties_init .= "\tif (g_hash_table_lookup(properties, \"$property\")) {\n". "\t\tself->priv->$property_var = g_value_get_uchar(g_hash_table_lookup(properties, \"$property\"));\n". "\t} else {\n". @@ -899,13 +899,13 @@ EOT $properties_init .= "\n"; $get_properties .= "\t\tbreak;\n\n"; $properties_changed_handler .= "\t} else if (g_strcmp0(name, "; - - if ($p{'mode'} eq 'readwrite') { - $set_properties .= - "\tcase $enum:\n". + + if ($p{'mode'} eq 'readwrite') { + $set_properties .= + "\tcase $enum:\n". "\t\t{\$object}_set_property(self, \"$property\", value, &error);\n". - "\t\tbreak;\n\n"; - + "\t\tbreak;\n\n"; + $properties_access_methods .= "void $property_set_method({\$Object} *self, const ".get_g_type($p{'type'})."value)\n". "{\n". @@ -930,11 +930,11 @@ EOT "\t}\n". "\tg_assert(error == NULL);\n". "}\n\n"; - } + } } $properties_init .= "\tg_hash_table_unref(properties);\n\n"; - + $priv_properties =~ s/^\t(.+?)\s+$/$1/s; $enum_properties =~ s/^\t(.+), (\/\* .+? \*\/)\s+$/$1 $2/s; $properties_registration =~ s/^\t(.+?)\s+$/$1/s; @@ -944,9 +944,9 @@ EOT $properties_access_methods =~ s/\s+$//s; $properties_free =~ s/^\t(.+?)\s+$/$1/s; $properties_changed_handler =~ s/^\t(.+?) else if \(g_strcmp0\(name, $/$1/s; - + $properties_free ="/* none */" if $properties_free eq ''; - + my $output = "$HEADER\n$SOURCE_TEMPLATE"; if (defined $node->{'objectPath'}) { $output =~ s/\{IF_INIT\}\s+(.+?)\s+\{FI_INIT\}/$1/gs; @@ -961,14 +961,14 @@ EOT $output =~ s/\s+\{IF_SIGNALS\}.+?\{FI_SIGNALS\}//gs; } if (scalar keys %{$node->{$intf}{'properties'}} > 0 || !defined $node->{'objectPath'}) { - $output =~ s/\{IF_PROPERTIES\}\s+(.+?)\s+\{FI_PROPERTIES\}/$1/gs; + $output =~ s/\{IF_PROPERTIES\}\s+(.+?)\s+\{FI_PROPERTIES\}/$1/gs; } else { - $output =~ s/\s+\{IF_PROPERTIES\}.+?\{FI_PROPERTIES\}//gs; + $output =~ s/\s+\{IF_PROPERTIES\}.+?\{FI_PROPERTIES\}//gs; } if (scalar keys %{$node->{$intf}{'properties'}} > 0) { - $output =~ s/\{IF_PROPERTIES_EXT\}\s+(.+?)\s+\{FI_PROPERTIES_EXT\}/$1/gs; + $output =~ s/\{IF_PROPERTIES_EXT\}\s+(.+?)\s+\{FI_PROPERTIES_EXT\}/$1/gs; } else { - $output =~ s/\s+\{IF_PROPERTIES_EXT\}.+?\{FI_PROPERTIES_EXT\}//gs; + $output =~ s/\s+\{IF_PROPERTIES_EXT\}.+?\{FI_PROPERTIES_EXT\}//gs; } if ($async_flag == 1) { $output =~ s/\{IF_ASYNC_CALLS\}\s+(.+?)\s+\{FI_ASYNC_CALLS\}/$1/gs; @@ -998,12 +998,12 @@ EOT $output =~ s/{\$OBJECT}/$obj_uc/g; $output =~ s/{\$Object}/$obj/g; $output =~ s/{\$object}/$obj_lc/g; - + # Some formatting fixes $output =~ s/\s+?(\t*\})/\n$1/g; $output =~ s/(switch \(\w+\) \{\n)\s+?(\t+default:)/$1$2/s; $output =~ s/\s+$/\n\n/s; - + return $output; } diff --git a/contrib/generate-bluez-gobjects.sh b/contrib/generate-bluez-gobjects.sh index b1fedf7..540f6e1 100755 --- a/contrib/generate-bluez-gobjects.sh +++ b/contrib/generate-bluez-gobjects.sh @@ -2,7 +2,7 @@ # BlueZ API -API_VERSION=4.75 +API_VERSION=4.96 # adapter-api.txt ./gen-dbus-gobject.pl -header bluez-api-${API_VERSION}-fixed/adapter-api.txt > ../src/lib/bluez/adapter.h diff --git a/contrib/generate-obexd-gobjects.sh b/contrib/generate-obexd-gobjects.sh index 7e77676..f7aef46 100755 --- a/contrib/generate-obexd-gobjects.sh +++ b/contrib/generate-obexd-gobjects.sh @@ -2,7 +2,7 @@ # OBEXD API -API_VERSION=0.34 +API_VERSION=0.42 # client-api.txt ./gen-dbus-gobject.pl -header obexd-api-${API_VERSION}-fixed/client-api.txt > ../src/lib/obexd/obexclient.h diff --git a/contrib/obexd-api-0.34-fixed/agent-api.txt b/contrib/obexd-api-0.34-fixed/agent-api.txt deleted file mode 100644 index e3dbc78..0000000 --- a/contrib/obexd-api-0.34-fixed/agent-api.txt +++ /dev/null @@ -1,30 +0,0 @@ -obexd Agent API description -********************************** - -Copyright (C) 2007-2010 Nokia Corporation -Copyright (C) 2007-2010 Marcel Holtmann - - -Agent hierarchy -=============== - -Service unique name -Interface org.openobex.Agent -Object path freely definable - -Methods - string Authorize(object transfer, string bt_address, string name, string type, int32 length, int32 time) - - This method gets called when the service daemon - needs to accept/reject a Bluetooth object push request. - Returns the full path (including the filename) where - the object shall be stored. - - Possible errors: org.openobex.Error.Rejected - org.openobex.Error.Canceled - - void Cancel() - - This method gets called to indicate that the agent - request failed before a reply was returned. It cancels - the previous request. diff --git a/contrib/obexd-api-0.34-fixed/agent.xml b/contrib/obexd-api-0.34-fixed/agent.xml deleted file mode 100644 index bb089dd..0000000 --- a/contrib/obexd-api-0.34-fixed/agent.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/obexd-api-0.34-fixed/client-api.txt b/contrib/obexd-api-0.34-fixed/client-api.txt deleted file mode 100644 index fa8a36d..0000000 --- a/contrib/obexd-api-0.34-fixed/client-api.txt +++ /dev/null @@ -1,329 +0,0 @@ -OBEX client API description -*************************** - -Copyright (C) 2007-2010 Marcel Holtmann - - -Client hierarchy -================ - -Service org.openobex.client -Interface org.openobex.Client -Object path / -Object name OBEXClient - -Methods void SendFiles(dict device, array{string} files, object agent) - - Send one or multiple local files to the specified - device. The device is configured via properties. At - least the Destination property should be specified. - - void PullBusinessCard(dict device, string file) - - Request the business card from a remote device and - store it in the local file. - - void ExchangeBusinessCards(dict device, string clientfile, string file) - - Push the client's business card to the remote device - and then retrieve the remote business card and store - it in a local file. - - object CreateSession(dict device) - - Create a new OBEX session. The device is configured - via properties like in SendFiles. - - void RemoveSession(object session) - - Unregister session and abort pending transfers. - - string GetCapabilities(dict device) - - Get remote device capabilities. - -Properties string Target - - string Source - - string Destination - - byte Channel - - -Session hierarchy -================= - -Service org.openobex.client -Interface org.openobex.Session -Object path [variable prefix]/{session0,session1,...} -Object name OBEXClientSession - -Methods dict GetProperties() - - Returns all properties for the session. - - void AssignAgent(object agent) - - Assign an OBEX agent to this session. This allows - detailed progress reports about the transactions. - - void ReleaseAgent(object agent) - - Release a previously assigned OBEX agent. - -Properties string Source [readonly] - - string Destination [readonly] - - byte Channel [readonly] - - -File Transfer hierarchy -======================= - -Service org.openobex.client -Interface org.openobex.FileTransfer -Object path [variable prefix]/{session0,session1,...} -Object name OBEXClientFileTransfer - -Methods void ChangeFolder(string folder) - - Change the current folder of the remote device. - - void CreateFolder(string folder) - - Create a new folder in the remote device. - - array{dict} ListFolder() - - Returns a dictionary containing information about - the current folder content. - - The following keys are defined: - - string Name : Object name in UTF-8 format - string Type : Either "folder" or "file" - uint64 Size : Object size or number of items in folder - string Permission : Group, owner and other permission - guint64 Modified : Last change - guint64 Accessed : Last access - guint64 Created : Creation date - - void GetFile(string targetfile, string sourcefile) - - Copy the source file (from remote device) to the - target file (on local filesystem). - - A new Transfer object is created to represent this - transaction. - - void PutFile(string sourcefile, string targetfile) - - Copy the source file (from local filesystem) to the - target file (on remote device). - - A new Transfer object is created to represent this - transaction. - - void CopyFile(string sourcefile, string targetfile) - - Copy a file within the remote device from source file - to target file. - - void MoveFile(string sourcefile, string targetfile) - - Movea file within the remote device from source file - to the target file. - - void Delete(string file) - - Deletes the specified file/folder. - - -Phonebook Access hierarchy -======================= - -Service org.openobex.client -Interface org.openobex.PhonebookAccess -Object path [variable prefix]/{session0,session1,...} - -Methods void Select(string location, string phonebook) - - Select the phonebook object for other operations. Should - be call before all the other operations. - - location : Where the phonebook is stored, possible inputs : - "INT" ( "INTERNAL" which is default ) - "SIM" ( "SIM1" ) - "SIM2" - ... - - phonebook : Possible inputs : - "pb" : phonebook for the saved contacts - "ich": incoming call history - "och": outgoing call history - "mch": missing call history - "cch": combination of ich och mch - - string PullAll() - - Return the entire phonebook object from the PSE server - in plain string with vcard format. - - array{string vcard, string name} List() - - Return an array of vcard-listing data which contains the - vcard : name paired string, for example "1.vcf" : "John". - - string Pull(string vcard) - - Retrieve the vcard in the current phonebook object - for example : Pull("0.vcf") - - array{string vcard, string name} - Search(string field, string value) - - Return an array of vcard-listing data which contains the - vcard : name paired string match the search condition. - - field : the field in the vcard to search with - { "name" (default) | "number" | "sound" } - value : the string value to search for - - uint16 GetSize() - - Return the number of the non-null entries in the selected - phonebook object. - - void SetFormat(string format) - - Indicate the format of the vcard that should be return by - related methods. - - format : { "vcard21" (default) | "vcard30" } - - void SetOrder(string order) - - Indicate the sorting method of the vcard-listing data returned - by List and Search methods. - - order : { "indexed" (default) | "alphanumeric" | "phonetic" } - - void SetFilter(array{string}) {FIX?!} - - Indicate fields that should be contained in vcards return by - related methods. - - Give an empty array will clear the filter and return all fields - available in vcards. And this is the default behavior. - - Possible filter fields : "VERSION", "FN", ..., "ALL", "bit[0-63]" - - array{string} ListFilterFields() {FIX?!} - - Return All Available fields that can be used in SefFilter method. - - array{string} GetFilter() - - Return the current filter setting - -Synchronization hierarchy -======================= - -Service org.openobex.client -Interface org.openobex.Synchronization -Object path [variable prefix]/{session0,session1,...} - -Methods void SetLocation(string location) - - Set the phonebook object store location for other operations. Should - be called before all the other operations. - - location: Where the phonebook is stored, possible values: - "INT" ( "INTERNAL" which is default ) - "SIM1" - "SIM2" - ...... - - string GetPhonebook() - - retrieve an entire Phonebook Object store from remote device - - void PutPhonebook(string obj) - - send an entire Phonebook Object store to remote device - -Transfer hierarchy -================== - -Service org.openobex.client -Interface org.openobex.Transfer -Object path [variable prefix]/{transfer0,transfer1,...} -Object name OBEXClientTransfer - -Methods dict GetProperties() - - Returns all properties for the transfer. See the - properties section for available properties. - - void Cancel() - - Cancels this transfer. - -Properties string Name [readonly] - - Name of the transferred object. - - uint64 Size [readonly] - - Size of the transferred object. If the size is - unknown, then this property will not be present. - - string Filename [readonly] - - Complete name of the file being received or sent. - - -Agent hierarchy -=============== - -Service unique name -Interface org.openobex.Agent -Object path freely definable - -Methods void Release() - - This method gets called when the service daemon - unregisters the agent. An agent can use it to do - cleanup tasks. There is no need to unregister the - agent, because when this method gets called it has - already been unregistered. - - string Request(object transfer) - - Accept or reject a new transfer (client and server) - and provide the filename for it. - - In case of incoming transfers it is the filename - where to store the file and for outgoing transfers - it is the filename to show the remote device. If left - empty it will be calculated automatically. - - Possible errors: org.openobex.Error.Rejected - org.openobex.Error.Canceled - - void Progress(object transfer, uint64 transferred) - - Progress within the transfer has been made. The - number of transferred bytes is given as second - argument for convenience. - - void Complete(object transfer) - - Informs that the transfer has completed sucessfully. - - void Error(object transfer, string message) - - Informs that the transfer has been terminated because - of some error. diff --git a/contrib/obexd-api-0.34-fixed/obexd-api.txt b/contrib/obexd-api-0.34-fixed/obexd-api.txt deleted file mode 100644 index 6cfaac7..0000000 --- a/contrib/obexd-api-0.34-fixed/obexd-api.txt +++ /dev/null @@ -1,90 +0,0 @@ -obexd API description -********************************** - -Copyright (C) 2007-2010 Nokia Corporation -Copyright (C) 2007-2010 Marcel Holtmann - - -Manager hierarchy -=============== - -Service org.openobex -Interface org.openobex.Manager -Object path / -Object name OBEXManager - -Methods - void RegisterAgent(object agent) - - Register an agent to request authorization of - the user to accept/reject objects. Object push - service needs to authorize each received object. - - Possible errors: org.openobex.Error.AlreadyExists - - void UnregisterAgent(object agent) - - This unregisters the agent that has been previously - registered. The object path parameter must match the - same value that has been used on registration. - - Possible errors: org.openobex.Error.DoesNotExist - -Signals SessionCreated(object session) - - Signal sent when OBEX connection has been accepted. - (FTP only) - - SessionRemoved(object session) - - Sent when the transport is disconnected - (FTP only) - - TransferStarted(object transfer) - - Signal sent when an object push operation starts. - (OPP only) - - TransferCompleted(object transfer, boolean success) - - Signal sent when the object has been received - or an error happens. - (OPP only) - - -Transfer hierarchy -=============== - -Service org.openobex -Interface org.openobex.Transfer -Object path /transfer{0, 1, 2, ...} -Object name OBEXTransfer - -Methods - void Cancel() - - Stops the current transference. - -Signals - Progress(int32 total, int32 transfered) - - -Session hierarchy -=============== - -Service org.openobex -Interface org.openobex.Session -Object path /session{0, 1, 2, ...} -Object name OBEXSession - -Methods - dict GetProperties() - - -Signals TBD - - -Properties - string Address [readonly] - - Bluetooth device address or USB diff --git a/src/bt-agent.c b/src/bt-agent.c index ec78922..3b1bbc2 100644 --- a/src/bt-agent.c +++ b/src/bt-agent.c @@ -154,7 +154,7 @@ static void agent_released(Agent *agent, gpointer data) static gchar *adapter_arg = NULL; static gchar *capability_arg = NULL; -static gchar *daemon_arg = FALSE; +static gboolean daemon_arg = FALSE; static GOptionEntry entries[] = { {"adapter", 'a', 0, G_OPTION_ARG_STRING, &adapter_arg, "Adapter Name or MAC", ""}, diff --git a/src/bt-network.c b/src/bt-network.c index 4e3345e..b47c4bd 100644 --- a/src/bt-network.c +++ b/src/bt-network.c @@ -2,7 +2,7 @@ * * bluez-tools - a set of tools to manage bluetooth devices for linux * - * Copyright (C) 2010 Alexander Orlenko + * Copyright (C) 2010-2011 Alexander Orlenko * * * This program is free software; you can redistribute it and/or modify @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -80,11 +81,13 @@ static gchar *connect_uuid_arg = NULL; static gboolean server_arg = FALSE; static gchar *server_uuid_arg = NULL; static gchar *server_brige_arg = NULL; +static gboolean daemon_arg = FALSE; static GOptionEntry entries[] = { {"adapter", 'a', 0, G_OPTION_ARG_STRING, &adapter_arg, "Adapter Name or MAC", ""}, {"connect", 'c', 0, G_OPTION_ARG_NONE, &connect_arg, "Connect to the network device", NULL}, {"server", 's', 0, G_OPTION_ARG_NONE, &server_arg, "Start GN/PANU/NAP server", NULL}, + {"daemon", 'd', 0, G_OPTION_ARG_NONE, &daemon_arg, "Run in background (as daemon)"}, {NULL} }; @@ -209,6 +212,28 @@ int main(int argc, char *argv[]) mainloop = g_main_loop_new(NULL, FALSE); + if (daemon_arg) { + pid_t pid, sid; + + /* Fork off the parent process */ + pid = fork(); + if (pid < 0) + exit(EXIT_FAILURE); + /* Ok, terminate parent proccess */ + if (pid > 0) + exit(EXIT_SUCCESS); + + /* Create a new SID for the child process */ + sid = setsid(); + if (sid < 0) + exit(EXIT_FAILURE); + + /* Close out the standard file descriptors */ + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); + } + trap_signals(); g_main_loop_run(mainloop); -- cgit v1.2.1