programmersguide

ATSC30's Programmer’s Guide

Introduction:

This document outlines the various modules within ATSC 3.0 and how they should be utilized when developing a user interface. Any references to the “application” in this document pertain to the software that integrates the user interface, whether statically linked to the ATSC libraries or executed as a separate process. Detailed descriptions of the functions mentioned here can be found in the ATSC 3.0 API documentation.

Data Types:

The file for defining the data types as per the standard is atsc_basetype.h available in the path : /DtvKit_ATSC30Stack_M3/src/atsc/common/inc/atsc_basetype.h

typedef unsigned char uint8_t; unsigned byte integer value
typedef short int int16_t; Signed 2-Bytes Integer value
typedef unsigned short uint16_t; Unsigned 2-Bytes Integer value
typedef int int32_t; Signed 4-Bytes Integer Value
typedef unsigned int uint32_t; Unsigned 4-Bytes Integer Value
typedef long int int64_t; Signed 8-Bytes Integer Value
typedef unsigned long int uint64_t; Unsigned 8-Bytes Integer Value
typedef long long UINT_64; Signed 8-Bytes Integer Value
typedef float FLOAT_32; Decimal digits with 4Bytes //6-7 decimal digits
typedef double FLOAT_64; Decimal digits with 8Bytes //15-16 decimal digits

Initialisation:

There is the single interface for initialize the task to trigger the web application and also interface to tune the channel with default parameters,

  • CAtscMw::Start() [/DtvKit_ATSC30Stack_M3/src/atsc/mw/src/service/atsc_mw.cpp]
    This function created the thread for handling the incoming and managing the servcer socket connection by initializing the web application. So that communication from the web application to ATSCCore is in synchronization for request from user level and get the information for web application from ATSC core level.
  • CAtscMw::TuneToChannel() [/DtvKit_ATSC30Stack_M3/src/atsc/mw/src/service/atsc_mw.cpp]
    This function called the changeproperties() for set the properties with the user provided inputs for tuning the channel.
  • CMwService::CMwService() [/DtvKit_ATSC30Stack_M3/src/atsc/mw/src/service/atsc_mw_service.cpp]
    This function called the CMwService::OpenFrontend() for created the tuner control based on instance count and register the below callbacks related to tuner functionalities. And open,start the frontend functionalities by calling the platform level interfaces.
    • Frontend_CbDataEvent()
    • Frontend_CbStatusEvent()
    • Frontend_CbNotifyEvent()
    • And created the class-CAvCtrl() for Audio and Video handling and data management based on the media type.

  • CMwService::StartService() [/DtvKit_ATSC30Stack_M3/src/atsc/mw/src/service/atsc_mw_service.cpp]
    Api to created the AlpDataHandlerThread() for parse and get/process the ALP data. And parse the received data for route and mmt information.
  • CAvCtrl::CAvCtrl() [/DtvKit_ATSC30Stack_M3/src/atsc/mw/src/av/atsc_mw_av_control.cpp]
    Api to register the AV related callback and create the thread for controlling the audio video data. And passes the data based on media type to platform hal layer.

Configurations:

AtscCore having some default configurations and its changed based on user config based on their requirements. These configurations available in the file /DtvKit_ATSC30Stack_M3/src/atsc/common/inc/atsccore_prod_config.h

So based on user requirement, below values and mapping will get varies.

#define API_VERSION "2.0"
#define ATSCCORE_FRONTEND_MAX 2
#define ATSCCORE_SUPPORTED_STANDARDS ( ATSC30 )
#define ATSCCORE_ATSC1_DEMOD_TYPE ( 8VSB )
#define ATSCCORE_DEFAULT_DEMOD ( eDemodATSC30 )
#define ATSCCORE_DEFAULT_REGION 0 // United State
#define ATSCCORE_DEFAULT_CHANNEL 56
#define ATSCCORE_US_MIN_CHANNEL 2
#define ATSCCORE_US_MAX_CHANNEL 71
#define ATSCCORE_KOREA_MIN_CHANNEL 2
#define ATSCCORE_KOREA_MAX_CHANNEL 56
#define ATSCCORE_INDIA_MIN_CHANNEL 21
#define ATSCCORE_INDIA_MAX_CHANNEL 68
#define ATSCCORE_HTTP_URL_SUPPORTED 64
#define ATSCCORE_HTTP_URL_STRING_LENGTH 256
#define WEB_URL_PORT_NUMBER 81
#define GUIDE_PATH "/guide"
#define GUIDE_FILE_NAME_WITH_PATH "/guide/guide.json"
#define ROOT_PATH "/"
#define ENV_PATH "/env.conf"
#define ENV_JSON_PATH "/env.json"
#define ESG_PATH "/esg"
#define FILES_STORAGE_PATH "/files/storage/"
#define STORAGE_FILES "/files"
#define MSG_FILE_PATH "/guide/slt.json"
#define HLS_FILE_PATH "/hls"
#define M3U8_FILE "/hls/%d-%d/index.m3u8"
#define M3U8_FILE_PATH "/hls/%d-%d/"
#define REMOVE_DUMP_FILE "rm -rf /dump/*.*"
#define DUMP_FILE_PATH "/dump/%s"
#define ATSCCORE_DB_PATH "/db"
#define ATSCCORE_DB_FILE "/db/homegateway.db"
#define ATSCCORE_DUMP_FILE "/dump/dump_history.json"
#define ATSCCORE_MOUNT_PATH "/proc/mounts"
#define ATSCCORE_FRONTEND_DEV_PATH "/dev/dvb/adapter%d/frontend0"
#define ATSCCORE_DEMUX_DEV_PATH "/dev/dvb/adapter%d/demux0"
#define ATSCCORE_START_CHANNEL 2
#define ATSCCORE_END_CHANNEL 70
#define ATSCCORE_HTTP_URL_STRING_LENGTH 256
#define BUILD_DATE "08-07-2024"

Scanning For Services:

In ATSC Optmgateway application, scanning is processing with two method,

Auto Scanning

  • Overview: Auto scanning automatically scans and collects services across a predefined channel range.
  • Default Range: The default Start and End channels are set from channel 2 to channel 70, covering the full spectrum of available channels.
  • Functionality: Based on the specified channel range, the frequency will vary as the system scans. Channels within this range are identified and locked if available, ensuring comprehensive coverage of all possible services.

Manual Scanning

  • Overview: Manual scanning allows users to define a specific range for targeted scanning, giving control over the Start and End channel values.
  • Configurable Range: Users can set a custom range from channel 2 to channel 70.
  • Functionality: This scanning mode limits the search to the user-defined channel values, helping to focus the scan on a narrower range if needed. Only channels within this specified range will be detected and locked, optimizing the process based on user needs.

Interface for Scanning:

CAtscMw::RequestScan() => CMwService::Frontend_ScanChannels() by using below parameters for scanning the channel,

  • Demod
  • TunerId
  • PlpId
  • RegionId
  • At3StartChannel = 2
  • At3EndChannel = 70;

For scanning, its created the thread for continuous scanning process CMwService::ThreadScan() -> TuneToChannel(), based on the user selected parameters for scan the channels, basically a SetProperties() to Hal layer.

Tuning, Monitoring and Service Search:

For tune to service, the user need to provide the demod type as ATSC1.0 or ATSC 3.0, frequency, plpId,Region Id, Channel number. Then its collected the data for the particular service if its get locked or tuned.

Then monitoring the data for the ALP parsing based on ROUTE & MMT protocol parse via ALP Processing thread.

Interface for Tune channel [DtvKit_ATSC30Stack_M3/src/atsc/mw/src/service/atsc_mw.cpp]
CAtscMw::TuneToChannel()

Thread for Scan and ALP processing:
CAtscMw::ScanChannels()
CMwService::AlpDataHandlerThread() -> CMwService::ProcessAlpData()

Completing a Service Search:

For stop the scanning process, stop the running thread by setting the mScanning flag as false.

Interface for stop the frontend and scanning process:
CMwService::Frontend_Stop()

Electronic Service Guide/ESG Search:
After collecting every service information from the Service List Table, it created the file/guide as ESG by list out all the service list and event information in the user configured path.

ESG configure path:
#define ESG_PATH "/esg"

Callback and Events:

ATSC30 Core having callbacks and events for update the information of Tuner,AV data.

1. RegisterOnsnMsgEventNotify() - Event for On Screen Message for User.
2. RegisterFrontendParamCbEvents()
3. RegisterFrontendStatusCbEvents()
Information about frontend such as Tuner Id, Demod Type, Frequency, Channel Number, Region Id,Plp Id, Bitrate,RSSI,SNR,Lock status which is received from Hal layer.


Page Tools