How to add Sigfox library to your project - sigfox-tech-radio/sigfox-ep-lib GitHub Wiki
The best way to embed the Sigfox End-Point library into your project is to use a Git submodule. The library will be seen as a sub-repository with independant history. It will be much easier to upgrade the library or to switch between versions when necessary, by using the common git pull
and git checkout
commands within the sigfox-ep-lib
folder.
In order to keep the repository clean, it is recommended to:
- either create your own
sigfox_ep_flags.h
header file in another location of the library. You can copy and rename thesigfox_ep_flags_template.h
file provided in the repository. - or generate the
sigfox_ep_flags.h
header file with cmake (see below sections withcmake
commands). - or define the
SIGFOX_EP_DISABLE_FLAGS_FILE
flag and select the compilation flags in your project settings.
This way, you can change the compilation flags when you want, in order to add features or save code memory. The source code will be set up automatically according to your flags selection, without any action or diff in the submodule folder.
To add the Sigfox library submodule, go to your project location and run the following commands:
mkdir lib
cd lib/
git submodule add https://github.com/sigfox-tech-radio/sigfox-ep-lib.git
This will clone the Sigfox End-Point library repository. At project level, you can commit the submodule creation with the following commands:
git commit --message "Add Sigfox End Point library submodule."
git push
With the submodule, you can easily:
- Update the library to the latest version:
cd lib/sigfox-ep-lib/
git pull
git checkout master
- Use a specific release:
cd lib/sigfox-ep-lib/
git pull
git checkout <tag>
You can download or clone any release of the Sigfox End-Point library and copy all files into your project. Then, as described before, you can either define the SIGFOX_EP_DISABLE_FLAGS_FILE
flag and select the compilation flags in your project settings, or create your own sigfox_ep_flags.h
file from the provided template.
git clone https://github.com/sigfox-tech-radio/sigfox-ep-lib.git
You can download or clone any release of the Sigfox End-Point library and copy all files into your project. If you do not plan to change your compilation flags in the future, you can perform a precompilation step before copying the file in your project. The precompilation will remove all preprocessor directives according to your flags selection, in order to produce a more readable code. Then you can copy the new files into your project.
git clone https://github.com/sigfox-tech-radio/sigfox-ep-lib.git
To perform the precompilation, you have to install cmake
and unifdef
tools, and run the following commands:
cd sigfox-ep-lib/
mkdir build
cd build/
cmake -DSIGFOX_EP_RC1_ZONE=ON \
-DSIGFOX_EP_RC2_ZONE=ON \
-DSIGFOX_EP_RC3_LBT_ZONE=ON \
-DSIGFOX_EP_RC3_LDC_ZONE=ON \
-DSIGFOX_EP_RC4_ZONE=ON \
-DSIGFOX_EP_RC5_ZONE=ON \
-DSIGFOX_EP_RC6_ZONE=ON \
-DSIGFOX_EP_RC7_ZONE=ON \
-DSIGFOX_EP_APPLICATION_MESSAGES=ON \
-DSIGFOX_EP_CONTROL_KEEP_ALIVE_MESSAGE=ON \
-DSIGFOX_EP_BIDIRECTIONAL=ON \
-DSIGFOX_EP_ASYNCHRONOUS=ON \
-DSIGFOX_EP_LOW_LEVEL_OPEN_CLOSE=ON \
-DSIGFOX_EP_REGULATORY=ON \
-DSIGFOX_EP_LATENCY_COMPENSATION=ON \
-DSIGFOX_EP_SINGLE_FRAME=ON \
-DSIGFOX_EP_UL_BIT_RATE_BPS=OFF \
-DSIGFOX_EP_TX_POWER_DBM_EIRP=OFF \
-DSIGFOX_EP_T_IFU_MS=OFF \
-DSIGFOX_EP_T_CONF_MS=OFF \
-DSIGFOX_EP_UL_PAYLOAD_SIZE=OFF \
-DSIGFOX_EP_AES_HW=ON \
-DSIGFOX_EP_CRC_HW=OFF \
-DSIGFOX_EP_MESSAGE_COUNTER_ROLLOVER=OFF \
-DSIGFOX_EP_PARAMETERS_CHECK=ON \
-DSIGFOX_EP_CERTIFICATION=ON \
-DSIGFOX_EP_PUBLIC_KEY_CAPABLE=ON \
-DSIGFOX_EP_VERBOSE=ON \
-DSIGFOX_EP_ERROR_CODES=ON \
-DSIGFOX_EP_ERROR_STACK=12 ..
make precompil
The sigfox_ep_flags.h
header file is generated in the build
folder, and the new files in the build/precompil
folder.
You can also download or clone any release of the Sigfox End-Point library and build a static library.
git clone https://github.com/sigfox-tech-radio/sigfox-ep-lib.git
To build a static library, you have to install cmake
tool and run the following commands:
cd sigfox-ep-lib/
mkdir build
cd build/
cmake -DSIGFOX_EP_RC1_ZONE=ON \
-DSIGFOX_EP_RC2_ZONE=ON \
-DSIGFOX_EP_RC3_LBT_ZONE=ON \
-DSIGFOX_EP_RC3_LDC_ZONE=ON \
-DSIGFOX_EP_RC4_ZONE=ON \
-DSIGFOX_EP_RC5_ZONE=ON \
-DSIGFOX_EP_RC6_ZONE=ON \
-DSIGFOX_EP_RC7_ZONE=ON \
-DSIGFOX_EP_APPLICATION_MESSAGES=ON \
-DSIGFOX_EP_CONTROL_KEEP_ALIVE_MESSAGE=ON \
-DSIGFOX_EP_BIDIRECTIONAL=ON \
-DSIGFOX_EP_ASYNCHRONOUS=ON \
-DSIGFOX_EP_LOW_LEVEL_OPEN_CLOSE=ON \
-DSIGFOX_EP_REGULATORY=ON \
-DSIGFOX_EP_LATENCY_COMPENSATION=ON \
-DSIGFOX_EP_SINGLE_FRAME=ON \
-DSIGFOX_EP_UL_BIT_RATE_BPS=OFF \
-DSIGFOX_EP_TX_POWER_DBM_EIRP=OFF \
-DSIGFOX_EP_T_IFU_MS=OFF \
-DSIGFOX_EP_T_CONF_MS=OFF \
-DSIGFOX_EP_UL_PAYLOAD_SIZE=OFF \
-DSIGFOX_EP_AES_HW=ON \
-DSIGFOX_EP_CRC_HW=OFF \
-DSIGFOX_EP_MESSAGE_COUNTER_ROLLOVER=OFF \
-DSIGFOX_EP_PARAMETERS_CHECK=ON \
-DSIGFOX_EP_CERTIFICATION=ON \
-DSIGFOX_EP_PUBLIC_KEY_CAPABLE=ON \
-DSIGFOX_EP_VERBOSE=ON \
-DSIGFOX_EP_ERROR_CODES=ON \
-DSIGFOX_EP_ERROR_STACK=12 ..
make sigfox_ep_lib
The sigfox_ep_flags.h
header file is generated in the build
folder, and the archive in the build/lib
folder.