Skip to content

Commit

Permalink
Clarifying Packet Table usage in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
st1vms committed Apr 13, 2023
1 parent 479af6f commit 990ef4e
Showing 1 changed file with 55 additions and 29 deletions.
84 changes: 55 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<a href="https://www.buymeacoffee.com/st1vms"><img src="https://img.buymeacoffee.com/button-api/?text=1 Pizza Margherita&emoji=🍕&slug=st1vms&button_colour=0fa913&font_colour=ffffff&font_family=Bree&outline_colour=ffffff&coffee_colour=FFDD00" /></a>
# dynamic-bits

## Table of content

- [Overview](#overview)
- [Installation](#installation)
- [Manual (Linux)](#manual-linux-installation)
- [Requirements (Linux)](#requirements-linux)
- [Manual (Android)](#manual-android-installation)
- [Requirements (Android)](#requirements-android)
- [Linux Installation](#linux-installation)
- [Building on Linux (Cmake)](#building-on-linux-cmake)
- [Android Installation](#manual-android-installation)
- [Uninstalling](#uninstalling)
- [Usage](#usage)
- [Notes](#notes)

-------------------------------------

## Overview
# Overview

This is a serialization library that supports **variable length integers/doubles**, **UTF8 strings** and serialization of **boolean bits**.
This library is designed to be **strong**, **lightweight** and **fast**, using (one-malloc) allocation strategy and minimizing the amount of resources during serialization/deserialization.
Expand All @@ -25,21 +23,34 @@ Each "packet" is defined in a packet table, a fixed number of fields is assigned

Programmers must register their packets in the table before any de/serialization activity, this way thread safety can be achieved.

-------------------------------------

## Installation
# Linux-Installation

For now only Linux manual installation option is available, along with Android binding...
## Requirements

## Manual-Linux-Installation
- [cmake](https://cmake.org/install/) is required in order to build this library.
- Download this repository, either by zip or git using:
```
git clone https://github.com/st1vms/dynamic-bits
```
### Requirements-Linux
## Before building
_____________________________________
- [cmake](https://cmake.org/install/) is required in order to build this library.
After downloading the git repository, move into the downloaded directory, make a build folder and generate build files using cmake.
Ensure to set optimal values for `PACKET_TABLE_SIZE` and `MAX_PACKET_FIELDS` macros. They are located in the first lines of [include/dpacket.h](include/dpacket.h)
***PACKET_TABLE_SIZE** -> Max number of packets that can be registered.*
***MAX_PACKET_FIELDS** -> Max number of fields a packet can hold.*
It is drastically important to tweak these two values in order to optimize space required for building the static packet table.
## Building-On-Linux-CMake
__________________________________
After configuration is done, open a terminal inside the repository directory, make a build folder and generate build files using cmake.
```
git clone https://github.com/st1vms/dynamic-bits
cd ./dynamic-bits
mkdir build
cd build
Expand All @@ -48,28 +59,33 @@ cmake .. && cmake --build .
Inside the build folder you will find the generated shared library.
To install the library run these two commands inside build folder...
To install the library on Linux run these two commands inside build folder...
```
sudo make install
sudo ldconfig /usr/local/lib
```
-------------------------------------

## Uninstalling

Run these two commands inside project folder...
```
chmod u+x uninstall.sh
sudo ./uninstall.sh
```
-------------------------------------
# Manual-Android-Installation
## Manual-Android-Installation
- Install [Android Studio](https://cmake.org/install/) if not already installed.
- Open the JDBits bind project inside Android Studio
## Before Building ( Android )
_____________________________________
Ensure to set optimal values for `PACKET_TABLE_SIZE` and `MAX_PACKET_FIELDS` macros. They are located in the first lines of [jdbits/src/main/cpp/include/dpacket.h](binds/Android/JDBits/jdbits/src/main/cpp/include/dpacket.h)
***PACKET_TABLE_SIZE** -> Max number of packets that can be registered.*
***MAX_PACKET_FIELDS** -> Max number of fields a packet can hold.*
It is drastically important to tweak these two values in order to optimize space required for building the static packet table.
## Building AAR library in Android Studio
_____________________________________
- After syncing gradle files, open a terminal and execute this command:
```
JAVA_HOME=$HOME/android-studio/jbr ./gradlew jdbits:assemble
Expand All @@ -79,19 +95,29 @@ You will find the generated **jdbits-<build_version>.aar** file inside the `buil
Copy the AAR file into your Android project **`libs`** folder, and import is as an **`implementation`** dependency, using the Android Studio dependency manager in your Project Settings.
-------------------------------------
## Usage
_____________________________________
Please refer to the examples provided in the [examples](examples/) folder, for the specific language/platform you're using...
- [C-Example](examples/c-example/)
- [Android-Java-Example](examples/android-example/app/src/main/java/com/example/dbitsandroidexample/MainActivity.java)
-------------------------------------
## Notes
_____________________________________
This library doesn't still support complex structures, such as arrays, unions, dictonaries, etc...
I'm planning to add them very soon along with bindings for Python and Java.
## Uninstalling
_____________________________________
Run these two commands inside project folder...
```
chmod u+x uninstall.sh
sudo ./uninstall.sh
```

0 comments on commit 990ef4e

Please sign in to comment.