Go to file
Jacob Keeler b6eb906431
Merge branch 'release/1.2.0' into fix/java_length_checking
2019-05-06 11:01:47 -04:00
BsonJavaPort Merge branch 'release/1.2.0' into fix/java_length_checking 2019-05-06 11:01:47 -04:00
examples Initial Commit 2017-07-27 11:36:17 -04:00
lua Use safe function in lua wrapper for converting from bytes 2019-02-25 23:19:16 -05:00
m4 Fix build system 2017-07-27 16:04:11 -04:00
src Reflect review comment 2019-01-24 20:04:59 +09:00
test Reflect review comment 2019-01-24 20:24:16 +09:00
.gitignore Add bson_object test with corrupted data 2018-12-11 17:47:39 +09:00
BiSON.podspec Update BiSON.podspec 2019-04-17 11:15:30 -04:00
LICENSE Add LICENSE 2017-08-01 15:01:17 -04:00
Makefile.am Add --with-tests configure option 2019-01-08 18:48:56 +09:00
Makefile.in Add --with-tests configure option 2019-01-08 18:48:56 +09:00
README.md Add documentation of unit tests 2019-01-16 10:30:36 +09:00
aclocal.m4 Add --with-tests configure option 2019-01-08 18:48:56 +09:00
compile Fix build system 2017-07-27 16:04:11 -04:00
config.guess Fix build system 2017-07-27 16:04:11 -04:00
config.h Add Lua port 2017-11-29 10:47:57 -05:00
config.h.in Fix build system 2017-07-27 16:04:11 -04:00
config.sub Fix build system 2017-07-27 16:04:11 -04:00
configure Add --with-tests configure option 2019-01-08 18:48:56 +09:00
configure.ac Add --with-tests configure option 2019-01-08 18:48:56 +09:00
depcomp Fix build system 2017-07-27 16:04:11 -04:00
install-sh Fix build system 2017-07-27 16:04:11 -04:00
ltmain.sh Fix build system 2017-07-27 16:04:11 -04:00
missing Fix build system 2017-07-27 16:04:11 -04:00
test-driver Add missing file 2019-01-08 19:01:35 +09:00
third_party.md add emhashmap 2018-10-29 13:31:01 -04:00

README.md

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 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.1.1')
}

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