avs-device-sdk/srcs
wk 3d9918072f [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
..
ACL [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
ADSL [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
AFML [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
AVSCommon [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
AVSGatewayManager [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
ApplicationUtilities [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
BluetoothImplementations [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
CapabilitiesDelegate [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
CapabilityAgents [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
Captions [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
CertifiedSender [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
ContextManager [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
Diagnostics [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
Endpoints [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
Integration [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
InterruptModel [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
MediaPlayer [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
Metrics [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
PlaylistParser [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
SampleApp [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
Settings [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
SpeechEncoder [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
Storage [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
SynchronizeStateSender [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
ThirdParty [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
applications [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
capabilities [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
cmakeBuild [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
core [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
doc [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
extension [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
shared [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
tools [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
CHANGELOG.md [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
CMakeLists.txt [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
CONTRIBUTING.md [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
LICENSE.txt [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
NOTICE.txt [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
README.md [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
SECURITY.md [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
issue_template.md [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00
pkg-config.pc.cmake [Base on 1.2.6.0] add LWA && UI && others features for customer 2022-10-14 23:10:28 +08:00

README.md

CMake configure command(with wake word sdk):

cmake $HOME/avs-dev/avs-device-sdk -DCMAKE_INSTALL_PREFIX=/data/avs \
 -DGSTREAMER_MEDIA_PLAYER=ON \
 -DASPMIC=ON \
 -DCMAKE_BUILD_TYPE=DEBUG \
 -DPKCS11=OFF \
 -DASPMIC_INCLUDE_DIR=../avs-device-sdk/extension/mic-asp-sdk/include \
 -DCURL_INCLUDE_DIR=/usr/local/oecore-x86_64/sysroots/aarch64-poky-linux/usr/include/curl \
 -DCURL_LIBRARY=/usr/local/oecore-x86_64/sysroots/aarch64-poky-linux/usr/lib64/libcurl.so \
 -DLibArchive_INCLUDE_DIR=/usr/local/oecore-x86_64/sysroots/aarch64-poky-linux/usr/include \
 -DLibArchive_LIBRARY=/usr/local/oecore-x86_64/sysroots/aarch64-poky-linux/usr/lib64/libarchive.so \
 -DAMAZONLITE_KEY_WORD_DETECTOR=ON \
 -DAMAZONLITE_KEY_WORD_DETECTOR_LIB_PATH=$HOME/avs-dev/avs-device-sdk/extension/avs-weakup-sdk/aarch64-tuya-mt8516/PRL2000/libpryon_lite-PRL2000.a \
 -DAMAZONLITE_KEY_WORD_DETECTOR_INCLUDE_DIR=$HOME/avs-dev/avs-device-sdk/extension/avs-weakup-sdk/aarch64-tuya-mt8516 \
 -DEXTENSION_PATH=$HOME/avs-dev/avs-device-sdk/extension/avs-cpp-sdk/KWD

CMake configure for Clion(with wake word sdk):

  • aarch64-poky-linux Platform
-DCMAKE_INSTALL_PREFIX=/data/avs
-DBUILD_TESTING=OFF
-DGSTREAMER_MEDIA_PLAYER=ON
-DASPMIC=ON
-DCMAKE_BUILD_TYPE=DEBUG
-DPKCS11=ON
-DBUILD_TESTING=OFF
-DAUTH_MANAGER=ON
-DASSET_MANAGER=ON
-DCOMPANION_APP_AUTH=ON
-DASPMIC_INCLUDE_DIR=../srcs/extension/mic-asp-sdk/include
-DCURL_INCLUDE_DIR=/usr/local/oecore-x86_64/sysroots/aarch64-poky-linux/usr/include/curl
-DCURL_LIBRARY=/usr/local/oecore-x86_64/sysroots/aarch64-poky-linux/usr/lib64/libcurl.so
-DLibArchive_INCLUDE_DIR=/usr/local/oecore-x86_64/sysroots/aarch64-poky-linux/usr/include
-DLibArchive_LIBRARY=/usr/local/oecore-x86_64/sysroots/aarch64-poky-linux/usr/lib64/libarchive.so
-DAMAZONLITE_KEY_WORD_DETECTOR=ON
-DAMAZONLITE_KEY_WORD_DETECTOR_LIB_PATH=../srcs/extension/avs-weakup-sdk/aarch64-tuya-mt8516/PRL2000/libpryon_lite-PRL2000.a
-DAMAZONLITE_KEY_WORD_DETECTOR_INCLUDE_DIR=../srcs/extension/avs-weakup-sdk/aarch64-tuya-mt8516
-DEXTENSION_PATH=../srcs/extension/avs-cpp-sdk/KWD
  • x86_64 Platform
-DCMAKE_INSTALL_PREFIX=/data/avs_x86
-DGSTREAMER_MEDIA_PLAYER=ON
-DCOMPANION_APP_AUTH=ON
-DBUILD_TESTING=OFF
-DPORTAUDIO=ON
-DPKCS11=ON
-DCMAKE_BUILD_TYPE=DEBUG
-DPORTAUDIO_LIB_PATH=/usr/local/lib/libportaudio.so
-DPORTAUDIO_INCLUDE_DIR=/home/hx/development/avs-device-sdk-x86/my_project/third-party/portaudio/include
-DCURL_INCLUDE_DIR=/home/hx/development/avs-device-sdk-x86/my_project/third-party//curl-7.83.1/include/curl
-DCURL_LIBRARY=/usr/local/lib/libcurl.so

Step support AVS SoftHSM PCKS11 manager token security?

  1. Setup softhsm2 work directory.
    mkdir -p /data/.softhsm2/tokens
    chmod -R 700 /data/.softhsm2
    echo "directories.tokendir = /data/.softhsm2/tokens" > /data/.softhsm2/softhsm2.conf
    
  2. Set environment variable to configure token environment, change the ACSDK_PKCS11_TOKEN, ACSDK_PKCS11_MAIN_KEY, ACSDK_PKCS11_SO_PIN, ACSDK_PKCS11_PIN value by yourself.
    export SOFTHSM_PATH=/usr/lib64/softhsm/libsofthsm2.so
    export SOFTHSM2_CONF="/data/.softhsm2/softhsm2.conf"
    export ACSDK_PKCS11_TOKEN=ACSDKTOKEN
    export ACSDK_PKCS11_MAIN_KEY=ACSDK1260
    export ACSDK_PKCS11_SO_PIN=avs126
    export ACSDK_PKCS11_PIN=12345678
    
  3. Initialize the SoftHSM token using softhsm2-util CLI command as follows
    softhsm2-util --init-token --slot 0 --label $ACSDK_PKCS11_TOKEN --so-pin $ACSDK_PKCS11_SO_PIN --pin $ACSDK_PKCS11_PIN
    
  4. Verify the SoftHSM and list the initialized token slot using OpenSC pkcs11-tool
    pkcs11-tool --module $SOFTHSM_PATH --list-slots
    
  5. To generate the AES-256 key
    pkcs11-tool --module $SOFTHSM_PATH --login \
    --pin $ACSDK_PKCS11_PIN \
    --token-label $ACSDK_PKCS11_TOKEN --keygen \
    --key-type aes:32 --private --sensitive \
    --label $ACSDK_PKCS11_MAIN_KEY
    
  6. To verify the generated master key object residing in the SoftHSM keystore (PKCS#11 slot)
    pkcs11-tool --module $SOFTHSM_PATH \
    --login --pin $ACSDK_PKCS11_PIN \
    --token-label $ACSDK_PKCS11_TOKEN -LO
    
  7. Set CMake compiler options "-DPKCS11=ON", reconfigure project and build it.
  8. Modify AlexaClientSDKConfig.json file, add pcks11 item:
    "pkcs11Module":{
         "libraryPath":"/usr/lib64/softhsm/libsofthsm2.so",
         "tokenName":"ACSDKTOKEN",
         "userPin":"12345678",
         "defaultKeyName":"ACSDK1260"
     },
    

How to use message middleware for avs SampleApp and config_app

x86_64 platform

   sudo apt install libzmq3-dev

aarch64 mt8516 device

  1. Download newest image and burn it to device.
  2. Download newest cross compile tools and install it.
  3. Select one of SampleApp and config_app for server, then the other is client.
  4. Reference demo how to use.
  5. Sample Code
    • Client Sample
    int nSend = 0, nRecv = 0;
    int ret;
    ret = msg_client_init();
    
    if(ret != ERR_MSG_OK) {
        printf("msg_client_init error: %d\n", ret);
        return -1;
    }
    while (1) {
        unsigned char* pMsg = NULL;
        char buf[1024];
    
        memset(buf, 0, 1024);
        sprintf(buf, "client: send message time %d", nSend++);
        client_send_msg((const unsigned char*)buf, (int)strlen(buf));
    
        client_recv_msg(&pMsg, &nRecv);
    
        if (nRecv > 0) {
            memcpy(buf, pMsg, nRecv);
            buf[nRecv] = 0;
            printf("client: Receive [%s]\n", buf);
        }
    
        if (pMsg) {
            free(pMsg);
        }
    
        sleep(1);
    }
    
    • Server Sample
    int nSend = 0, nRecv = 0;
    int ret;
    ret = msg_server_init();
    if(ret != ERR_MSG_OK) {
        printf("msg_server_init error: %d", ret);
        return -1;
    }
    while (1) {
        unsigned char* pMsg = NULL;
        char buf[1024];
    
        memset(buf, 0, 1024);
        sprintf(buf, "server: send message time %d", nSend++);
        server_send_msg((const unsigned char*)buf, (int)strlen(buf));
    
        server_recv_msg(&pMsg, &nRecv);
    
        if (nRecv > 0) {
            memcpy(buf, pMsg, nRecv);
            buf[nRecv] = 0;
            printf("server: Receive [%s]\n", buf);
        }
    
        if (pMsg) {
            free(pMsg);
        }
    
        sleep(1);
    }
    

What is the Alexa Voice Service (AVS)?

The Alexa Voice Service (AVS) enables developers to integrate Alexa directly into their products, bringing the convenience of voice control to any connected device. AVS provides developers with access to a suite of resources to build Alexa-enabled products, including APIs, hardware development kits, software development kits, and documentation.

Learn more »

What is the AVS Device SDK

The Alexa Voice Service (AVS) Device SDK provides you with a set of C ++ libraries to build an Alexa Built-in product, meaning your device has direct access to cloud-based Alexa capabilities to receive voice responses instantly. Your device can be almost anything a smartwatch, a speaker, headphones the choice is yours.

Learn more »

Release Notes and Known Issues

Feature enhancements, updates, and resolved issues from all releases are available on the Amazon developer portal.

Get Started

You can set up the SDK on the following platforms:

SDK Architecture

The SDK is modular and abstract. It provides separate components to handle necessary Alexa functionality including processing audio, maintaining persistent connections, and managing Alexa interactions. Each component exposes Alexa APIs to customize your device integrations as needed. The SDK also includes a Sample App, so you can test interactions before integration.

Learn more »

API References

View the C++ API References for detailed information about implementation.

Security Best Practices and Important Considerations

All Alexa products should adopt the Security Best Practices for Alexa.

When building Alexa with the SDK, you should also adhere to the following security principles.