Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #35 from NordicSemiconductor/master
Browse files Browse the repository at this point in the history
Sync master to release/v1.1
  • Loading branch information
bencefr authored Jul 21, 2020
2 parents b37c0db + f54e2c6 commit 0cbf36c
Show file tree
Hide file tree
Showing 40 changed files with 90 additions and 3,330 deletions.
15 changes: 15 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Version 1.1.2
### Updates
- Remove control characters from logfile for readability #34

## Version 1.1.1
### Bugfixes
- Added scroll to Certificate Manager on small screen #19

## Version 1.1.0
### Features
- Added new screen Certificate Manager

## Version 1.0.0
### Updates
- Updated to React Bootstrap 4
62 changes: 13 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,28 @@
# LTE Link Monitor
# nRF Connect LTE Link Monitor

[![Build Status](https://dev.azure.com/NordicSemiconductor/Wayland/_apis/build/status/NordicSemiconductor.pc-nrfconnect-linkmonitor?branchName=master)](https://dev.azure.com/NordicSemiconductor/Wayland/_build/latest?definitionId=6&branchName=master)
[![License](https://img.shields.io/badge/license-Modified%20BSD%20License-blue.svg)](LICENSE)

The LTE Link Monitor is a modem client application that monitors the modem/link status and activity via AT commands. It is implemented as an app for the [nRF Connect](https://infocenter.nordicsemi.com/topic/struct_nrftools/struct/nrftools_nrfconnect.html) desktop application. Currently the nRF9160 Development Kit (PCA10090) is the only supported device.
*nRF Connect LTE Link Monitor* is a modem client application that monitors the modem/link status and activity via AT commands.

# Installation
![screenshot](resources/screenshot.gif)

To install the application you can download binaries from the [nRF Connect product page](https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF-Connect-for-desktop) on Nordic Semiconductor web pages.
## Installation

nRF Connect currently supports the following operating systems:
See the [InfoCenter](https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_nrftools%2Fstruct%2Fnrftools_nrfconnect.html) pages for information on how to install the application.

* Windows
* Ubuntu Linux 64-bit
* macOS
## Development

After *nRF Connect* is installed, you can find *Link Monitor* in the app list by selecting *Add/remove apps*.
See the [app development](https://nordicsemiconductor.github.io/pc-nrfconnect-docs/) pages for details on how to develop apps for the nRF Connect for Desktop framework.

# Usage documentation
## Feedback

See [user guide](https://infocenter.nordicsemi.com/topic/ug_link_monitor/UG/link_monitor/lm_intro.html).
Please report issues on the [DevZone](https://devzone.nordicsemi.com) portal.

# Contributing
## Contributing

Feel free to file code related issues on [GitHub Issues](https://github.com/NordicSemiconductor/pc-nrfconnect-linkmonitor/issues) and/or submit a pull request. In order to accept your pull request, we need you to sign our Contributor License Agreement (CLA). You will see instructions for doing this after having submitted your first pull request. You only need to sign the CLA once, so if you have already done it for another project in the NordicSemiconductor organization, you are good to go.
See the [infos on contributing](https://nordicsemiconductor.github.io/pc-nrfconnect-docs/contributing) for details.

# Compiling from source
## License

Since *nRF Connect* expects local apps in `$HOME/.nrfconnect-apps/local` (Linux/macOS) or `%USERPROFILE%/.nrfconnect-apps/local` (Windows) directory, make sure your repository is cloned or linked there.

## Dependencies

To build this project you will need to install the following tools:

* Node.js (>=6.9)
* npm (>=3.7.0)

## Compiling

When *nRF Connect* have been installed, you are ready to start the compilation. Run the following command from the command line, standing in the root folder of the repository:

npm install

When the procedure has completed successfully you can run the application by running:

npm run dev

The built app can be loaded by *nRF Connect* launcher.

## Testing

Unit testing can be performed by running:

npm test

# License

See the [license file](LICENSE) for details.

# Feedback

* Ask questions on [DevZone Questions](https://devzone.nordicsemi.com)
* File code related issues on [GitHub Issues](https://github.com/NordicSemiconductor/pc-nrfconnect-linkmonitor/issues)
See the [LICENSE](LICENSE) file for details.
2 changes: 2 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ steps:
inputs:
versionSpec: 8.15.1
- script: |
set -o errexit -o pipefail
npm i
npm run lint
npm run build
npm test
7 changes: 5 additions & 2 deletions index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ const platform = process.platform.slice(0, 3);

/* eslint react/prop-types: 0 */

// Prefer to use the serialport 8 property or fall back to the serialport 7 property
const portPath = serialPort => serialPort.path || serialPort.comName;

/**
* Pick the serialport that should belong to the modem on PCA10090
* @param {Array<device>} serialports array of device-lister serialport objects
Expand All @@ -67,7 +70,7 @@ function pickSerialPort(serialports) {
return serialports.find(s => (/-if00$/.test(s.pnpId)));
case 'dar':
// this doesn't work, but with fixDevices() can't happen
return serialports.find(s => (/1$/.test(s.comName)));
return serialports.find(s => (/1$/.test(portPath(s))));
default:
}
return undefined;
Expand Down Expand Up @@ -181,7 +184,7 @@ export default {

const serialport = pickSerialPort(serialports);
if (serialport) {
store.dispatch(ModemActions.open(serialport));
store.dispatch(ModemActions.open(portPath(serialport)));
}
}
if (action.type === 'DEVICE_DESELECTED') {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/chartActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import { EventCategory } from 'modemtalk';
import microseconds from '../utils/timestamp';
import { EventCategory } from '../../modemtalk';
import { CHART_UPDATE, CHART_WINDOW, CHART_WINDOW_RESET } from './actionIds';

export const timeseries = {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/logfileActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import fs from 'fs';
import { remote } from 'electron';
import { logger, getAppLogDir } from 'nrfconnect/core';
import { ResponseConverters } from '../../modemtalk';
import { ResponseConverters } from 'modemtalk';
import {
clearChart, addEventToChart, chartWindow, chartUpdate,
} from './chartActions';
Expand Down
12 changes: 6 additions & 6 deletions lib/actions/modemActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
/* eslint-disable import/no-cycle */

import { logger } from 'nrfconnect/core';
import { ModemPort } from 'modemtalk';
import getLocation from '../utils/locationApi';
import ModemPort from '../../modemtalk';
import { clearChart, addEventToChart } from './chartActions';
import { signalQualityIntervalChangedAction } from './uiActions';
import * as terminalActions from './terminalActions';
Expand Down Expand Up @@ -402,17 +402,17 @@ export function close() {
};
}

export function open(serialPort) {
export function open(portPath) {
return async () => {
await dispatch(close());
dispatch(clearChart());

function writeCallback(data) {
logger.debug(`modem >> ${hexEscape.encode(data)}`);
logger.debug(`modem >> ${hexEscape.remove(data)}`);
dispatch(terminalActions.printTX(data));
}

port = new ModemPort(serialPort.comName, { writeCallback });
port = new ModemPort(portPath, { writeCallback });

port.on('event', unsolicitedHandler);
port.on('error', err => {
Expand All @@ -423,7 +423,7 @@ export function open(serialPort) {
dispatch({ type: 'SERIAL_PORT_DESELECTED' });
});
port.on('rx', (data, unsolicited) => {
logger.debug(`modem << ${hexEscape.encode(data)}`);
logger.debug(`modem << ${hexEscape.remove(data)}`);
dispatch(terminalActions.print(data, unsolicited ? 'unsolicited' : 'rx'));
});
port.on('modemBits', status => {
Expand All @@ -438,7 +438,7 @@ export function open(serialPort) {
return;
}
logger.info('Modem port is opened');
dispatch(modemOpenedAction(serialPort.comName));
dispatch(modemOpenedAction(portPath));

if (getState().app.ui.autoRequests) {
try {
Expand Down
2 changes: 1 addition & 1 deletion lib/actions/terminalActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
*/

import React from 'react';
import { ResponseConverters } from 'modemtalk';
import TerminalView from '../components/TerminalView';
import { UPDATE_TERMINAL, UPDATE_SAVED_COMMANDS } from './actionIds';
import { ResponseConverters } from '../../modemtalk';
import persistentStore from './persistentStore';

const { contentBuffer } = TerminalView;
Expand Down
7 changes: 4 additions & 3 deletions lib/components/Chart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ import { Line } from 'react-chartjs-2';
import Button from 'react-bootstrap/Button';
import ButtonGroup from 'react-bootstrap/ButtonGroup';

import { EventCategory } from 'modemtalk';
import { timeseries } from '../actions/chartActions';
import { EventCategory } from '../../modemtalk/utils';

import '../utils/chart.zoomPan';
import zoomPanPlugin from '../utils/chart.zoomPan';

const greenColor = '#59a659';
const blueColor = '#0060a0';
Expand Down Expand Up @@ -197,7 +197,7 @@ class Chart extends React.Component {
},
scales: {
xAxes: [{
id: 'x-axis-0',
id: 'xScale',
type: 'linear',
min: begin,
max: end,
Expand Down Expand Up @@ -262,6 +262,7 @@ class Chart extends React.Component {
data={chartData}
options={chartOptions}
timestamp={timestamp}
plugins={[zoomPanPlugin]}
/>
<div className="chart-bottom">
<ButtonGroup>
Expand Down
16 changes: 8 additions & 8 deletions lib/utils/__tests__/hexEscape.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ import * as hexEscape from '../hexEscape';
describe('hex escape sequence encoder and decoder', () => {
it('should encode control characters to hex escape sequences', () => {
expect(hexEscape.encode('\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007'))
.toBe('\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07');
.toBe('\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07');
expect(hexEscape.encode('\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F'))
.toBe('\\x08\\x09\\x0A\\x0B\\x0C\\x0D\\x0E\\x0F');
.toBe('\\x08\\x09\\x0A\\x0B\\x0C\\x0D\\x0E\\x0F');
expect(hexEscape.encode('\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017'))
.toBe('\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17');
.toBe('\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17');
expect(hexEscape.encode('\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u007F'))
.toBe('\\x18\\x19\\x1A\\x1B\\x1C\\x1D\\x1E\\x1F\\x7F');
.toBe('\\x18\\x19\\x1A\\x1B\\x1C\\x1D\\x1E\\x1F\\x7F');
});
it('should decode hex escape sequences to control characters', () => {
expect(hexEscape.decode('\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07'))
.toBe('\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007');
.toBe('\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007');
expect(hexEscape.decode('\\x08\\x09\\x0A\\x0B\\x0C\\x0D\\x0E\\x0F'))
.toBe('\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F');
.toBe('\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F');
expect(hexEscape.decode('\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17'))
.toBe('\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017');
.toBe('\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017');
expect(hexEscape.decode('\\x18\\x19\\x1A\\x1B\\x1C\\x1D\\x1E\\x1F\\x7F'))
.toBe('\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u007F');
.toBe('\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u007F');
});
});
Loading

0 comments on commit 0cbf36c

Please sign in to comment.