Library for converting to and from BSON
./configure
make
sudo make install
sudo apt-get install lua5.2 liblua5.2 liblua5.2-dev
./configure --with-lua-wrapper=yes
make
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
There is a CocoaPod for iOS, MacOS, tvOS, and watchOS. Add to your podfile:
pod 'BiSON'
There is a jCenter artifact for Android. Add the following to your build.gradle
:
dependencies {
api 'com.smartdevicelink:bson_java_port:1.2.5'
}
cd examples
gcc -o sample sample.c -lbson
./sample
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