Skip to content
forked from bjhindman/ownet

C# port of Maxim Integrated / Dallas Semiconductor's Java 1-Wire library for iButton devices and 1-Wire chips.

Notifications You must be signed in to change notification settings

henrikmbach/ownet

 
 

Repository files navigation

ownet is an attempted port of a subset of the 1-Wire API for Java (OneWireAPI.jar) to C#.  The goal is to convert a subset of OneWireAPI.jar with an eye towards using the resulting library for Maxim's iButton data loggers.

OneWireAPI.jar is here:
https://www.maximintegrated.com/en/products/digital/one-wire/software-tools/api-java-sdk.html


Game Plan
=========
1.  Create ownet project in Visual Studio 2005 since it is the only version of Visual Studio with the Java Language Conversion Assistant (JLCA).
2.  Take the raw source files of OneWireAPI.jar and any extra source files of OneWire.NET.dll and run the JLCA on the resulting source files.
3.  The initial pass should include the file list in this document under the heading "Initial Java-to-C# File Conversion List" (may lengthen/shorten as required).
4.  Compile project so that it is an "AnyCPU" project and that it will eventually output a single C# dll called "ownet.dll".
5.  Compile the code.
6.  Take resulting compilation errors one-by-one.  Discover source of error and correct, and recompile/debug repeatedly until no errors are left and ownet.dll is generated. Concentrate on OneWireContainer41 and related files.  Do not spend time on containers that require lots of extra work for compilation error workarounds.
7.  Create small 1-Wire application that exercises 1-Wire search and minimal OneWireContainer methods.
8.  Expand and debug application in 7. until API is ready to be used in an initial iButton data logger program.
9.  Optional steps:
a.  Use compact.NET low-level API (equivalent of DSPortAdapter -- see com.dalsemi.onewire.adapter namespace below) and connect the rest of the API (containers, memory banks, etc.) on top of Compact.NET
b.  Use TMEX P/Invoke layer with delegates.
c.  Convert NetAdapter
d.  Convert XML Tagging code.
10. Update source code documentation to reflect C# instead of Java
11. Test every class.



Initial Java-to-C# File Conversion List
=======================================
SupportClass.cs (auto-generated by JCLA)
<com>
  <dalsemi>
    <onewire>
      OneWireAccessProvider.cs
      OneWireException.cs
      <adapter>
        AdapterEnumerator.cs
        DotNetAdapterx64.cs
        DotNetAdapterx86.cs
        DSPortAdapter.cs
        DumbAdapter.cs
        OneWireIOException.cs
      <container> 
        ADContainer.cs
        ClockContainer.cs
        HumidityContainer.cs
        MemoryBank.cs
        MemoryBankAD.cs
        MemoryBankAppReg.cs
        MemoryBankEE.cs
        MemoryBankEEPROM.cs
        MemoryBankEEPROMblock.cs
        MemoryBankEEPROMstatus.cs
        MemoryBankEPROM.cs
        MemoryBankNV.cs
        MemoryBankNVCRC.cs
        MemoryBankNVCRCPW.cs
        MemoryBankSBM.cs
        MemoryBankScratch.cs
        MemoryBankScratchCRC.cs
        MemoryBankScratchCRCPW.cs
        MemoryBankScratchEE.cs
        MemoryBankScratchEx.cs
        MemoryBankScratchSHA.cs
        MemoryBankScratchSHAEE.cs
        MemoryBankScratchTemp.cs
        MemoryBankSHAEE.cs
        MissionContainer.cs
        OneWireContainer.cs
        OneWireContainer01.cs
        OneWireContainer02.cs
        OneWireContainer04.cs
        OneWireContainer05.cs
        OneWireContainer06.cs
        OneWireContainer08.cs
        OneWireContainer09.cs
        OneWireContainer0A.cs
        OneWireContainer0B.cs
        OneWireContainer0C.cs
        OneWireContainer0F.cs
        OneWireContainer10.cs
        OneWireContainer12.cs
        OneWireContainer13.cs
        OneWireContainer14.cs
        OneWireContainer18.cs
        OneWireContainer1A.cs
        OneWireContainer1C.cs
        OneWireContainer1D.cs
        OneWireContainer1F.cs
        OneWireContainer20.cs
        OneWireContainer21.cs
        OneWireContainer22.cs
        OneWireContainer23.cs
        OneWireContainer24.cs
        OneWireContainer26.cs
        OneWireContainer27.cs
        OneWireContainer28.cs
        OneWireContainer29.cs
        OneWireContainer2C.cs
        OneWireContainer2D.cs
        OneWireContainer30.cs
        OneWireContainer33.cs
        OneWireContainer37.cs
        OneWireContainer3A.cs
        OneWireContainer41.cs
        OneWireContainer42.cs
        OneWireContainer43.cs
        OneWireSensor.cs
        OTPMemoryBank.cs
        PagedMemoryBank.cs
        PasswordContainer.cs
        PotentiometerContainer.cs
        ScratchPad.cs
        SwitchContainer.cs
        TemperatureContainer.cs
      <debug>
        Debug.cs
      <utils>
        Address.cs
        Bit.cs
        Convert.cs
        CRC16.cs
        CRC8.cs
        IOHelper.cs
        OWPath.cs
        OWPathElement.cs
        SHA.cs

WHAT HAS BEEN DONE? WHAT HAS NOT BEEN DONE?
===========================================
DONE:

This particular version of ownet is the first one posted to GitHub. The project compiles. Very few classes have been tested extensively.  No change to source-code documentation has occurred (it is still in Java). A version of the Maxim's 1-Wire humidity logger (DS1923) and temperature logger (DS1922) software called "Hygrochron Viewer" has been updated to use this library.  Little testing has been done, but what has been done looks promising.  Hygrochron Viewer can be found in the HygrochonViewerV31 directory.

NOT DONE:

Quite a bit of stuff, such as number 9 and above from the "Game Plan" -- plus, support for any newer ibuttons or 1-Wire devices from 2013 on.


Potential Updates:
=================
This is some one-shot code.  I doubt further work will be done on this.  Please use as-is or fork.  Or, simply use to compare.


Other 1-Wire libraries you should take a look at:
=================================================
1) https://github.com/jwinarske/winrt-onewire
This project has the potential to be quite a bit better and more complete than this project.  It is also a port of Maxim's 1-Wire Java library to C#.  This project is complete with several examples (and even brand new ones).

Support:
========
Do not contact Maxim Integrated for support on these libraries.  They will not know how to help you.  The code is available as is -- without ongoing support.  If you see a problem, please fix it.  All source is available here.

--Brian Hindman

About

C# port of Maxim Integrated / Dallas Semiconductor's Java 1-Wire library for iButton devices and 1-Wire chips.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 98.4%
  • HTML 1.6%