This repository is a sample Star CloudPRNT server.
- Implement CloudPRNT server and publish/subscribe MQTT messages using PHP.
- Use AWS IoT as an MQTT message broker.
Please refer here for Star CloudPRNT documentation.
Please refer here for an overview of CloudPRNT protocol (Version MQTT, Version HTTP).
This sample has been tested on Ubuntu 22.04 LTS.
-
The following commands must be available
- make
- docker compose
-
Working directory
- Directory with this
README.md
.
- Directory with this
-
AWS
- When using CloudPRNT Version MQTT with this sample, an AWS IoT environment is required. Refer to awsiot/README for information on preparing for AWS IoT.
When using CloudPRNT Version MQTT, please edit the following three .env files according to your environment.
Note
If you are using CloudPRNT Version HTTP, you do not need to do anything at this step.
- If the above file does not exist, please copy and place docker/php/.env.sample.
- about
AWS_IOT_MQTT_HOST
- Please set the endpoint you checked in
awsiot/README.md
,Check your AWS IoT endpoints
.
- Please set the endpoint you checked in
AWS_IOT_MQTT_PORT
is fixed at443
.
- If the above file does not exist, please copy and place docker/php/httpServer/.env.sample .
- About
AWS_IOT_MQTT_CLIENT_ID
AWS_IOT_MQTT_USERNAME
AWS_IOT_MQTT_PASSWORD
- Please set the above values so that they can pass the validation in the Lambda function for AWS IoT custom authentication.
- For example, if you use
Lambda function implementation example
, please configure as follows.AWS_IOT_MQTT_CLIENT_ID
:cloudPrntServer_01
AWS_IOT_MQTT_USERNAME
:cloudPrntServer_01
AWS_IOT_MQTT_PASSWORD
:test
- For example, if you use
- Please set the above values so that they can pass the validation in the Lambda function for AWS IoT custom authentication.
- If the above file does not exist, please copy and place docker/php/mqttSubscriber/.env.sample .
- About
AWS_IOT_MQTT_CLIENT_ID
AWS_IOT_MQTT_USERNAME
AWS_IOT_MQTT_PASSWORD
- Please set the above values so that they can pass the validation in the Lambda function for AWS IoT custom authentication.
- For example, if you use
Lambda function implementation example
, please configure as follows.AWS_IOT_MQTT_SUB_CLIENT_ID
:cloudPrntServer_02
(Client id for MQTT must be unique per connection)AWS_IOT_MQTT_SUB_USERNAME
:cloudPrntServer_02
AWS_IOT_MQTT_SUB_PASSWORD
:test
AWS_IOT_MQTT_PUB_CLIENT_ID
:cloudPrntServer_03
(Client id for MQTT must be unique per connection)AWS_IOT_MQTT_PUB_USERNAME
:cloudPrntServer_03
AWS_IOT_MQTT_PUB_PASSWORD
:test
- For example, if you use
- Please set the above values so that they can pass the validation in the Lambda function for AWS IoT custom authentication.
Edit the json file below according to the CloudPRNT communication protocol you want to use.
This json file is used as a server response to Server setting information request (GET).
src/php_queue/cloudprnt-setting_Sample/cloudprnt-setting_http.json
is used.
src/php_queue/cloudprnt-setting_Sample/cloudprnt-setting_mqtt_triggerpost.json
is used.- about
settingForMQTT.mqttConnectionSetting.hostName
- Please set the endpoint you checked in
awsiot/README.md
,Check your AWS IoT endpoints
.
- Please set the endpoint you checked in
- about
settingForMQTT.mqttConnectionSetting.authenticationSetting
- Please set the following values so that they can pass the validation in the Lambda function for AWS IoT custom authentication.
- For example, if you use
Lambda function implementation example
, please configure as follows.settingForMQTT.mqttConnectionSetting.authenticationSetting.clientId
:{MAC}
settingForMQTT.mqttConnectionSetting.authenticationSetting.username
:{MAC}
settingForMQTT.mqttConnectionSetting.authenticationSetting.password
:test
- For example, if you use
- Please set the following values so that they can pass the validation in the Lambda function for AWS IoT custom authentication.
- about
src/php_queue/cloudprnt-setting_Sample/cloudprnt-setting_mqtt.json
is used.- about
settingForMQTT.mqttConnectionSetting.hostName
- Please set the endpoint you checked in
awsiot/README.md
,Check your AWS IoT endpoints
.
- Please set the endpoint you checked in
- about
settingForMQTT.mqttConnectionSetting.authenticationSetting
- Please set the following values so that they can pass the validation in the Lambda function for AWS IoT custom authentication.
- For example, if you use
Lambda function implementation example
, please configure as follows.settingForMQTT.mqttConnectionSetting.authenticationSetting.clientId
:{MAC}
settingForMQTT.mqttConnectionSetting.authenticationSetting.username
:{MAC}
settingForMQTT.mqttConnectionSetting.authenticationSetting.password
:test
- For example, if you use
- Please set the following values so that they can pass the validation in the Lambda function for AWS IoT custom authentication.
- about
The database must be located at the path src/php_queue/simplequeue.sqlite
.
If it does not exist or you want to initialize it, copy and place simplequeue.sqlite.sample
.
make up-http
make up-mqtt-tp
make up-mqtt
- Container log standard output
make logs
- Stop the container
make down
Once the server has started, you can access the management page by entering the following URL in your browser.
http://<cloud-prnt-server-ip-address>
:3802/php_queue/management.html
Please refer here for details.
Copyright 2023 Star Micronics Co., Ltd. All rights reserved.