Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions net.solarnetwork.node.setup.mobile/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
28 changes: 28 additions & 0 deletions net.solarnetwork.node.setup.mobile/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>net.solarnetwork.node.setup.mobile</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=17
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
pluginProject.equinox=false
pluginProject.extensions=false
resolve.requirebundle=false
21 changes: 21 additions & 0 deletions net.solarnetwork.node.setup.mobile/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mobile Network Setup
Bundle-Description: System mobile (cellular/4G) network setup support.
Bundle-SymbolicName: net.solarnetwork.node.setup.mobile
Bundle-Version: 1.0.0
Bundle-Vendor: SolarNetwork
Automatic-Module-Name: net.solarnetwork.node.setup.mobile
Bundle-RequiredExecutionEnvironment: JavaSE-17
Import-Package: net.solarnetwork.domain;version="[3.0,4.0)",
net.solarnetwork.node;version="[2.0,3.0)",
net.solarnetwork.node.reactor;version="[2.0,3.0)",
net.solarnetwork.node.service.support;version="[1.0,2.0)",
net.solarnetwork.service.support;version="[1.0,2.0)",
net.solarnetwork.settings;version="[2.0,3.0)",
net.solarnetwork.settings.support;version="[3.0,4.0)",
net.solarnetwork.util;version="[2.0,3.0)",
org.slf4j;version="[1.7,2.0)",
org.springframework.beans.factory;version="[6.2,7.0)",
org.springframework.context;version="[6.2,7.0)",
org.springframework.context.support;version="[6.2,7.0)"
38 changes: 38 additions & 0 deletions net.solarnetwork.node.setup.mobile/OSGI-INF/blueprint/module.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgix="http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium
http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium/gemini-blueprint-compendium.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="net.solarnetwork.node.setup.mobile.MobileConfiguration"/>
</bean>

<service>
<interfaces>
<value>net.solarnetwork.settings.SettingSpecifierProvider</value>
<value>net.solarnetwork.node.reactor.InstructionHandler</value>
</interfaces>
<service-properties>
<entry key="on-association" value="true"/>
<entry key="instruction">
<list>
<value>SystemConfigure</value>
</list>
</entry>
</service-properties>
<bean class="net.solarnetwork.node.setup.mobile.MobileConfiguration">
<osgix:managed-properties persistent-id="net.solarnetwork.node.setup.mobile.MobileConfiguration"
autowire-on-update="true" update-method="configurationChanged"/>
<property name="messageSource" ref="messageSource"/>
</bean>
</service>

</blueprint>
85 changes: 85 additions & 0 deletions net.solarnetwork.node.setup.mobile/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# SolarNode Mobile Network Setup

This plugin provides a configurable UI within SolarNode, and `SystemConfigure` instruction
support, for resetting/restarting the node's mobile (cellular/4G) network connection.

It is modeled on the [WiFi Setup][wifi] plugin.

# Install

This plugin must be manually installed, along with an OS support package that provides the `mobile`
service script for the `solarcfg` helper. On SolarNodeOS that support is provided by the
[`sn-mobile-mm`][sn-mobile-mm] package, which manages cellular connectivity via ModemManager and
installs the service script to `/usr/share/solarnode/cfg.d/mobile.sh`.

# Use

Once installed, a new **Mobile Network** section appears on the **Settings** page on your SolarNode,
with a **Reset Connection** toggle (the toggle returns to off after the reset is requested).

# `SystemConfigure` instruction support

The `SystemConfigure` instruction topic can be used to get the mobile status and to reset/restart
the connection. The `service` parameter must be `/setup/network/mobile`. The `action` parameter
selects the operation:

| `action` | Description |
| :-------------------- | :---------------------------------------------------- |
| `status` (or omitted) | Return the current mobile connection status. |
| `reset` | Reset (disconnect + reconnect) the mobile connection. |
| `restart` | Restart the mobile networking service. |

## Status result

For the `status` action the `result` parameter is an object:

| Property | Type | Description |
| :-------- | :------------- | :------------------------------------------------------------------ |
| `present` | `boolean` | `true` if a mobile modem is available (and so a reset is possible). |
| `active` | `boolean` | `true` if the mobile connection is currently active. |
| `info` | `List<String>` | Optional detail lines (operator, access technology, signal, state). |

A client can query `status` first and only offer/perform a `reset` when `present` is `true`, to
avoid attempting a reset on a node that has no mobile modem. If the plugin is not installed on the
node at all, the `SystemConfigure` instruction returns a not-found status instead of a result.

Example `result`, expressed in JSON:

```json
{
"present": true,
"active": false,
"info": [
"operator: Spark NZ",
"access: lte",
"signal: 64%",
"state: registered"
]
}
```

## STOMP usage

Via the SolarNode STOMP setup server, after authenticating, send a frame whose `destination` is the
service name. For example, to check whether a mobile connection is available before resetting:

```
SEND
destination:/setup/network/mobile
action:status

^@
```

and to reset the 4G connection:

```
SEND
destination:/setup/network/mobile
action:reset

^@
```

[wifi]: ../net.solarnetwork.node.setup.wifi/
[sn-mobile-mm]: https://github.com/SolarNetwork/solarnode-os-packages/tree/develop/mobile-mm/debian
5 changes: 5 additions & 0 deletions net.solarnetwork.node.setup.mobile/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source.. = src/
output.. = build/eclipse/
bin.includes = META-INF/,\
.,\
OSGI-INF/
6 changes: 6 additions & 0 deletions net.solarnetwork.node.setup.mobile/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<project basedir=".">

<property name="dir.osgi.base" value="${basedir}/../../solarnetwork-build/solarnetwork-osgi-lib"/>
<import file="${dir.osgi.base}/lib-build.xml"/>

</project>
22 changes: 22 additions & 0 deletions net.solarnetwork.node.setup.mobile/ivy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="net.solarnetwork.node" module="${bundle.name}" />
<configurations defaultconf="compile,runtime">
<conf name="compile" visibility="public" description="Build dependencies"/>
<conf name="runtime" visibility="public" description="Runtime dependencies"/>
<conf name="javadoc" visibility="public" description="Javadoc documentation"/>
<conf name="sources"/>
</configurations>
<publications>
<artifact type="pom" ext="pom"/>
<artifact type="bundle" ext="jar"/>
<artifact type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc"/>
<artifact type="sources" ext="jar" conf="sources" m:classifier="sources"/>
</publications>
<dependencies defaultconfmapping="runtime->default(runtime);compile->default(compile)">
<dependency org="net.solarnetwork.common" name="net.solarnetwork.common" rev="4.0.0"/>
<dependency org="net.solarnetwork.node" name="net.solarnetwork.node" rev="4.0.0"/>
<dependency org="org.slf4j" name="slf4j-api" rev="2.0.17"/>
<dependency org="org.springframework" name="spring-context" rev="6.2.6"/>
<dependency org="org.springframework" name="spring-context-support" rev="6.2.6"/>
</dependencies>
</ivy-module>
Loading