Skip to content

Commit 9ae87d0

Browse files
committed
BusKit: strting to experiment with D-Bus communication framework faster than DBusKit. It's already up to 5 times faster on simple reqests - will see on others.
1 parent b47d53a commit 9ae87d0

18 files changed

+1442
-0
lines changed

Frameworks/BusKit/BKConnection.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#import <Foundation/Foundation.h>
2+
#import <dbus/dbus.h>
3+
4+
@interface BKConnection : NSObject
5+
{
6+
DBusConnection *dbus_connection;
7+
DBusError dbus_error;
8+
}
9+
10+
- (DBusConnection *)dbusConnection;
11+
12+
@end

Frameworks/BusKit/BKConnection.m

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#import "BKConnection.h"
2+
#include "objc/objc.h"
3+
#include "BKMessage.h"
4+
5+
@implementation BKConnection
6+
7+
- (void)dealloc
8+
{
9+
dbus_connection_unref(dbus_connection);
10+
[super dealloc];
11+
}
12+
13+
- (instancetype)init
14+
{
15+
[super init];
16+
17+
dbus_error_init(&dbus_error);
18+
dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error);
19+
20+
return self;
21+
}
22+
23+
- (DBusConnection *)dbusConnection
24+
{
25+
return dbus_connection;
26+
}
27+
28+
@end

Frameworks/BusKit/BKMessage.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#import <Foundation/Foundation.h>
2+
#include "BKConnection.h"
3+
#import <dbus/dbus.h>
4+
5+
@interface BKMessage : NSObject
6+
{
7+
DBusMessage *dbus_message;
8+
DBusMessageIter dbus_message_iterator;
9+
DBusError dbus_error;
10+
}
11+
12+
- (instancetype)initWithObject:(const char *)object_path // /org/clightd/clightd/Backlight2
13+
interface:(const char *)interface_path // org.clightd.clightd.Backlight2
14+
method:(const char *)method_name // Get
15+
service:(const char *)service_path; // org.clightd.clightd
16+
- (void)setMethodArguments:(NSArray *)args;
17+
18+
- (id)sendWithConnection:(BKConnection *)connection;
19+
20+
@end

0 commit comments

Comments
 (0)