[LINUX] I tried to put HULFT IoT (Agent) in the gateway Rooster of Sun Electronics

Hello, Yorozu consultation responsible Sugimon: yum: It is.

Last time, I created a package of HULFT IoT Edge Streaming on Sun Electronics Rooster (NSX7000), which is a Linux gateway device. (The above) This time, as the second step, I also summarized the package creation of HULFT IoT Agent on the blog.

There may be clues to solve your problems, so please take a look.

HULFT IoT Agent package creation procedure for NSX7000

Introduction

Sun Electronics Rooster (NSX7000) is a device of Sun Electronics Co., Ltd.'s router Rooster series for IoT / M2M. NSX7000 is positioned as a Linux gateway that supports LTE communication for multiple carriers.

--NSX7000 device information

Please refer to the link below for details on the equipment. NSX7000 device information

To install HULFT IoT Agent, you need to prepare the packaging environment in advance. I actually tried to create a package. image.png

Advance preparation

Please prepare the following.

--Download the zip file containing the product itself from the specified site (https://www.hulft.com/download?&_ga=2.188013544.1972116588.1573457228-475003281.1503981102#anc_24) and unzip it. --xxx is the product version --For terms and operations related to HULFT IoT, see "readme.html" included in the zip file or [Online Manual](https://www.hulft.com/help/ja-jp/IoT/index.htm?_ga= 2.188153064.1972116588.1573457228-475003281.1503981102)

```
hulftiot_vxxx/
+-- Agent/
|    |
|    +--HULFT IoT Agent installation module
|
+-- Agent UpdateModule/
|    |
|    +--HULFT IoT Agent Update Module
|
+-- License/
|    |
|    +--License file
|
+-- Manager/
|    |
|    +--HULFT IoT Manager installation module
|
+-- Manual/
|    |
|    +--HULFT IoT Manual
|
+-- readme.html
```

--NSX7000 package creation environment (* Development environment will be prepared separately) NSX7000 Manual Refer to the following manual for the procedure for building the package creation environment. --Add-on Application Development-Package Creation Manual.pdf --Add-on Application Development-Environment Construction Manual.pdf

Building Manager environment

HULFT IoT Manual Build the Manager environment according to the HULFT IoT manual.

Preparation of modules to package

Note: Perform the following steps as the root user

  1. Copy the following files to any directory in the NSX7000 package creation environment.
  1. Extract the copied file
tar zxf HULFT_IoT_Agent_Linux_AArch32_Vxxx.tar.gz
  1. When you execute the command, the following files will be expanded.
iot_agent/
+-- modules/
|    +-- huliotcore
|    +-- huliotinfo
|    +-- huliotsend
|    +-- huliotservice
|
+-- defaultsettings.ini
|
+-- huliotsetup
|
+-- huliotsetup.ini

Edit configuration file

Edit the HULFT IoT Agent configuration file.

  1. Creation of agent.conf

Copy the following text and save it in a directory of your choice with the file name agent.conf

devicename = 
server_hostname = 
proxy = 
proxy_user = 
protocol = 0
cert_verification = 0
activation_key = 
first_conn_retry_interval = 3600
remarks_file = 
  1. Set the following items in the created agent.conf

Creating a package

Create a HULFT IoT Agent package in the NSX7000 package creation environment. For the parameters of various files, refer to the following Manual.

--Add-on Application Development-Package Creation Manual.pdf

  1. Create a specified directory
Top directory/
|
+-- object/
+-- rpk/
|    |
|    +-- CONTROL/
|    |      |
|    |      +--control file
|    |      +--postrm script
|    |
|    +--appctl script
|
+-- Makefile

  1. Copy the following files to the object directory
  1. Create a control file

I created it as follows.

Package: hulftiot-agent
Version: 2.0.0
Depends: 
Runtime-Depends: 
Maintainer: Company
Architecture: nsx7000
Provides: 
Replaces: 
Description: 
  1. Create a postrm script
#!/bin/sh

PATH=/usr/sbin:/sbin:$PATH
export PATH
: ${ROOSTER_OS_LOG_STDERR:=yes}
: ${ROOSTER_OS_LOG_FACILITY:=user}

. /lib/functions.sh
include /lib/functions/rooster-os/base
include /lib/functions/rooster-os/rpkg

PACKAGE_NAME=hulftiot-agent

on_remove() {
  rm -rf /app/var/${PACKAGE_NAME}
  return 0
}

case "$1" in
  *)
    if [ $PKG_ROOT = "/" ]; then
      on_remove
    fi
    ;;
esac

exit 0
  1. Create an appctl script

I created it as follows.

#!/bin/bash

PACKAGE_NAME=hulftiot-agent
PACKAGE_DIR=/app/package

EXEC_DIR=/app/var/${PACKAGE_NAME}
WORK_DIR=${EXEC_DIR}/work
LOG_DIR=${EXEC_DIR}/log

HASH_CMD=sha1sum
HASH_FILE=huliot.sha1
IOT_FILE=("huliotcore"  "huliotinfo"  "huliotsend"  "huliotservice")


make_hash() {
    if [ -e ${EXEC_DIR}/${HASH_FILE} ]; then
        rm -f ${EXEC_DIR}/${HASH_FILE}
    fi

    for ((i = 0; i < ${#IOT_FILE[@]}; i++)) {
        ${HASH_CMD} ${PACKAGE_DIR}/${PACKAGE_NAME}/bin/${IOT_FILE[i]} >> ${EXEC_DIR}/${HASH_FILE}
    }
}

start_app() {
    if [ ! -d ${EXEC_DIR} ]; then
        mkdir -p ${EXEC_DIR}
        mkdir -p ${WORK_DIR}
        mkdir -p ${LOG_DIR}
        cp -p ${PACKAGE_DIR}/${PACKAGE_NAME}/bin/* ${EXEC_DIR}
        echo "workfile_path = ${WORK_DIR}" >> ${EXEC_DIR}/agent.conf
        echo "logfile_path = ${LOG_DIR}"  >> ${EXEC_DIR}/agent.conf
        make_hash
    else
        ${HASH_CMD} -c ${EXEC_DIR}/${HASH_FILE} > /dev/null 2>&1
        if [ $? -ne 0 ]; then
            cp -pf ${PACKAGE_DIR}/${PACKAGE_NAME}/bin/huliot* ${EXEC_DIR}
            make_hash
        fi
    fi
    ${EXEC_DIR}/huliotservice
}

stop_app() {
    ${EXEC_DIR}/huliotservice --stop
}

case "$1" in
    start)
        start_app
        ;;
    stop)
        stop_app
        ;;
    restart)
        stop_app
        start_app
        ;;
    *)
        ;;
esac

exit 0

  1. Create a Makefile

I created it as follows.

ROOSTER_TOP_DIR ?= $(HOME)/RoosterOS-SDK

ADD_ON_PKG_NAME := hulftiot-agent
ADD_ON_PKG_VERSION := 2.0.0
ADD_ON_PKG_MAINTAINER := Company
ADD_ON_PKG_DESCRIPTION := 

include $(ROOSTER_TOP_DIR)/mk/add-on-package.mk

OBJ_DIR=./object

hulftiot-agent:

contents: $(ROOSTER_PACKAGE_ADD_ON_CONTENTS_DIR) hulftiot-agent
	mkdir -p $(ROOSTER_PACKAGE_ADD_ON_CONTENTS_DIR)/bin
	cp $(OBJ_DIR)/huliot* $(ROOSTER_PACKAGE_ADD_ON_CONTENTS_DIR)/bin
	cp $(OBJ_DIR)/agent.conf $(ROOSTER_PACKAGE_ADD_ON_CONTENTS_DIR)/bin
	touch $(ROOSTER_PACKAGE_ADD_ON_CONTENTS_PREPARED)

$(eval $(DefaultTarget))

  1. Execute the following command to create a package
make rpk
  1. When you execute the command, the following files will be created.

After that, you can use it by bringing this created package file to Rooster and installing it referring to the following manual.

--Add-on Application Development-Environment Construction Manual.pdf

Summary

What did you think. This time, I tried to create a HULFT IoT Agent package. There are many steps, but if you follow the manual and respond steadily, you've done it to the end!

In this blog, I would like to continue to introduce the contents of consultations at the "Yorozu Consultation Counter" of technology and the tricks that were born.

Please continue to check it out and follow us if you like.

See you again!

Recommended Posts

I tried to put HULFT IoT (Agent) in the gateway Rooster of Sun Electronics
I tried to put HULFT IoT (Edge Streaming) in the gateway Rooster of Sun Electronics
I tried to display the altitude value of DTM in a graph
I tried to touch the API of ebay
I tried to correct the keystone of the image
I tried to predict the price of ETF
I tried to vectorize the lyrics of Hinatazaka46!
I tried to summarize the basic form of GPLVM
I tried to put pytest into the actual battle
I tried to visualize the spacha information of VTuber
I tried to erase the negative part of Meros
I tried to classify the voices of voice actors
I tried to summarize the string operations of Python
[Linux] I learned LPIC lv1 in 10 days and tried to understand the mechanism of Linux.
I tried to put out the frequent word ranking of LINE talk with Python
[First data science ⑥] I tried to visualize the market price of restaurants in Tokyo
I tried to find the entropy of the image with python
[Horse Racing] I tried to quantify the strength of racehorses
I tried to get the location information of Odakyu Bus
I tried the accuracy of three Stirling's approximations in python
I tried to find the average of the sequence with TensorFlow
I tried to summarize the code often used in Pandas
I tried to illustrate the time and time in C language
[Python] I tried to visualize the follow relationship of Twitter
I tried to summarize the commands often used in business
I tried to implement the mail sending function in Python
[Machine learning] I tried to summarize the theory of Adaboost
I tried to fight the Local Minimum of Goldstein-Price Function
I tried to implement blackjack of card game in Python
I tried to create a Python script to get the value of a cell in Microsoft Excel
I wrote a doctest in "I tried to simulate the probability of a bingo game with Python"
[Natural language processing] I tried to visualize the remarks of each member in the Slack community
I tried to find the trend of the number of ships in Tokyo Bay from satellite images.
I tried to describe the traffic in real time with WebSocket
[Linux] I tried to summarize the command of resource confirmation system
I tried to unlock the entrance 2 lock sesame with a single push of the AWS IoT button
I tried to automate the watering of the planter with Raspberry Pi
I tried to build the SD boot image of LicheePi Nano
I wrote the code to write the code of Brainf * ck in python
I tried to register a station on the IoT platform "Rimotte"
I tried to make an analysis base of 5 patterns in 3 years
I tried to summarize the contents of each package saved by Python pip in one line
[RHEL7 / CentOS7] I put in the log monitoring tool swatch and tried to notify by email
I tried to process the image in "pencil style" with OpenCV
I tried to expand the size of the logical volume with LVM
I tried to summarize the frequently used implementation method of pytest-mock
I want to know the population of each country in the world.
I tried to improve the efficiency of daily work with Python
I tried to visualize the common condition of VTuber channel viewers
I tried to move the ball
I tried to estimate the interval.
I tried fitting the exponential function and logistics function to the number of COVID-19 positive patients in Tokyo
I tried to display the analysis result of the natural language processing library GiNZA in an easy-to-understand manner
I tried to open the latest data of the Excel file managed by date in the folder with Python
I tried to transform the face image using sparse_image_warp of TensorFlow Addons
[Python] I tried to summarize the set type (set) in an easy-to-understand manner.
I tried to get the batting results of Hachinai using image processing
I tried to visualize the age group and rate distribution of Atcoder
I tried transcribing the news of the example business integration to Amazon Transcribe
zoom I tried to quantify the degree of excitement of the story at the meeting
I tried to estimate the similarity of the question intent using gensim's Doc2Vec