nextCP/2
nextCP/2 is a Java and Typescript web-based UPnP control point.
Screenshots and basic usage is shown in GitHub Pages.
installation
- Download prebuild binaries from the release page (JAR files) and put them in a directory with write permissions.
- start the application (with optional more memory by adding "-Xms256m -Xmx512m")
java [-Xms256m -Xmx512m] -jar [-DconfigFile=path_to_config_file] nextcp2.jar
If no config file is given or found, a config-file will be generated next to the JAR file on the first startup. In this case the application might complain about incorrect or missing (default) configuration. In this case adopt the config to your system by navigating to `App setting' and restart the application.
system requirements
- minimum JDK 17
- maven 3.8
- yarn
- GIT client
browser requirements
- Web browser needs support for server-sent-events
Install maven dependencies
Call ./build_dependencies.sh
script for installing dependent libraries from source into local maven repository.
For manual installation clone the following repositories :
git clone https://bitbucket.org/ijabz/jaudiotagger.git
git clone https://github.com/sf666/musicbrainz.git
automated build
- call
build.sh
Build artifacts are located in the build
directory.
manual building
! The frontend has to be packaged before the backend is build.
build frontend
cd frontend/nextcp-ui
./ng build
UI will be build into the backend folder : backend/nextcp2-runtime/src/main/resources/static
! Since this directory contains generated content, do not add it to the repository.
build backend
cd backend/
mvn clean
mvn install
mvn package
build artifact
Build artifacts are located in the maven target
directories.
- The runnable application jar is build in the module
backend/nextcp2-assembly/target
- Device Driver are build in the modules below
backend/nextcp2-device-driver
main application
After a successful build, the main application build artifact will be located here backend/nextcp2-assembly/target
McIntosh device driver
This device driver controls (bi-directional) a McIntosh device connected to a RS232/TCP-IP transceiver like this on: USR-TCP232-302.
Current implemented features:
- power control
- volume control
- input source control
After a successful build, the device driver (tested with McIntosh MA9000 amplifier) is located here: backend/nextcp2-device-driver/nextcp2-ma9000/target/
.
running the application
To run the snapshot call :
java -Xms256m -Xmx512m -jar [-DconfigFile=path_to_config_file] nextcp2.jar
By default the application will start on the current interface on port 8085
.
Open your browser and connect to the application:
http://localhost:8085
If nextcp runs on a server or remote machine, replace localhost
by the IP address of your device.
config file
The application tries to load the config file from the following locations in this order:
- file provided by system-property 'configFile'
- file located '/etc/nextcp2/nextcp2Config.json'
- file located 'USER_HOME/nextcp2Config.json'
- file located 'WORK_DIR/nextcp2Config.json'
If no config file is found, a config file will be generated at this location : WORK_DIR/nextcp2Config.json
.
developer notice
debugging
For debugging within an IDE start the backend first. The main Spring-Boot startup class is
backend/nextcp2-assembly/src/main/java/nextcp/NextcpApplicationStartup
For having a frontend build, yarn
has to be installed in the build environment.
To start the front-end in Visual Studio Code switch to TERMINAL, change into the directory nextcp2/frontend/nextcp-ui
and start the front-end by typing
yarn start -c dev
Launch your favorite chromium browser from the Visual Studio Code debug perspective.
code generation
Generatied classes are located in the package codegen
within the maven module nextcp2-codegen
.
DTO
DTOs for Java and Typescript are generated to keep data exchange between the rest and SSE interface (Java) consistent with the consuming Typescript code.
Java DTOs
The class DtoModelGen
generates Java-DTO classes configured by the file dto.yaml
located in the resource folder src/main/resources/yaml
.
This file has many elements of
[CLASS_NAME]:
[PROPERTY]: [TYPE]
Call DtoModelGen
each time you modify the yaml file. Generate the file into the maven project nextcp2-modelgen
in the package nextcp.dto
by pointing to this absolute path as first parameter.
! ATTENTION: Never modify the generated DTOs files since changes to them will be overwritten by the next call to the generator.
Typescript DTOs
After generating Java DTOs, Typescript DTO's are automatically generated by the maven build process.
To manually start the Typescript DTO generation, enter the maven project nextcp2-modelgen
and call mvn process-classes
.
Typescript DTO's will be generated in the file nextcp-ui/src/app/service/dto.d.ts
.
! ATTENTION: Never modify the generated DTO file since changes will be overwritten by the next maven build.
UPnP services
If activated in the configuration file, java code (service classes, input and output classes, event consumer) will be generated for all discovered UPnP services. The generated code uses jupnp as UPnP stack.