Socket
Book a DemoInstallSign in
Socket

Jc.OpenNov.Nfc.Android

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Jc.OpenNov.Nfc.Android

.NET library to read data from NFC Novo Nordisk insulin pens on Android devices.

1.0.0
nugetNuGet
Version published
Maintainers
1
Created
Source

Jc.OpenNov

Library for reading data from NFC Novo Nordisk insulin pens in .NET.

C# implementation derived from lcacheux's Kotlin nov-open-reader project - big thanks!

Table of Contents

Introduction

Jc.OpenNov is a library designed to facilitate the reading of data from NFC Novo Nordisk insulin pens from iOS and Android in .NET.

Components

  • Jc.OpenNov: Core library containing data structure and protocol implementation.
  • Jc.OpenNov.Nfc.Android: Android implementation of NFC communication using Jc.OpenNov.
  • Jc.OpenNov.Avalonia: Avalonia implementation of NFC communication using Jc.OpenNov.
  • Jc.OpenNov.Avalonia.Android: Android implementation of NFC communication using Jc.OpenNov.Avalonia.
  • Jc.OpenNov.Avalonia.iOS: iOS implementation of NFC communication using Jc.OpenNov.Avalonia.

Sample Screenshots

AndroidiOS
AndroidAndroid

Usage

Barebones (MAUI/etc.)

To use Jc.OpenNov, you need to install the NuGet package:

dotnet add package Jc.OpenNov

Followed by adding the Android/iOS Jc.OpenNov.Nfc.xxx package to your project:

dotnet add package Jc.OpenNov.Nfc.Android

Avalonia Android

Install the following NuGet packages to their respective projects:

dotnet add package Jc.OpenNov.Avalonia
dotnet add package Jc.OpenNov.Avalonia.Android

Add the following to your AndroidManifest.xml:

<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />

In your MainActivity, add to your AppBuilder like so:

protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
    return base.CustomizeAppBuilder(builder)
        // ...
        .UseOpenNov(this);
}

Avalonia iOS

Install the following NuGet packages to their respective projects:

dotnet add package Jc.OpenNov.Avalonia
dotnet add package Jc.OpenNov.Avalonia.iOS

Add the following to your Entitlements.plist:

<key>com.apple.developer.nfc.readersession.formats</key>
<array>
    <string>TAG</string>
</array>

and the following to your Info.plist:

<key>NFCReaderUsageDescription</key>
<string>Used to retrieve data from Novopens.</string>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
    <string>D2760000850101</string>
    <string>E103</string>
    <string>E104</string>
</array>

In your AppDelegate, add to your AppBuilder like so:

protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
    return base.CustomizeAppBuilder(builder)
        // ...
        .UseOpenNov();
}

Avalonia

To start listening for NFC tags, call:

OpenNov.Current.MonitorNfc(/* you may pass in an optional stop condition */);

Likewise, to stop listening for NFC tags, call:

OpenNov.Current.StopNfc();

To know when an NFC tag is detected and data is obtained, subscribe to the event handlers:

public MainViewModel()
{
    StarNfcCommand = ReactiveCommand.Create(StartNfc);
    StopNfcCommand = ReactiveCommand.Create(StopNfc);

    Avalonia.OpenNov.Current.OnDataRead += OnDataRead;
    Avalonia.OpenNov.Current.OnTagDetected += OnTagDetected;
    Avalonia.OpenNov.Current.OnError += OnError;
}

~MainViewModel()
{
    Avalonia.OpenNov.Current.OnDataRead -= OnDataRead;
    Avalonia.OpenNov.Current.OnTagDetected -= OnTagDetected;
    Avalonia.OpenNov.Current.OnError -= OnError;
}

private void OnDataRead(object? sender, Data.PenResult e)
{
    if (e is Data.PenResult.Success success)
    {
        Serial = success.Data.Serial;
    }
}

private void OnTagDetected(object? sender, ITag? e)
{
    var bytes = e?.GetId();
    if (bytes is null)
    {
        TagId = "Tag not found";
        return;
    }

    TagId = Convert.ToHexString(bytes);
}

private void OnError(object? sender, Exception e)
{
    Error = e.Message;
}

Keywords

FAQs

Package last updated on 22 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.