Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update document links for host app #44

Open
wants to merge 13 commits into
base: vmc/update-brewfile
Choose a base branch
from
Open
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# CI Workflow for Golden Gate
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build-linux-macos:
name: GG-Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest']

steps:
# Checks-out the repository under $GITHUB_WORKSPACE, so that the job can access it
- uses: actions/checkout@v2
# Needed for Conda
- uses: goanpeca/setup-miniconda@v1
with:
activate-environment: gg
environment-file: environment.yml
auto-activate-base: false

# Runs a single command using the runners shell (so that conda can be properyl activated)
- shell: bash -l {0}
name: Run a multi-line script
run: |
echo Hello, world!
echo Line two
conda info
conda list
inv -l
2 changes: 1 addition & 1 deletion Brewfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tap "homebrew/cask"
tap "homebrew/homebrew-bundle"
tap "JuulLabs-OSS/mynewt"
tap "homebrew/cask-drivers"
tap "JuulLabs-OSS/mynewt"

brew "[email protected]"
brew "carthage"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Project Golden Gate

Golden Gate is a portable cross-platform framework that offers reliable and
secure network communication between different combinations of embedded
devices, mobile applications and desktop applications.
devices, mobile applications and desktop applications over Bluetooth Low Energy.

The framework provides developers with a familiar model, allowing them to
implement their functionality the same way they would in other networked
environments, leveraging familiar standards like CoAP, WebSockets, HTTP, MQTT,
Expand Down Expand Up @@ -53,4 +54,4 @@ own communicating applications and services.
Where To Start
--------------

Visit the online documentation (or build the doc from within the project).
[Visit the online documentation](https://fitbit.github.io/golden-gate/) (or build the doc from within the project).
2 changes: 1 addition & 1 deletion docs/src/platforms/android.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ $ inv android.build
Run The Host App
----------------

See the [Android Host App](../apps/android/host_app.md) documentation.
See the [Android Host App](https://fitbit.github.io/golden-gate/apps/android/host_app.html) documentation.
2 changes: 1 addition & 1 deletion docs/src/platforms/ios.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Run The Host App
----------------

In XCode, click Run (the "Play" icon).
See the [iOS Host App](../apps/ios/host_app.md) documentation for details.
See the [iOS Host App](https://fitbit.github.io/golden-gate/apps/ios/host_app.html) documentation for details.
5 changes: 3 additions & 2 deletions external/smo/c/lib/fb_smo.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,10 @@ Fb_Smo_ReplaceObject(Fb_Smo* old, Fb_Smo* new)

if (new != NULL) {
if (old->name != NULL) {
new->name = new->allocator->allocate_memory(new->allocator, strlen(old->name) + 1);
size_t buffer_size = strlen(old->name) + 1;
new->name = new->allocator->allocate_memory(new->allocator, buffer_size);
if (new->name != NULL) {
strcpy(new->name, old->name);
strncpy(new->name, old->name, buffer_size);
} else {
// Destroy new object
Fb_Smo_Destroy(new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ interface OutgoingRequest : OutgoingMessage, BaseRequest {
* of fixed size. In GG we use 1024 bytes. On the tracker some Coap resources accept larger data payloads
* in a single block. In this case we need to force a non-blockwise request. Here is an example of this
* type of resource:
*
* https://wiki.fitbit.com/pages/viewpage.action?pageId=109586801
*/
val forceNonBlockwise: Boolean

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ class OutgoingRequestBuilder(
/**
* Flag to treat the request as non-blockwise. In a blockwise request data is sent in chuncks(blocks)
* of fixed size. In GG we use 1024 bytes. On the tracker some Coap resources accept larger data payloads
* in a single block. In this case we need to force a non-blockwise request. Here is an example of this
* type of resource:
*
* https://wiki.fitbit.com/pages/viewpage.action?pageId=109586801
* in a single block. In this case we need to force a non-blockwise request.
*/
fun forceNonBlockwise(value: Boolean): OutgoingRequestBuilder {
forceNonBlockwise = value
Expand Down
2 changes: 1 addition & 1 deletion platform/android/goldengate/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ANDROIDX_LEGACY_SUPPORT_V4_VERSION = 1.0.0
ANDROIDX_RECYCLEVIEW_VERSION = 1.1.0
ANDROIDX_CONSTRAINTLAYOUT_VERSION = 1.1.3
ANDROID_MATERIAL_VERSION = 1.1.0
BITGATT_VERSION = bugfix~maven-publish-SNAPSHOT
BITGATT_VERSION = v0.9.1
TIMBER_VERSION = 4.7.1
RXJAVA_VERSION = 2.2.12
RXANDROID_VERSION = 2.1.1
Expand Down
4 changes: 0 additions & 4 deletions platform/mynewt/libs/gg/connmgr/include/gg_connmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
*
* @date 2017-11-13
*
* @details
* Detailed information can be found at this link:
* https://wiki.fitbit.com/display/firmware/BLE+Connection+Manager
*
*/

#ifndef __CONNECTION_MANAGER_H__
Expand Down
4 changes: 0 additions & 4 deletions platform/mynewt/libs/gg/connmgr/src/gg_connmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
*
* @date 2017-11-13
*
* @details
* Detailed information can be found at this link:
* https://wiki.fitbit.com/display/firmware/BLE+Connection+Manager
*
*/

/*----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions tasks/android/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def build(_ctx):
'''Build All Android tasks'''

@task
def test(ctx, coverage=True, sonarqube=False):
def test(ctx, coverage=True, sonarqube=''):
'''Runs tests'''
bindings_dir = os.path.join(ctx.C.PLATFORM_DIR, "android", "goldengate", "GoldenGateBindings")
coverage_dir = os.path.join(bindings_dir, '.externalNativeBuild', 'cmake', 'debug',
Expand Down Expand Up @@ -46,7 +46,7 @@ def test(ctx, coverage=True, sonarqube=False):
tasks.append(remoteapi_command)
tasks.append(link_controller_command)
if sonarqube:
tasks.append("sonarqube -Dsonar.host.url=https://sonarqube.site-ops.fitbit.com")
tasks.append(f'sonarqube -Dsonar.host.url={sonarqube}')

with ctx.cd(root_dir):
ctx.run("./gradlew " + " ".join(tasks))
Expand Down
5 changes: 3 additions & 2 deletions tasks/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

import os
import sys
import subprocess

def build(ctx, build_dir, profile, toolchain_file=None,
Expand All @@ -17,8 +18,8 @@ def build(ctx, build_dir, profile, toolchain_file=None,
cmd = [cmake_wrapper] + cmd

# check if Ninja is available, and use the Ninja generator if it is, unless a
# custom generator was requested
if not generator:
# custom generator was requested, or the host is Windows
if not generator and sys.platform != 'win32':
try:
subprocess.check_output(['ninja', '--version'])
cmd.append('-GNinja')
Expand Down
13 changes: 7 additions & 6 deletions tasks/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def detect_profile():
'''Automatically detect the profile based on the host platform'''
profile = {
'Darwin': 'macOS_cmdline',
'Linux': 'linux'
'Linux': 'linux',
'Windows': 'windows'
}.get(platform.system())
if not profile:
raise exceptions.PlatformError("Host platform not supported for native build")
Expand All @@ -26,7 +27,7 @@ def detect_profile():
@task(help={
"debug": "Build the Debug build instead of the Release build",
"coverage": "Generate a code coverage report",
"sonarqube": "Enable Sonarqube",
"sonarqube": "Enable Sonarqube scanning",
"sanitize": "Enable a sanitizer ('address', ...). You can use this option multiple times, one for each sanitizer.",
"cmakegen": "Override CMake generator (e.g. 'Xcode', run `cmake --help` for a list of supported generators)"
}, iterable=['sanitize'])
Expand Down Expand Up @@ -71,8 +72,8 @@ def clean(ctx):
'''Blow away the build directory'''
ctx.run("rm -rf {}".format(ctx.C.BUILD_DIR_NATIVE))

@task
def test(ctx, coverage=False, sonarqube=False, output_on_failure=True, verbose=False, file_name=None, skip_build=True):
@task(help={"sonarqube": "Sonarqube host URL"})
def test(ctx, coverage=False, sonarqube='', output_on_failure=True, verbose=False, file_name=None, skip_build=True):
'''Run GoldenGate XP tests
Note: please run "inv native.build" to build the unit tests first

Expand All @@ -91,7 +92,7 @@ def test(ctx, coverage=False, sonarqube=False, output_on_failure=True, verbose=F
Note: Please build the unit tests with -c option. i.e. inv native.build -c
For more information: https://gcovr.com

$ inv native.test -c -s
$ inv native.test -c -s <sonar-host-url>

Same as above, plus a Sonarqube report.
'''
Expand Down Expand Up @@ -162,4 +163,4 @@ def test(ctx, coverage=False, sonarqube=False, output_on_failure=True, verbose=F
ctx.run("gcov {}".format(c_file))

# Run the scanner
ctx.run("sonar-scanner")
ctx.run(f'sonar-scanner -Dsonar.host.url={sonarqube}')
38 changes: 21 additions & 17 deletions xp/CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
{
"configurations": [
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-L -C${projectDir}\\config\\profiles\\windows.cmake",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-L -C${projectDir}\\config\\profiles\\windows.cmake",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": []
},
{
"name": "x86-Release",
Expand All @@ -18,9 +19,10 @@
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-L",
"cmakeCommandArgs": "-L -C${projectDir}\\config\\profiles\\windows.cmake",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
"ctestCommandArgs": "",
"variables": []
},
{
"name": "x64-Debug",
Expand All @@ -29,9 +31,10 @@
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "",
"cmakeCommandArgs": "-L -C${projectDir}\\config\\profiles\\windows.cmake",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
"ctestCommandArgs": "",
"variables": []
},
{
"name": "x64-Release",
Expand All @@ -40,9 +43,10 @@
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "",
"cmakeCommandArgs": "-L -C${projectDir}\\config\\profiles\\windows.cmake",
"buildCommandArgs": "-v",
"ctestCommandArgs": ""
"ctestCommandArgs": "",
"variables": []
}
]
}
}
2 changes: 1 addition & 1 deletion xp/apps/coap-client/gg_coap_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,6 @@ main(int argc, char** argv)
// setup a listener
Client listener;
memset(&listener, 0, sizeof(Client));
listener.output_file = output_file;
GG_SET_INTERFACE(&listener, Client, GG_CoapResponseListener);
GG_SET_INTERFACE(&listener, Client, GG_CoapBlockwiseResponseListener);

Expand All @@ -810,6 +809,7 @@ main(int argc, char** argv)
return 1;
}
}
listener.output_file = output_file;

// make the request
result = SendRequest(endpoint,
Expand Down
8 changes: 4 additions & 4 deletions xp/common/ports/windows/gg_windows_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@
GG_Timestamp
GG_System_GetCurrentTimestamp(void)
{
static uint64_t timer_frequency = 0;
if (timer_frequency == 0) {
static double timer_frequency = 0.0; // timer frequency in units per nanoseconds
if (timer_frequency == 0.0) {
// initialize the frequency
LARGE_INTEGER _timer_frequency;
if (QueryPerformanceFrequency(&_timer_frequency)) {
timer_frequency = (uint64_t)_timer_frequency.QuadPart;
timer_frequency = (double)_timer_frequency.QuadPart / (double)GG_NANOSECONDS_PER_SECOND;
}
}

// get the current timer
LARGE_INTEGER now;
if (timer_frequency && QueryPerformanceCounter(&now)) {
return (GG_NANOSECONDS_PER_SECOND * (uint64_t)now.QuadPart) / timer_frequency;
return (GG_Timestamp)((double)now.QuadPart / timer_frequency);
} else {
// something went wrong
return 0;
Expand Down
1 change: 1 addition & 0 deletions xp/config/profiles/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set(GG_CONFIG_LWIP_PORT "windows" CACHE STRING "")
set(GG_CONFIG_DEFAULT_SOCKETS_MODULE "Lwip" CACHE STRING "")
set(GG_CONFIG_ENABLE_ANNOTATIONS FALSE CACHE BOOL "")
set(GG_CONFIG_ENABLE_THREAD_GUARDS TRUE CACHE BOOL "")
set(GG_CONFIG_ENABLE_TCP TRUE CACHE BOOL "")

# Apps selection
set(GG_APPS_ENABLE_GATTLINK_SELFTEST_APP FALSE CACHE BOOL "")
Expand Down
1 change: 1 addition & 0 deletions xp/loop/ports/bsd/gg_bsd_select_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ typedef ssize_t GG_ssize_t;
#if defined(GG_CONFIG_ENABLE_BSD_SOCKETPAIR_EMULATION)
#if GG_CONFIG_PLATFORM == GG_PLATFORM_BISON
#define INADDR_LOOPBACK 0x7f000001
#elif GG_CONFIG_PLATFORM == GG_PLATFORM_WINDOWS
#else
#include <netinet/in.h>
#include <arpa/inet.h>
Expand Down
4 changes: 4 additions & 0 deletions xp/lwip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ if (GG_PORTS_ENABLE_LWIP)
add_library(gg-lwip ${LWIP_SRC_FILES}
${LWIP_PORT_FILE})

if (GG_CONFIG_ENABLE_TCP)
target_compile_definitions(gg-lwip PRIVATE GG_CONFIG_ENABLE_TCP)
endif()

if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "GNU")
target_compile_options(gg-lwip PRIVATE -Wno-conversion -Wno-format-nonliteral -Wno-newline-eof -Wno-missing-variable-declarations -Wno-unused-macros -Wno-packed -Wno-covered-switch-default -Wno-gnu-empty-initializer -Wno-zero-length-array -Wno-unused-variable -Wno-type-limits -Wno-unused-parameter)
endif()
Expand Down
6 changes: 5 additions & 1 deletion xp/lwip/lwipopts.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
#define MEMP_NUM_TCP_PCB_LISTEN 0

/**
* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.
* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments.TCP
* (requires the LWIP_TCP option)
*/
#define MEMP_NUM_TCP_SEG 0
Expand Down Expand Up @@ -371,7 +371,11 @@
/**
* LWIP_TCP==1: Turn on TCP.
*/
#if defined(GG_CONFIG_ENABLE_TCP)
#define LWIP_TCP 1
#else
#define LWIP_TCP 0
#endif

/*
----------------------------------
Expand Down
2 changes: 1 addition & 1 deletion xp/module/ports/windows/gg_winsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

//----------------------------------------------------------------------
static void
GG_WINSOCK_Cleanup(void)
GG_WINSOCK_Cleanup(void* _ignored)
{
WSACleanup();
}
Expand Down
Loading