Swiftpack.co - Package - smartdevicelink/bson_c_lib

README

Library for converting to and from BSON

Build library

./configure
make

Install library

sudo make install

Build Lua wrapper

Install Dependencies

sudo apt-get install lua5.2 liblua5.2 liblua5.2-dev

Build Library

./configure --with-lua-wrapper=yes
make

Using the Lua Library

bson = require("bson4lua");

bsonBytes = bson.to_bytes({
	doubleValue = {
		type = 0x01, --Double type
		value = 3.141592653589793
	},
	intValue = {
		type = 0x10, --Int32 Type
		value = 360
	},
	stringValue = {
		type = 0x02, --String type
		value = "A string of characters"
	}
});

print(bsonBytes:byte(1, string.len(bsonBytes)));

bsonTable = bson.to_table(string.char(0x05, 0x00, 0x00, 0x00, 0x00)); --Empty BSON document

print("Table: ");
for k, v in pairs(bsonTable) do
    print(k, v);
end

Apple Platforms

There is a CocoaPod for iOS, MacOS, tvOS, and watchOS. Add to your podfile:

pod 'BiSON'

Android Platforms

There is a jCenter artifact for Android. Add the following to your build.gradle:

dependencies {
    compile ('com.smartdevicelink:bson_java_port:1.2.2')
}

Build and run sample program

cd examples
gcc -o sample sample.c -lbson
./sample

Build and run unit tests

Running unit tests requires check framework installed with pkg-config file (.pc). On Ubuntu, please install it by running:

sudo apt-get install check

Once the framework is installed, invoke configure with --with-tests option, build the library then run make check:

./configure --with-tests
make
make check

Github

link
Stars: 0

Dependencies

Used By

Total: 0

Releases

Release 1.2.0 -

Release 1.1.1 -

Fixes/improvements

  • Fixed implicit casts in the library - #12
  • Updated pod version - #11

Release 1.1.0 -

New Features

  • Added Lua support through a new wrapper library bson4lua - #8

Release 1.0.3 -

Fixes/improvements

  • Fixed segfault in bson_object_iterator_next - #7

Release 1.0.2 -

Fixes/improvements

  • Fixed issue when using old versions of git due to gitignore formatting - #6

Release 1.0.1 -

Fixes/improvements

  • Updated build structure to allow for a custom include directory - #2
  • Updated .gitignore to match with build system changes - #3
  • Added podspec for Apple platforms - #4