mirror of
https://github.com/ckaczor/OneWireAPI.git
synced 2026-01-14 01:25:40 -05:00
Initial commit
This commit is contained in:
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
###############################################################################
|
||||||
|
# Set default behavior to automatically normalize line endings.
|
||||||
|
###############################################################################
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set default behavior for command prompt diff.
|
||||||
|
#
|
||||||
|
# This is need for earlier builds of msysgit that does not have it on by
|
||||||
|
# default for csharp files.
|
||||||
|
# Note: This is only used by command line
|
||||||
|
###############################################################################
|
||||||
|
#*.cs diff=csharp
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set the merge driver for project and solution files
|
||||||
|
#
|
||||||
|
# Merging from the command prompt will add diff markers to the files if there
|
||||||
|
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||||
|
# the diff markers are never inserted). Diff markers may cause the following
|
||||||
|
# file extensions to fail to load in VS. An alternative would be to treat
|
||||||
|
# these files as binary and thus will always conflict and require user
|
||||||
|
# intervention with every merge. To do so, just uncomment the entries below
|
||||||
|
###############################################################################
|
||||||
|
#*.sln merge=binary
|
||||||
|
#*.csproj merge=binary
|
||||||
|
#*.vbproj merge=binary
|
||||||
|
#*.vcxproj merge=binary
|
||||||
|
#*.vcproj merge=binary
|
||||||
|
#*.dbproj merge=binary
|
||||||
|
#*.fsproj merge=binary
|
||||||
|
#*.lsproj merge=binary
|
||||||
|
#*.wixproj merge=binary
|
||||||
|
#*.modelproj merge=binary
|
||||||
|
#*.sqlproj merge=binary
|
||||||
|
#*.wwaproj merge=binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# behavior for image files
|
||||||
|
#
|
||||||
|
# image files are treated as binary by default.
|
||||||
|
###############################################################################
|
||||||
|
#*.jpg binary
|
||||||
|
#*.png binary
|
||||||
|
#*.gif binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# diff behavior for common document formats
|
||||||
|
#
|
||||||
|
# Convert binary document formats to text before diffing them. This feature
|
||||||
|
# is only available from the command line. Turn it on by uncommenting the
|
||||||
|
# entries below.
|
||||||
|
###############################################################################
|
||||||
|
#*.doc diff=astextplain
|
||||||
|
#*.DOC diff=astextplain
|
||||||
|
#*.docx diff=astextplain
|
||||||
|
#*.DOCX diff=astextplain
|
||||||
|
#*.dot diff=astextplain
|
||||||
|
#*.DOT diff=astextplain
|
||||||
|
#*.pdf diff=astextplain
|
||||||
|
#*.PDF diff=astextplain
|
||||||
|
#*.rtf diff=astextplain
|
||||||
|
#*.RTF diff=astextplain
|
||||||
156
.gitignore
vendored
Normal file
156
.gitignore
vendored
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
|
||||||
|
[Dd]ebug/
|
||||||
|
[Rr]elease/
|
||||||
|
x64/
|
||||||
|
build/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
|
||||||
|
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
|
||||||
|
!packages/*/build/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.log
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
*.ncrunch*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.Publish.xml
|
||||||
|
|
||||||
|
# NuGet Packages Directory
|
||||||
|
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||||
|
#packages/
|
||||||
|
|
||||||
|
# Windows Azure Build Output
|
||||||
|
csx
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Windows Store app package directory
|
||||||
|
AppPackages/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
sql/
|
||||||
|
*.Cache
|
||||||
|
ClientBin/
|
||||||
|
[Ss]tyle[Cc]op.*
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file to a newer
|
||||||
|
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
App_Data/*.mdf
|
||||||
|
App_Data/*.ldf
|
||||||
|
|
||||||
|
|
||||||
|
#LightSwitch generated files
|
||||||
|
GeneratedArtifacts/
|
||||||
|
_Pvt_Extensions/
|
||||||
|
ModelManifest.xml
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# Windows detritus
|
||||||
|
# =========================
|
||||||
|
|
||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Mac desktop service store files
|
||||||
|
.DS_Store
|
||||||
214
OneWireAPI.csproj
Normal file
214
OneWireAPI.csproj
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ProjectType>Local</ProjectType>
|
||||||
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
|
<ProjectGuid>{E89D1170-9261-4523-BB6E-A4D08EF80A36}</ProjectGuid>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ApplicationIcon>
|
||||||
|
</ApplicationIcon>
|
||||||
|
<AssemblyKeyContainerName>
|
||||||
|
</AssemblyKeyContainerName>
|
||||||
|
<AssemblyName>OneWireAPI</AssemblyName>
|
||||||
|
<AssemblyOriginatorKeyFile>
|
||||||
|
</AssemblyOriginatorKeyFile>
|
||||||
|
<DefaultClientScript>JScript</DefaultClientScript>
|
||||||
|
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||||
|
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||||
|
<DelaySign>false</DelaySign>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>OneWireAPI</RootNamespace>
|
||||||
|
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||||
|
<StartupObject>
|
||||||
|
</StartupObject>
|
||||||
|
<FileUpgradeFlags>
|
||||||
|
</FileUpgradeFlags>
|
||||||
|
<SccProjectName>Svn</SccProjectName>
|
||||||
|
<SccLocalPath>Svn</SccLocalPath>
|
||||||
|
<SccAuxPath>Svn</SccAuxPath>
|
||||||
|
<SccProvider>SubversionScc</SccProvider>
|
||||||
|
<UpgradeBackupLocation>
|
||||||
|
</UpgradeBackupLocation>
|
||||||
|
<OldToolsVersion>3.5</OldToolsVersion>
|
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
|
<PublishUrl>http://localhost/OneWireAPI/</PublishUrl>
|
||||||
|
<Install>true</Install>
|
||||||
|
<InstallFrom>Web</InstallFrom>
|
||||||
|
<UpdateEnabled>true</UpdateEnabled>
|
||||||
|
<UpdateMode>Foreground</UpdateMode>
|
||||||
|
<UpdateInterval>7</UpdateInterval>
|
||||||
|
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||||
|
<UpdatePeriodically>false</UpdatePeriodically>
|
||||||
|
<UpdateRequired>false</UpdateRequired>
|
||||||
|
<MapFileExtensions>true</MapFileExtensions>
|
||||||
|
<ApplicationRevision>0</ApplicationRevision>
|
||||||
|
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||||
|
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||||
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<NoStdLib>false</NoStdLib>
|
||||||
|
<NoWarn>
|
||||||
|
</NoWarn>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<RegisterForComInterop>false</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||||
|
<BaseAddress>285212672</BaseAddress>
|
||||||
|
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||||
|
<ConfigurationOverrideFile>
|
||||||
|
</ConfigurationOverrideFile>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DocumentationFile>
|
||||||
|
</DocumentationFile>
|
||||||
|
<DebugSymbols>false</DebugSymbols>
|
||||||
|
<FileAlignment>4096</FileAlignment>
|
||||||
|
<NoStdLib>false</NoStdLib>
|
||||||
|
<NoWarn>
|
||||||
|
</NoWarn>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<RegisterForComInterop>false</RegisterForComInterop>
|
||||||
|
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System">
|
||||||
|
<Name>System</Name>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Core">
|
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Data">
|
||||||
|
<Name>System.Data</Name>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO">
|
||||||
|
<HintPath>packages\Microsoft.Bcl.1.1.8\lib\net40\System.IO.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Runtime">
|
||||||
|
<HintPath>packages\Microsoft.Bcl.1.1.8\lib\net40\System.Runtime.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Threading.Tasks">
|
||||||
|
<HintPath>packages\Microsoft.Bcl.1.1.8\lib\net40\System.Threading.Tasks.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Xml">
|
||||||
|
<Name>System.XML</Name>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owAdapter.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owCRC16.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owCRC8.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owDevice.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owDeviceFamily10.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owDeviceFamily12.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owDeviceFamily1D.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owDeviceFamily20.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owDeviceFamily26.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owDeviceFamilyFF.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owException.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owIdentifer.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owNetwork.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="owSession.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="TMEX.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<AppDesigner Include="Properties\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||||
|
<Install>false</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||||
|
<Visible>False</Visible>
|
||||||
|
<ProductName>Windows Installer 3.1</ProductName>
|
||||||
|
<Install>true</Install>
|
||||||
|
</BootstrapperPackage>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Common\Common.csproj">
|
||||||
|
<Project>{17864d82-457d-4a0a-bc10-1d07f2b3a5d6}</Project>
|
||||||
|
<Name>Common</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<PreBuildEvent>
|
||||||
|
</PreBuildEvent>
|
||||||
|
<PostBuildEvent>
|
||||||
|
</PostBuildEvent>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ProjectExtensions>
|
||||||
|
<VisualStudio>
|
||||||
|
<UserProperties StartDate="20080806" />
|
||||||
|
</VisualStudio>
|
||||||
|
</ProjectExtensions>
|
||||||
|
<Import Project="packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
|
||||||
|
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
|
||||||
|
<Error Condition="!Exists('packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
|
||||||
|
<Error Condition="Exists('packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
44
OneWireAPI.sln
Normal file
44
OneWireAPI.sln
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio 2013
|
||||||
|
VisualStudioVersion = 12.0.30324.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OneWireAPI", "OneWireAPI.csproj", "{E89D1170-9261-4523-BB6E-A4D08EF80A36}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "..\Common\Common.csproj", "{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{E89D1170-9261-4523-BB6E-A4D08EF80A36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E89D1170-9261-4523-BB6E-A4D08EF80A36}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E89D1170-9261-4523-BB6E-A4D08EF80A36}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{E89D1170-9261-4523-BB6E-A4D08EF80A36}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{E89D1170-9261-4523-BB6E-A4D08EF80A36}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E89D1170-9261-4523-BB6E-A4D08EF80A36}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E89D1170-9261-4523-BB6E-A4D08EF80A36}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{E89D1170-9261-4523-BB6E-A4D08EF80A36}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x86.Build.0 = Debug|x86
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x64.Build.0 = Release|x64
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x86.ActiveCfg = Release|x86
|
||||||
|
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x86.Build.0 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
58
Properties/AssemblyInfo.cs
Normal file
58
Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
//
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
//
|
||||||
|
[assembly: AssemblyTitle("")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("")]
|
||||||
|
[assembly: AssemblyCopyright("")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
//
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.410.1323")]
|
||||||
|
|
||||||
|
//
|
||||||
|
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||||
|
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||||
|
//
|
||||||
|
// Use the attributes below to control which key is used for signing.
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
// (*) If no key is specified, the assembly is not signed.
|
||||||
|
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||||
|
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||||
|
// a key.
|
||||||
|
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||||
|
// following processing occurs:
|
||||||
|
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||||
|
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||||
|
// in the KeyFile is installed into the CSP and used.
|
||||||
|
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||||
|
// When specifying the KeyFile, the location of the KeyFile should be
|
||||||
|
// relative to the project output directory which is
|
||||||
|
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||||
|
// located in the project directory, you would specify the AssemblyKeyFile
|
||||||
|
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||||
|
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||||
|
// documentation for more information on this.
|
||||||
|
//
|
||||||
|
[assembly: AssemblyDelaySign(false)]
|
||||||
|
[assembly: AssemblyKeyFile("")]
|
||||||
|
[assembly: AssemblyKeyName("")]
|
||||||
134
TMEX.cs
Normal file
134
TMEX.cs
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class TMEX
|
||||||
|
{
|
||||||
|
#region TMEX function enumerations
|
||||||
|
|
||||||
|
// Size of the global state buffer
|
||||||
|
public enum TMStateBufferSize
|
||||||
|
{
|
||||||
|
NoEPROMWriting = 5120,
|
||||||
|
EPROMWriting = 15360
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type of operation for the TMOneWireLevel function
|
||||||
|
public enum TMOneWireLevelOperation : short
|
||||||
|
{
|
||||||
|
Write = 0,
|
||||||
|
Read = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// TMOneWireLevel operation mode
|
||||||
|
public enum TMOneWireLevelMode : short
|
||||||
|
{
|
||||||
|
Normal = 0x0,
|
||||||
|
StrongPullup = 0x1,
|
||||||
|
Break = 0x2,
|
||||||
|
ProgramVoltage = 0x3
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the mode from the TMOneWireLevel is to activate
|
||||||
|
public enum TMOneWireLevelPrime : short
|
||||||
|
{
|
||||||
|
Immediate = 0,
|
||||||
|
AfterNextBit = 1,
|
||||||
|
AfterNextByte = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type of CRC to be calculated
|
||||||
|
public enum TMCRCType : short
|
||||||
|
{
|
||||||
|
EightBit = 0,
|
||||||
|
SixteenBit = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region TMEX function structures
|
||||||
|
|
||||||
|
[StructLayoutAttribute(LayoutKind.Sequential, Pack=1)]
|
||||||
|
public struct FileEntry
|
||||||
|
{
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray,SizeConst=4)]
|
||||||
|
public byte[] Name; /* four-character file name */
|
||||||
|
public byte Extension; /* extension number, range 0 - 99, 127 */
|
||||||
|
public byte StartPage; /* page number where file starts */
|
||||||
|
public byte PageCount; /* number of pages occupied by file */
|
||||||
|
public byte Attributes; /* file/directory attribute */
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray,SizeConst=32)]
|
||||||
|
public byte[] Bitmap; /* current bitmap of the device */
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region TMEX DLL function imports
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short Get_Version(byte[] baVersion);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern int TMExtendedStartSession(short nPortNumber, short nPortType, IntPtr nEnhancedOptions);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMEndSession(int iSession);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMReadDefaultPort(out short nPortNumber, out short nPortType);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMSetup(int iSession);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMClose(int iSession);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMRom(int iSession, byte[] bStateBuffer, short[] nROM);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMAccess(int iSession, byte[] bStateBuffer);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMOneWireLevel(int iSession, TMOneWireLevelOperation nOperation, TMOneWireLevelMode nLevelMode, TMOneWireLevelPrime nPrimed);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMTouchBit(int iSession, short nOutput);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMTouchByte(int iSession, short nOutput);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMTouchReset(int iSession);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMBlockStream(int iSession, byte[] aData, short nByteCount);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMBlockIO(int iSession, byte[] aData, short nByteCount);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMCRC(short nLength, byte[] aData, ushort nSeed, TMCRCType nType);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMFirst(int iSession, byte[] bStateBuffer);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMNext(int iSession, byte[] bStateBuffer);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMFirstFile(int iSession, byte[] bStateBuffer, ref FileEntry uFileEntry);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMOpenFile(int iSession, byte[] bStateBuffer, ref FileEntry uFileEntry);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMReadFile(int iSession, byte[] bStateBuffer, short nFileHandle, byte[] baReadBuffer, short nBufferSize);
|
||||||
|
|
||||||
|
[DllImport("IBFS64.DLL")]
|
||||||
|
public static extern short TMCloseFile(int iSession, byte[] bStateBuffer, short nFileHandle);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
165
owAdapter.cs
Normal file
165
owAdapter.cs
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owAdapter
|
||||||
|
{
|
||||||
|
#region Member variables
|
||||||
|
|
||||||
|
private static owSession m_oSession; // The current session
|
||||||
|
private static owIdentifier m_oLastID; // Last ID selected
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public static void Initialize(owSession Session)
|
||||||
|
{
|
||||||
|
// Store the session we are dealing with
|
||||||
|
m_oSession = Session;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Select(owIdentifier ID)
|
||||||
|
{
|
||||||
|
// Set the ID of the device we want to talk to
|
||||||
|
short nResult = TMEX.TMRom(m_oSession.SessionHandle, m_oSession.StateBuffer, ID.RawID);
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
if (nResult != 1)
|
||||||
|
{
|
||||||
|
// Throw a ROM exception
|
||||||
|
throw new owException(owException.owExceptionFunction.Select, ID, nResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy the ID as the last selected ID
|
||||||
|
m_oLastID = ID;
|
||||||
|
|
||||||
|
// Access the device
|
||||||
|
Access();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Access()
|
||||||
|
{
|
||||||
|
// Attempt to access the device
|
||||||
|
short nResult = TMEX.TMAccess(m_oSession.SessionHandle, m_oSession.StateBuffer);
|
||||||
|
|
||||||
|
// Check to see if we could access the device
|
||||||
|
if (nResult != 1)
|
||||||
|
{
|
||||||
|
// Throw an access exception
|
||||||
|
throw new owException(owException.owExceptionFunction.Access, m_oLastID, nResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static short SendBlock(byte[] Data, short ByteCount)
|
||||||
|
{
|
||||||
|
// Send the block and return the result
|
||||||
|
short nResult = TMEX.TMBlockStream(m_oSession.SessionHandle, Data, ByteCount);
|
||||||
|
|
||||||
|
// Check to see if the bytes sent matches the value returned
|
||||||
|
if (nResult != ByteCount)
|
||||||
|
{
|
||||||
|
// Throw an access exception
|
||||||
|
throw new owException(owException.owExceptionFunction.SendBlock, m_oLastID, nResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the result
|
||||||
|
return nResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static short SendBlock(byte[] Data, short ByteCount, bool Reset)
|
||||||
|
{
|
||||||
|
short nResult;
|
||||||
|
|
||||||
|
// Send the block and return the result
|
||||||
|
if (Reset)
|
||||||
|
nResult = TMEX.TMBlockStream(m_oSession.SessionHandle, Data, ByteCount);
|
||||||
|
else
|
||||||
|
nResult = TMEX.TMBlockIO(m_oSession.SessionHandle, Data, ByteCount);
|
||||||
|
|
||||||
|
// Check to see if the bytes sent matches the value returned
|
||||||
|
if (nResult != ByteCount)
|
||||||
|
{
|
||||||
|
// Throw an access exception
|
||||||
|
throw new owException(owException.owExceptionFunction.SendBlock, m_oLastID, nResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the result
|
||||||
|
return nResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static short ReadBit()
|
||||||
|
{
|
||||||
|
// Send the byte and get back what was sent
|
||||||
|
short nResult = TMEX.TMTouchBit(m_oSession.SessionHandle, 0xFF);
|
||||||
|
|
||||||
|
// Return the result
|
||||||
|
return nResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static short SendBit(short Output)
|
||||||
|
{
|
||||||
|
// Send the byte and get back what was sent
|
||||||
|
short nResult = TMEX.TMTouchBit(m_oSession.SessionHandle, Output);
|
||||||
|
|
||||||
|
// Check that the value was sent correctly
|
||||||
|
if (nResult != Output)
|
||||||
|
{
|
||||||
|
// Throw an exception
|
||||||
|
throw new owException(owException.owExceptionFunction.SendBit, m_oLastID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the result
|
||||||
|
return nResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static short ReadByte()
|
||||||
|
{
|
||||||
|
// Send the byte and get back what was sent
|
||||||
|
short nResult = TMEX.TMTouchByte(m_oSession.SessionHandle, 0xFF);
|
||||||
|
|
||||||
|
// Return the result
|
||||||
|
return nResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static short Reset()
|
||||||
|
{
|
||||||
|
// Reset all devices
|
||||||
|
return TMEX.TMTouchReset(m_oSession.SessionHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static short SendByte(short Output)
|
||||||
|
{
|
||||||
|
// Send the byte and get back what was sent
|
||||||
|
short nResult = TMEX.TMTouchByte(m_oSession.SessionHandle, Output);
|
||||||
|
|
||||||
|
// Check that the value was sent correctly
|
||||||
|
if (nResult != Output)
|
||||||
|
{
|
||||||
|
// Throw an exception
|
||||||
|
throw new owException(owException.owExceptionFunction.SendByte, m_oLastID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the result
|
||||||
|
return nResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static short SetLevel(TMEX.TMOneWireLevelOperation nOperation, TMEX.TMOneWireLevelMode nLevelMode, TMEX.TMOneWireLevelPrime nPrimed)
|
||||||
|
{
|
||||||
|
// Set the level
|
||||||
|
short nResult = TMEX.TMOneWireLevel(m_oSession.SessionHandle, TMEX.TMOneWireLevelOperation.Write, TMEX.TMOneWireLevelMode.Normal, TMEX.TMOneWireLevelPrime.Immediate);
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
if (nResult < 0)
|
||||||
|
{
|
||||||
|
// Throw an exception
|
||||||
|
throw new owException(owException.owExceptionFunction.SetLevel, nResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the result
|
||||||
|
return nResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
61
owCRC16.cs
Normal file
61
owCRC16.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
internal class owCRC16
|
||||||
|
{
|
||||||
|
#region CRC lookup table
|
||||||
|
|
||||||
|
private static short[] m_aOddParity = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 };
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public static int Calculate(byte[] nData, int iStart, int iEnd)
|
||||||
|
{
|
||||||
|
return Calculate(nData, iStart, iEnd, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int Calculate(byte nData, int iInitialValue)
|
||||||
|
{
|
||||||
|
byte[] aData = new byte[1];
|
||||||
|
|
||||||
|
aData[0] = nData;
|
||||||
|
|
||||||
|
return Calculate(aData, 0, 0, iInitialValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int Calculate(byte[] nData, int iStart, int iEnd, int iInitialValue)
|
||||||
|
{
|
||||||
|
int iIndex; // Loop index
|
||||||
|
int iCurrentCRC = iInitialValue; // Current CRC accumulator
|
||||||
|
|
||||||
|
// Loop over all bytes in the input array
|
||||||
|
for (iIndex = iStart; iIndex <= iEnd; iIndex++)
|
||||||
|
{
|
||||||
|
// Get the current element of data
|
||||||
|
int iBuffer = nData[iIndex];
|
||||||
|
|
||||||
|
// Calculate the current CRC for this position
|
||||||
|
iBuffer = (iBuffer ^ (iCurrentCRC & 0xFF)) & 0xFF;
|
||||||
|
|
||||||
|
iCurrentCRC >>= 8;
|
||||||
|
|
||||||
|
if ((m_aOddParity[iBuffer & 0xF] ^ m_aOddParity[iBuffer >> 4]) != 0)
|
||||||
|
iCurrentCRC ^= 0xC001;
|
||||||
|
|
||||||
|
iBuffer <<= 6;
|
||||||
|
iCurrentCRC ^= iBuffer;
|
||||||
|
|
||||||
|
iBuffer <<= 1;
|
||||||
|
iCurrentCRC ^= iBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the final CRC value
|
||||||
|
return iCurrentCRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
76
owCRC8.cs
Normal file
76
owCRC8.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
internal class owCRC8
|
||||||
|
{
|
||||||
|
#region Member variables
|
||||||
|
|
||||||
|
private static byte[] m_aDataTable; // Lookup table of CRC8 values
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
static owCRC8()
|
||||||
|
{
|
||||||
|
// Initialize the CRC lookup table
|
||||||
|
InitializeCRCTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private methods
|
||||||
|
|
||||||
|
private static void InitializeCRCTable()
|
||||||
|
{
|
||||||
|
int iAccumulator; // Accumulator value
|
||||||
|
int iCRC; // CRC value
|
||||||
|
int iOuter; // Outer loop control
|
||||||
|
int iInner; // Inner loop control
|
||||||
|
|
||||||
|
// Initialize the size of the lookup table
|
||||||
|
m_aDataTable = new byte[256];
|
||||||
|
|
||||||
|
for (iOuter = 0; iOuter < 256; iOuter++)
|
||||||
|
{
|
||||||
|
iAccumulator = iOuter;
|
||||||
|
iCRC = 0;
|
||||||
|
|
||||||
|
for (iInner = 0; iInner < 8; iInner++)
|
||||||
|
{
|
||||||
|
if (((iAccumulator ^ iCRC) & 0x01) == 0x01)
|
||||||
|
iCRC = ((iCRC ^ 0x18) >> 1) | 0x80;
|
||||||
|
else
|
||||||
|
iCRC = iCRC >> 1;
|
||||||
|
|
||||||
|
iAccumulator = iAccumulator >> 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_aDataTable[iOuter] = (byte) iCRC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Public methods
|
||||||
|
|
||||||
|
public static short Calculate(byte[] nData, int iStart, int iEnd)
|
||||||
|
{
|
||||||
|
int iIndex; // Loop index
|
||||||
|
short nCurrentCRC = 0; // Current CRC accumulator
|
||||||
|
|
||||||
|
// Loop over all bytes in the input array
|
||||||
|
for (iIndex = iStart; iIndex <= iEnd; iIndex++)
|
||||||
|
{
|
||||||
|
// Calculate the current CRC for this position
|
||||||
|
nCurrentCRC = m_aDataTable[nCurrentCRC ^ nData[iIndex]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the final CRC value
|
||||||
|
return nCurrentCRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
41
owDevice.cs
Normal file
41
owDevice.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owDevice
|
||||||
|
{
|
||||||
|
#region Member variables
|
||||||
|
|
||||||
|
protected owSession _session; // The current session
|
||||||
|
protected owIdentifier _deviceID; // The ID of this device
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public owDevice(owSession session, short[] rawID)
|
||||||
|
{
|
||||||
|
// Store the session
|
||||||
|
_session = session;
|
||||||
|
|
||||||
|
// Create a new identifier and give it the ID supplied
|
||||||
|
_deviceID = new owIdentifier(rawID);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public owIdentifier ID
|
||||||
|
{
|
||||||
|
get { return _deviceID; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Family
|
||||||
|
{
|
||||||
|
get { return _deviceID.Family; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
102
owDeviceFamily10.cs
Normal file
102
owDeviceFamily10.cs
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owDeviceFamily10 : owDevice
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public owDeviceFamily10(owSession Session, short[] ID) : base(Session, ID)
|
||||||
|
{
|
||||||
|
// Just call the base constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public double GetTemperature()
|
||||||
|
{
|
||||||
|
short nResult; // Result of method calls
|
||||||
|
byte[] aData = new byte[30]; // Data buffer to send over the network
|
||||||
|
short nDataCount = 0; // How many bytes of data to send
|
||||||
|
double dCountRemaining; // How many counters remain in the temperature conversion
|
||||||
|
double dCountPerDegreeC; // How many counters per degree C
|
||||||
|
int iTemperatureLSB; // The LSB of the temperature
|
||||||
|
double dTemperature; // double version of the temperature
|
||||||
|
short nCRC; // Result of the CRC check
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Setup for for power delivery after the next byte
|
||||||
|
nResult = owAdapter.SetLevel(TMEX.TMOneWireLevelOperation.Write, TMEX.TMOneWireLevelMode.StrongPullup, TMEX.TMOneWireLevelPrime.AfterNextByte);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Send the byte and start strong pullup
|
||||||
|
owAdapter.SendByte(0x44);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Stop the strong pullup
|
||||||
|
owAdapter.SetLevel(TMEX.TMOneWireLevelOperation.Write, TMEX.TMOneWireLevelMode.Normal, TMEX.TMOneWireLevelPrime.Immediate);
|
||||||
|
|
||||||
|
// Re-throw the exception
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sleep while the data is transfered
|
||||||
|
System.Threading.Thread.Sleep(1000);
|
||||||
|
|
||||||
|
// Stop the strong pullup
|
||||||
|
nResult = owAdapter.SetLevel(TMEX.TMOneWireLevelOperation.Write, TMEX.TMOneWireLevelMode.Normal, TMEX.TMOneWireLevelPrime.Immediate);
|
||||||
|
|
||||||
|
// Access the device we want to talk to
|
||||||
|
owAdapter.Access();
|
||||||
|
|
||||||
|
// Set the command to get the temperature from the scatchpad
|
||||||
|
aData[nDataCount++] = 0xBE;
|
||||||
|
|
||||||
|
// Setup the rest of the bytes that we want
|
||||||
|
for (int i = 0; i < 9; i++)
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the data block and get data back
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC of the first eight bytes of data
|
||||||
|
nCRC = owCRC8.Calculate(aData, 1, 8);
|
||||||
|
|
||||||
|
// Check to see if our CRC matches the CRC supplied
|
||||||
|
if (nCRC != aData[9])
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the LSB of the temperature data and divide it by two
|
||||||
|
iTemperatureLSB = aData[1] / 2;
|
||||||
|
|
||||||
|
// If the data is negative then flip the bits
|
||||||
|
if ((aData[2] & 0x01) == 0x01) iTemperatureLSB |= -128;
|
||||||
|
|
||||||
|
// Convert the temperature into a double
|
||||||
|
dTemperature = (double) iTemperatureLSB;
|
||||||
|
|
||||||
|
// Get the number of counts remaining
|
||||||
|
dCountRemaining = aData[7];
|
||||||
|
|
||||||
|
// Get the number of counts per degree C
|
||||||
|
dCountPerDegreeC = aData[8];
|
||||||
|
|
||||||
|
// Use the "counts remaining" data to calculate the temperaure to greater accuracy
|
||||||
|
dTemperature = dTemperature - 0.25F + (dCountPerDegreeC - dCountRemaining) / dCountPerDegreeC;
|
||||||
|
|
||||||
|
// Return the temperature
|
||||||
|
return dTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
199
owDeviceFamily12.cs
Normal file
199
owDeviceFamily12.cs
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owDeviceFamily12 : owDevice
|
||||||
|
{
|
||||||
|
#region Constants
|
||||||
|
|
||||||
|
private const byte CHANNEL_ACCESS_COMMAND = 0xF5; // Command value to access a channel
|
||||||
|
private const byte WRITE_STATUS_COMMAND = 0x55; // Command value to write the status
|
||||||
|
private const byte READ_STATUS_COMMAND = 0xAA; // Command value to read the status
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public owDeviceFamily12(owSession Session, short[] ID) : base(Session, ID)
|
||||||
|
{
|
||||||
|
// Just call the base constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public bool IsPowered(byte[] State)
|
||||||
|
{
|
||||||
|
return ((State[0] & 0x80) == 0x80);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GetLevel(int Channel, byte[] State)
|
||||||
|
{
|
||||||
|
if (Channel == 0)
|
||||||
|
return ((State[0] & 0x04) == 0x04);
|
||||||
|
else
|
||||||
|
return ((State[0] & 0x08) == 0x08);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool GetLatchState(int Channel, byte[] State)
|
||||||
|
{
|
||||||
|
if (Channel == 0)
|
||||||
|
{
|
||||||
|
return ((State[1] & 0x20) != 0x20);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ((State[1] & 0x40) != 0x40);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetLatchState(int Channel, bool LatchState, byte[] State)
|
||||||
|
{
|
||||||
|
if (Channel == 0)
|
||||||
|
{
|
||||||
|
State[1] &= 0xDF;
|
||||||
|
|
||||||
|
if (!LatchState) State[1] = (byte) (State[1] | 0x20);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
State[1] &= 0xBF;
|
||||||
|
|
||||||
|
if (!LatchState) State[1] = (byte) (State[1] | 0x40);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] ReadDevice()
|
||||||
|
{
|
||||||
|
byte[] State = new byte[2];
|
||||||
|
byte[] aData = new byte[30]; // Data buffer to send over the network
|
||||||
|
short nDataCount = 0; // How many bytes of data to send
|
||||||
|
int iCRCResult; // Result of the CRC calculation
|
||||||
|
int iMatchCRC; // CRC retrieved from the device
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Set the commmand to execute
|
||||||
|
aData[nDataCount++] = CHANNEL_ACCESS_COMMAND;
|
||||||
|
|
||||||
|
// Set the data
|
||||||
|
aData[nDataCount++] = 0x55;
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Read the info, dummy data and CRC16
|
||||||
|
for (int i = 3; i < 7; i++)
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the data
|
||||||
|
owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC
|
||||||
|
iCRCResult = owCRC16.Calculate(aData, 0, 4);
|
||||||
|
|
||||||
|
// Assemble the CRC provided by the device
|
||||||
|
iMatchCRC = aData[6] << 8;
|
||||||
|
iMatchCRC |= aData[5];
|
||||||
|
iMatchCRC ^= 0xFFFF;
|
||||||
|
|
||||||
|
// Make sure the CRC values match
|
||||||
|
if (iCRCResult != iMatchCRC)
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the state data
|
||||||
|
State[0] = aData[3];
|
||||||
|
|
||||||
|
// Reset the data count
|
||||||
|
nDataCount = 0;
|
||||||
|
|
||||||
|
// Set the command
|
||||||
|
aData[nDataCount++] = READ_STATUS_COMMAND;
|
||||||
|
|
||||||
|
// Set the address to read
|
||||||
|
aData[nDataCount++] = 7;
|
||||||
|
aData[nDataCount++] = 0;
|
||||||
|
|
||||||
|
// Add data for the CRC
|
||||||
|
for (int i = 3; i < 6; i++)
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Send the data
|
||||||
|
owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC
|
||||||
|
iCRCResult = owCRC16.Calculate(aData, 0, 3);
|
||||||
|
|
||||||
|
// Assemble the CRC provided by the device
|
||||||
|
iMatchCRC = aData[5] << 8;
|
||||||
|
iMatchCRC |= aData[4];
|
||||||
|
iMatchCRC ^= 0xFFFF;
|
||||||
|
|
||||||
|
// Make sure the CRC values match
|
||||||
|
if (iCRCResult != iMatchCRC)
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store the state data
|
||||||
|
State[1] = aData[3];
|
||||||
|
|
||||||
|
return State;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteDevice(byte[] State)
|
||||||
|
{
|
||||||
|
short nResult; // Result of method calls
|
||||||
|
byte[] aData = new byte[30]; // Data buffer to send over the network
|
||||||
|
short nDataCount = 0; // How many bytes of data to send
|
||||||
|
int iCRCResult; // Result of the CRC calculation
|
||||||
|
int iMatchCRC; // CRC retrieved from the device
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Set the commmand to execute
|
||||||
|
aData[nDataCount++] = WRITE_STATUS_COMMAND;
|
||||||
|
|
||||||
|
// Set the address
|
||||||
|
aData[nDataCount++] = 0x07;
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Add the state
|
||||||
|
aData[nDataCount++] = State[1];
|
||||||
|
|
||||||
|
// Add bytes for the CRC result
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the data
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC
|
||||||
|
iCRCResult = owCRC16.Calculate(aData, 0, 3);
|
||||||
|
|
||||||
|
// Assemble the CRC provided by the device
|
||||||
|
iMatchCRC = aData[5] << 8;
|
||||||
|
iMatchCRC |= aData[4];
|
||||||
|
iMatchCRC ^= 0xFFFF;
|
||||||
|
|
||||||
|
// Make sure the CRC values match
|
||||||
|
if (iCRCResult != iMatchCRC)
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
76
owDeviceFamily1D.cs
Normal file
76
owDeviceFamily1D.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owDeviceFamily1D : owDevice
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public owDeviceFamily1D(owSession Session, short[] ID) : base(Session, ID)
|
||||||
|
{
|
||||||
|
// Just call the base constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public uint GetCounter(int CounterPage)
|
||||||
|
{
|
||||||
|
short nResult; // Result of method calls
|
||||||
|
byte[] aData = new byte[30]; // Data buffer to send over the network
|
||||||
|
short nDataCount = 0; // How many bytes of data to send
|
||||||
|
int iLastByte; // Address of the last byte in the requested page
|
||||||
|
uint iCounter = 0; // Counter value
|
||||||
|
int iCRCResult; // Result of the CRC calculation
|
||||||
|
int iMatchCRC; // CRC retrieved from the device
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Set the "read memory and counter" command into the data array
|
||||||
|
aData[nDataCount++] = 0xA5;
|
||||||
|
|
||||||
|
// Calculate the position of the last byte in the page
|
||||||
|
iLastByte = (CounterPage << 5) + 31;
|
||||||
|
|
||||||
|
// Copy the lower byte of the last byte into the data array
|
||||||
|
aData[nDataCount++] = (byte) (iLastByte & 0xFF);
|
||||||
|
|
||||||
|
// Copy the upper byte of the last byte into the data array
|
||||||
|
aData[nDataCount++] = (byte) (iLastByte >> 8);
|
||||||
|
|
||||||
|
// Add byte for the data byate, counter, zero bits, and CRC16 result
|
||||||
|
for (int i = 0; i < 11; i++) aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the block of data to the device
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC based on the data
|
||||||
|
iCRCResult = owCRC16.Calculate(aData, 0, 11);
|
||||||
|
|
||||||
|
// Assemble the CRC provided by the device
|
||||||
|
iMatchCRC = aData[13] << 8;
|
||||||
|
iMatchCRC |= aData[12];
|
||||||
|
iMatchCRC ^= 0xFFFF;
|
||||||
|
|
||||||
|
// Make sure the CRC values match
|
||||||
|
if (iCRCResult != iMatchCRC)
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assemble the counter data from the bytes retrieved
|
||||||
|
for (int i = nDataCount - 7; i >= nDataCount - 10; i--)
|
||||||
|
{
|
||||||
|
iCounter <<= 8;
|
||||||
|
iCounter |= aData[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return iCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
258
owDeviceFamily20.cs
Normal file
258
owDeviceFamily20.cs
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owDeviceFamily20 : owDevice
|
||||||
|
{
|
||||||
|
#region Member variables
|
||||||
|
|
||||||
|
byte[] m_aControl = new byte[16];
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Enumerations
|
||||||
|
|
||||||
|
public enum owDeviceFamily20Range : byte
|
||||||
|
{
|
||||||
|
Range_512 = 0x01,
|
||||||
|
Range_256 = 0x00
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum owDeviceFamily20Resolution : byte
|
||||||
|
{
|
||||||
|
EightBits = 0x08,
|
||||||
|
SixteenBits = 0x00
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public owDeviceFamily20(owSession Session, short[] ID) : base(Session, ID)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
short nResult; // Result of method calls
|
||||||
|
byte[] aData = new byte[30]; // Data buffer to send over the network
|
||||||
|
short nDataCount = 0; // How many bytes of data to send
|
||||||
|
int iIndex; // Loop index
|
||||||
|
int iStartAddress = 0x8; // Starting data page address
|
||||||
|
int iEndAddress = 0x11; // Ending data page address
|
||||||
|
int iCalculatedCRC; // CRC we calculated from sent data
|
||||||
|
int iSentCRC; // CRC retrieved from the device
|
||||||
|
|
||||||
|
// Setup the control page
|
||||||
|
for (iIndex = 0; iIndex < 8; iIndex += 2)
|
||||||
|
{
|
||||||
|
m_aControl[iIndex] = (byte) owDeviceFamily20Resolution.EightBits;
|
||||||
|
m_aControl[iIndex + 1] = (byte) owDeviceFamily20Range.Range_512;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the alarm page
|
||||||
|
for (iIndex = 8; iIndex < 16; iIndex++)
|
||||||
|
{
|
||||||
|
m_aControl[iIndex] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the command into the data array
|
||||||
|
aData[nDataCount++] = 0x55;
|
||||||
|
|
||||||
|
// Set the starting address of the data to write
|
||||||
|
aData[nDataCount++] = (byte) (iStartAddress & 0xFF);
|
||||||
|
aData[nDataCount++] = (byte) ((iStartAddress >> 8) & 0xFF);
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Write to the data pages specified
|
||||||
|
for (iIndex = iStartAddress; iIndex <= iEndAddress; iIndex++)
|
||||||
|
{
|
||||||
|
// Copy the control data into our output buffer
|
||||||
|
aData[nDataCount++] = m_aControl[iIndex - iStartAddress];
|
||||||
|
|
||||||
|
// Add two bytes for the CRC results
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Add a byte for the control byte echo
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the block
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// If the check byte doesn't match then throw an exception
|
||||||
|
if (aData[nDataCount - 1] != m_aControl[iIndex - iStartAddress])
|
||||||
|
{
|
||||||
|
// Throw an exception
|
||||||
|
throw new owException(owException.owExceptionFunction.SendBlock, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the CRC values
|
||||||
|
if (iIndex == iStartAddress)
|
||||||
|
{
|
||||||
|
// Calculate the CRC16 of the data sent
|
||||||
|
iCalculatedCRC = owCRC16.Calculate(aData, 0, 3);
|
||||||
|
|
||||||
|
// Reconstruct the CRC sent by the device
|
||||||
|
iSentCRC = aData[nDataCount - 2] << 8;
|
||||||
|
iSentCRC |= aData[nDataCount - 3];
|
||||||
|
iSentCRC ^= 0xFFFF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Calculate the CRC16 of the data sent
|
||||||
|
iCalculatedCRC = owCRC16.Calculate(m_aControl[iIndex - iStartAddress], iIndex);
|
||||||
|
|
||||||
|
// Reconstruct the CRC sent by the device
|
||||||
|
iSentCRC = aData[nDataCount - 2] << 8;
|
||||||
|
iSentCRC |= aData[nDataCount - 3];
|
||||||
|
iSentCRC ^= 0xFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the CRC doesn't match then throw an exception
|
||||||
|
if (iCalculatedCRC != iSentCRC)
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the byte count
|
||||||
|
nDataCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double[] GetVoltages()
|
||||||
|
{
|
||||||
|
short nResult; // Result of method calls
|
||||||
|
byte[] aData = new byte[30]; // Data buffer to send over the network
|
||||||
|
short nDataCount = 0; // How many bytes of data to send
|
||||||
|
int iCalculatedCRC; // CRC we calculated from sent data
|
||||||
|
int iSentCRC; // CRC retrieved from the device
|
||||||
|
short nTransmitByte; // Byte of data with the strong pull-up
|
||||||
|
short nCheckByte = 0; // Byte of data read to see if conversion is done
|
||||||
|
int iIndex; // Loop index
|
||||||
|
int iVoltageReadout; // Restructed voltage value from memory
|
||||||
|
double[] dVoltages = new double[4]; // Voltage values to return
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Set the convert command into the transmit buffer
|
||||||
|
aData[nDataCount++] = 0x3C;
|
||||||
|
|
||||||
|
// Set the input mask to get all channels
|
||||||
|
aData[nDataCount++] = 0x0F;
|
||||||
|
|
||||||
|
// Set the read-out control to leave things as they are
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Add two bytes for the CRC results
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the data block
|
||||||
|
owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC based on the transmit buffer
|
||||||
|
iCalculatedCRC = owCRC16.Calculate(aData, 0, 2);
|
||||||
|
|
||||||
|
// Reconstruct the CRC sent by the device
|
||||||
|
iSentCRC = aData[4] << 8;
|
||||||
|
iSentCRC |= aData[3];
|
||||||
|
iSentCRC ^= 0xFFFF;
|
||||||
|
|
||||||
|
// If the CRC doesn't match then throw an exception
|
||||||
|
if (iCalculatedCRC != iSentCRC)
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup for for power delivery after the next byte
|
||||||
|
nResult = owAdapter.SetLevel(TMEX.TMOneWireLevelOperation.Write, TMEX.TMOneWireLevelMode.StrongPullup, TMEX.TMOneWireLevelPrime.AfterNextByte);
|
||||||
|
|
||||||
|
nTransmitByte = (short) ((nDataCount - 1) & 0x1F);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Send the byte and start strong pullup
|
||||||
|
owAdapter.SendByte(nTransmitByte);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Stop the strong pullup
|
||||||
|
owAdapter.SetLevel(TMEX.TMOneWireLevelOperation.Write, TMEX.TMOneWireLevelMode.Normal, TMEX.TMOneWireLevelPrime.Immediate);
|
||||||
|
|
||||||
|
// Re-throw the exception
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sleep while the data is transfered
|
||||||
|
System.Threading.Thread.Sleep(6);
|
||||||
|
|
||||||
|
// Stop the strong pullup
|
||||||
|
nResult = owAdapter.SetLevel(TMEX.TMOneWireLevelOperation.Write, TMEX.TMOneWireLevelMode.Normal, TMEX.TMOneWireLevelPrime.Immediate);
|
||||||
|
|
||||||
|
// Read data to see if the conversion is over
|
||||||
|
nCheckByte = owAdapter.ReadByte();
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Reinitialize the data count
|
||||||
|
nDataCount = 0;
|
||||||
|
|
||||||
|
// Set the read command into the transmit buffer
|
||||||
|
aData[nDataCount++] = 0xAA;
|
||||||
|
|
||||||
|
// Set the address to get the conversion results
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Add 10 bytes to be read - 8 for the data and 2 for the CRC
|
||||||
|
for (iIndex = 0; iIndex < 10; iIndex++)
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the block to the device
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC of the transmitted data
|
||||||
|
iCalculatedCRC = owCRC16.Calculate(aData, 0, 10);
|
||||||
|
|
||||||
|
// Reconstruct the CRC sent by the device
|
||||||
|
iSentCRC = aData[nDataCount - 1] << 8;
|
||||||
|
iSentCRC |= aData[nDataCount - 2];
|
||||||
|
iSentCRC ^= 0xFFFF;
|
||||||
|
|
||||||
|
// If the CRC doesn't match then throw an exception
|
||||||
|
if (iCalculatedCRC != iSentCRC)
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the data into a double
|
||||||
|
for (iIndex = 3; iIndex < 11; iIndex += 2)
|
||||||
|
{
|
||||||
|
// Reconstruct the two bytes into the 16-bit values
|
||||||
|
iVoltageReadout = ((aData[iIndex + 1] << 8) | aData[iIndex]) & 0x0000FFFF;
|
||||||
|
|
||||||
|
// Figure out the percentage of the top voltage is present
|
||||||
|
dVoltages[(iIndex - 3) / 2] = iVoltageReadout / 65535.0;
|
||||||
|
|
||||||
|
// Apply the percentage to the maximum voltage range
|
||||||
|
dVoltages[(iIndex - 3) / 2] *= ((m_aControl[(iIndex - 3) + 1] & 0x01) == 0x01 ? 5.12 : 2.56);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dVoltages;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
277
owDeviceFamily26.cs
Normal file
277
owDeviceFamily26.cs
Normal file
@@ -0,0 +1,277 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owDeviceFamily26 : owDevice
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public owDeviceFamily26(owSession Session, short[] ID) : base(Session, ID)
|
||||||
|
{
|
||||||
|
// Just call the base constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public enum VoltageType : short
|
||||||
|
{
|
||||||
|
Supply,
|
||||||
|
Output
|
||||||
|
}
|
||||||
|
|
||||||
|
private double GetVoltage(VoltageType Type)
|
||||||
|
{
|
||||||
|
short nResult; // Result of method calls
|
||||||
|
byte[] aData = new byte[30]; // Data buffer to send over the network
|
||||||
|
short nDataCount = 0; // How many bytes of data to send
|
||||||
|
short nCRC; // Result of the CRC check
|
||||||
|
int iIndex;
|
||||||
|
short nBusy;
|
||||||
|
double dVoltage;
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Set the command to recall the status/configuration page to the scratchpad
|
||||||
|
aData[nDataCount++] = 0xB8;
|
||||||
|
|
||||||
|
// Set the page number to recall
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Send the data block
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Clear the data count
|
||||||
|
nDataCount = 0;
|
||||||
|
|
||||||
|
// Access the device we want to talk to
|
||||||
|
owAdapter.Access();
|
||||||
|
|
||||||
|
// Set the command to read the scratchpad
|
||||||
|
aData[nDataCount++] = 0xBE;
|
||||||
|
|
||||||
|
// Set the page number to read
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Add 9 bytes to be read - 8 for the data and 1 for the CRC
|
||||||
|
for (iIndex = 0; iIndex < 9; iIndex++)
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the data block
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC of the scratchpad data
|
||||||
|
nCRC = owCRC8.Calculate(aData, 2, 9);
|
||||||
|
|
||||||
|
// If the CRC doesn't match then throw an exception
|
||||||
|
if (nCRC != aData[10])
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO - Check if we really need to change the input selector
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
// Access the device we want to talk to
|
||||||
|
owAdapter.Access();
|
||||||
|
|
||||||
|
// Reset the data count
|
||||||
|
nDataCount = 0;
|
||||||
|
|
||||||
|
// Set the command to write the scratchpad
|
||||||
|
aData[nDataCount++] = 0x4E;
|
||||||
|
|
||||||
|
// Set the page number to write
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Set or clear the AD bit based on the type requested
|
||||||
|
if (Type == VoltageType.Supply)
|
||||||
|
aData[nDataCount++] = (byte) (aData[2] | 0x08);
|
||||||
|
else
|
||||||
|
aData[nDataCount++] = (byte) (aData[2] & 0xF7);
|
||||||
|
|
||||||
|
// Move the existing data down in the array
|
||||||
|
for (iIndex = 0; iIndex < 7; iIndex++)
|
||||||
|
aData[nDataCount++] = aData[iIndex + 4];
|
||||||
|
|
||||||
|
// Send the data block
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Reset the data count
|
||||||
|
nDataCount = 0;
|
||||||
|
|
||||||
|
// Access the device we want to talk to
|
||||||
|
owAdapter.Access();
|
||||||
|
|
||||||
|
// Set the command to copy the scratchpad
|
||||||
|
aData[nDataCount++] = 0x48;
|
||||||
|
|
||||||
|
// Set the page number to copy to
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Send the data block
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Loop until the data copy is complete
|
||||||
|
do
|
||||||
|
{
|
||||||
|
nBusy = owAdapter.ReadByte();
|
||||||
|
}
|
||||||
|
while (nBusy == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Access the device we want to talk to
|
||||||
|
owAdapter.Access();
|
||||||
|
|
||||||
|
// Send the voltage conversion command
|
||||||
|
owAdapter.SendByte(0xB4);
|
||||||
|
|
||||||
|
// Loop until conversion is complete
|
||||||
|
do
|
||||||
|
{
|
||||||
|
nBusy = owAdapter.ReadByte();
|
||||||
|
}
|
||||||
|
while (nBusy == 0);
|
||||||
|
|
||||||
|
// Clear the data count
|
||||||
|
nDataCount = 0;
|
||||||
|
|
||||||
|
// Set the command to recall the status/configuration page to the scratchpad
|
||||||
|
aData[nDataCount++] = 0xB8;
|
||||||
|
|
||||||
|
// Set the page number to recall
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Access the device we want to talk to
|
||||||
|
owAdapter.Access();
|
||||||
|
|
||||||
|
// Send the data block
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Clear the data count
|
||||||
|
nDataCount = 0;
|
||||||
|
|
||||||
|
// Access the device we want to talk to
|
||||||
|
owAdapter.Access();
|
||||||
|
|
||||||
|
// Set the command to read the scratchpad
|
||||||
|
aData[nDataCount++] = 0xBE;
|
||||||
|
|
||||||
|
// Set the page number to read
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Add 9 bytes to be read - 8 for the data and 1 for the CRC
|
||||||
|
for (iIndex = 0; iIndex < 9; iIndex++)
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the data block
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC of the scratchpad data
|
||||||
|
nCRC = owCRC8.Calculate(aData, 2, 9);
|
||||||
|
|
||||||
|
// If the CRC doesn't match then throw an exception
|
||||||
|
if (nCRC != aData[10])
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assemble the voltage data
|
||||||
|
dVoltage = (double) ((aData[6] << 8) | aData[5]);
|
||||||
|
|
||||||
|
return dVoltage / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double GetSupplyVoltage()
|
||||||
|
{
|
||||||
|
return GetVoltage(VoltageType.Supply);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double GetOutputVoltage()
|
||||||
|
{
|
||||||
|
|
||||||
|
return GetVoltage(VoltageType.Output);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double GetTemperature()
|
||||||
|
{
|
||||||
|
short nResult; // Result of method calls
|
||||||
|
byte[] aData = new byte[30]; // Data buffer to send over the network
|
||||||
|
short nDataCount = 0; // How many bytes of data to send
|
||||||
|
short nCRC; // Result of the CRC check
|
||||||
|
int iTemperatureLSB; // The LSB of the temperature data
|
||||||
|
int iTemperatureMSB; // The MSB of the temperature data
|
||||||
|
int iTemperature; // Complete temperature data
|
||||||
|
double dTemperature; // double version of the temperature
|
||||||
|
|
||||||
|
// Select and access the ID of the device we want to talk to
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Send the conversion command byte
|
||||||
|
owAdapter.SendByte(0x44);
|
||||||
|
|
||||||
|
// Sleep while the data is converted
|
||||||
|
System.Threading.Thread.Sleep(10);
|
||||||
|
|
||||||
|
// Access the device we want to talk to
|
||||||
|
owAdapter.Access();
|
||||||
|
|
||||||
|
// Set the command to recall the status/configuration page to the scratchpad
|
||||||
|
aData[nDataCount++] = 0xB8;
|
||||||
|
|
||||||
|
// Set the page number to recall
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Send the data block
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Clear the data count
|
||||||
|
nDataCount = 0;
|
||||||
|
|
||||||
|
// Access the device we want to talk to
|
||||||
|
owAdapter.Access();
|
||||||
|
|
||||||
|
// Set the command to read the scratchpad
|
||||||
|
aData[nDataCount++] = 0xBE;
|
||||||
|
|
||||||
|
// Set the page number to read
|
||||||
|
aData[nDataCount++] = 0x00;
|
||||||
|
|
||||||
|
// Add 9 bytes to be read - 8 for the data and 1 for the CRC
|
||||||
|
for (int iIndex = 0; iIndex < 9; iIndex++)
|
||||||
|
aData[nDataCount++] = 0xFF;
|
||||||
|
|
||||||
|
// Send the data block
|
||||||
|
nResult = owAdapter.SendBlock(aData, nDataCount);
|
||||||
|
|
||||||
|
// Calculate the CRC of the scratchpad data
|
||||||
|
nCRC = owCRC8.Calculate(aData, 2, 9);
|
||||||
|
|
||||||
|
// If the CRC doesn't match then throw an exception
|
||||||
|
if (nCRC != aData[10])
|
||||||
|
{
|
||||||
|
// Throw a CRC exception
|
||||||
|
throw new owException(owException.owExceptionFunction.CRC, _deviceID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the two bytes of temperature data
|
||||||
|
iTemperatureLSB = aData[3];
|
||||||
|
iTemperatureMSB = aData[4];
|
||||||
|
|
||||||
|
// Shift the data into the right order
|
||||||
|
iTemperature = ((iTemperatureMSB << 8) | iTemperatureLSB) >> 3;
|
||||||
|
|
||||||
|
// Figure out the temperature
|
||||||
|
dTemperature = iTemperature * 0.03125F;
|
||||||
|
|
||||||
|
// Return the temperature
|
||||||
|
return dTemperature;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
172
owDeviceFamilyFF.cs
Normal file
172
owDeviceFamilyFF.cs
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owDeviceFamilyFF : owDevice
|
||||||
|
{
|
||||||
|
#region Member variables
|
||||||
|
|
||||||
|
private int m_iWidth = 20;
|
||||||
|
private int m_iHeight = 4;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public owDeviceFamilyFF(owSession Session, short[] ID) : base(Session, ID)
|
||||||
|
{
|
||||||
|
// Just call the base constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public void SetBackLight(bool State)
|
||||||
|
{
|
||||||
|
// Select the device
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Set the state of the backlight
|
||||||
|
owAdapter.SendByte((short) (State ? 0x8 : 0x7));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetText(string Text)
|
||||||
|
{
|
||||||
|
string[] sLines = null; // Array of lines
|
||||||
|
int iLine = 1; // Line number
|
||||||
|
|
||||||
|
// Replace any CRLF pairs with just a newline
|
||||||
|
Text = Text.Replace("\r\n", "\n");
|
||||||
|
|
||||||
|
// Split the input string at any newlines
|
||||||
|
sLines = Text.Split("\n".ToCharArray(), m_iHeight);
|
||||||
|
|
||||||
|
// Loop over each line
|
||||||
|
foreach (string sLine in sLines)
|
||||||
|
{
|
||||||
|
// Set the text of this line
|
||||||
|
SetText(sLine, iLine++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetText(string Text, int Line)
|
||||||
|
{
|
||||||
|
short nMemoryPosition = 0x00; // Position at which to write the new string data
|
||||||
|
string sSendData = ""; // String data to send
|
||||||
|
byte[] baData; // Byte array of data to send
|
||||||
|
short nDataCount = 0; // Amount of data to send
|
||||||
|
|
||||||
|
// Figure out the initial memory position based on the line number
|
||||||
|
switch (Line)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
nMemoryPosition = 0x00;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
nMemoryPosition = 0x40;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
nMemoryPosition = 0x14;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
nMemoryPosition = 0x54;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pad the text to the right width
|
||||||
|
Text = Text.PadRight(m_iWidth);
|
||||||
|
|
||||||
|
// The scratchpad is only 16 bytes long so we need to split it up
|
||||||
|
if (m_iWidth > 16)
|
||||||
|
{
|
||||||
|
// Select the device
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Set the data block to just the first 16 characters
|
||||||
|
sSendData = Text.Substring(0, 16);
|
||||||
|
|
||||||
|
// Initialize the data array
|
||||||
|
baData = new byte[18];
|
||||||
|
|
||||||
|
// Set the command to write to the scratchpad
|
||||||
|
baData[nDataCount++] = 0x4E;
|
||||||
|
|
||||||
|
// Set the memory position
|
||||||
|
baData[nDataCount++] = (byte) nMemoryPosition;
|
||||||
|
|
||||||
|
// Add the text data to the data
|
||||||
|
foreach (byte bChar in System.Text.Encoding.Default.GetBytes(sSendData))
|
||||||
|
baData[nDataCount++] = bChar;
|
||||||
|
|
||||||
|
// Set the block
|
||||||
|
owAdapter.SendBlock(baData, nDataCount);
|
||||||
|
|
||||||
|
// Select the device
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Send the scratchpad data to the LCD
|
||||||
|
owAdapter.SendByte(0x48);
|
||||||
|
|
||||||
|
// Reset the device
|
||||||
|
owAdapter.Reset();
|
||||||
|
|
||||||
|
// Increment the memory position
|
||||||
|
nMemoryPosition += 16;
|
||||||
|
|
||||||
|
// Set the data to the rest of the line
|
||||||
|
sSendData = Text.Substring(16, m_iWidth - 16);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Just set the data string to whatever was passed in
|
||||||
|
sSendData = Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Select the device
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Initialize the data array
|
||||||
|
baData = new byte[18];
|
||||||
|
|
||||||
|
// Reset the data count
|
||||||
|
nDataCount = 0;
|
||||||
|
|
||||||
|
// Set the command to write to the scratchpad
|
||||||
|
baData[nDataCount++] = 0x4E;
|
||||||
|
|
||||||
|
// Set the memory position
|
||||||
|
baData[nDataCount++] = (byte) nMemoryPosition;
|
||||||
|
|
||||||
|
// Add the text data to the data
|
||||||
|
foreach (byte bChar in System.Text.Encoding.Default.GetBytes(sSendData))
|
||||||
|
baData[nDataCount++] = bChar;
|
||||||
|
|
||||||
|
// Set the block
|
||||||
|
owAdapter.SendBlock(baData, nDataCount);
|
||||||
|
|
||||||
|
// Select the device
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Send the scratchpad data to the LCD
|
||||||
|
owAdapter.SendByte(0x48);
|
||||||
|
|
||||||
|
// Reset the device
|
||||||
|
owAdapter.Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
// Select the device
|
||||||
|
owAdapter.Select(_deviceID);
|
||||||
|
|
||||||
|
// Clear the display
|
||||||
|
owAdapter.SendByte(0x49);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
106
owException.cs
Normal file
106
owException.cs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class owException : Exception
|
||||||
|
{
|
||||||
|
#region Enumerations
|
||||||
|
|
||||||
|
public enum owExceptionFunction
|
||||||
|
{
|
||||||
|
Access,
|
||||||
|
CRC,
|
||||||
|
ReadBit,
|
||||||
|
ReadByte,
|
||||||
|
Select,
|
||||||
|
SendBit,
|
||||||
|
SendBlock,
|
||||||
|
SendByte,
|
||||||
|
SetLevel
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private member variables
|
||||||
|
|
||||||
|
private readonly int _errorNumber;
|
||||||
|
private readonly owExceptionFunction _errorFunction;
|
||||||
|
private readonly owIdentifier _deviceID;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public owException(owExceptionFunction function, int number)
|
||||||
|
{
|
||||||
|
// Store the exception function
|
||||||
|
_errorFunction = function;
|
||||||
|
|
||||||
|
// Store the exception number
|
||||||
|
_errorNumber = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
public owException(owExceptionFunction function, owIdentifier deviceID)
|
||||||
|
{
|
||||||
|
// Store the exception function
|
||||||
|
_errorFunction = function;
|
||||||
|
|
||||||
|
// Store the device ID
|
||||||
|
_deviceID = deviceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public owException(owExceptionFunction function, owIdentifier deviceID, int number)
|
||||||
|
{
|
||||||
|
// Store the exception function
|
||||||
|
_errorFunction = function;
|
||||||
|
|
||||||
|
// Store the device ID
|
||||||
|
_deviceID = deviceID;
|
||||||
|
|
||||||
|
// Store the exception number
|
||||||
|
_errorNumber = number;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public owIdentifier DeviceID
|
||||||
|
{
|
||||||
|
get { return _deviceID; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public owExceptionFunction Function
|
||||||
|
{
|
||||||
|
get { return _errorFunction; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Message
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (_errorFunction)
|
||||||
|
{
|
||||||
|
case owExceptionFunction.Access: return "Unable to access device";
|
||||||
|
case owExceptionFunction.CRC: return "CRC mismatch";
|
||||||
|
case owExceptionFunction.ReadBit: return "Error reading bit";
|
||||||
|
case owExceptionFunction.ReadByte: return "Error reading byte";
|
||||||
|
case owExceptionFunction.Select: return "Unable to select device";
|
||||||
|
case owExceptionFunction.SendBit: return "Error sending bit";
|
||||||
|
case owExceptionFunction.SendBlock: return "Error sending block";
|
||||||
|
case owExceptionFunction.SendByte: return "Error sending byte";
|
||||||
|
case owExceptionFunction.SetLevel: return "Error setting level";
|
||||||
|
default: return "Unknown error in function" + _errorFunction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Number
|
||||||
|
{
|
||||||
|
get { return _errorNumber; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
101
owIdentifer.cs
Normal file
101
owIdentifer.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using System;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owIdentifier
|
||||||
|
{
|
||||||
|
#region Member variables
|
||||||
|
|
||||||
|
private readonly short[] _rawID; // The raw ID array
|
||||||
|
private readonly string _friendlyName; // Friendly display name
|
||||||
|
private readonly int _familyCode; // Family code
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public owIdentifier()
|
||||||
|
{
|
||||||
|
// Create a blank ID
|
||||||
|
_rawID = new short[8];
|
||||||
|
}
|
||||||
|
|
||||||
|
public owIdentifier(byte[] deviceID)
|
||||||
|
{
|
||||||
|
// Create a blank ID
|
||||||
|
_rawID = new short[8];
|
||||||
|
|
||||||
|
// Copy the byte array to the short array
|
||||||
|
for (int i = 0; i < deviceID.Length; i++)
|
||||||
|
_rawID[i] = deviceID[i];
|
||||||
|
|
||||||
|
// Get the friendly name
|
||||||
|
_friendlyName = ConvertToString(_rawID);
|
||||||
|
|
||||||
|
// Get the family code
|
||||||
|
_familyCode = _rawID[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public owIdentifier(short[] deviceID)
|
||||||
|
{
|
||||||
|
// Store the ID supplied
|
||||||
|
_rawID = deviceID;
|
||||||
|
|
||||||
|
// Get the friendly name
|
||||||
|
_friendlyName = ConvertToString(_rawID);
|
||||||
|
|
||||||
|
// Get the family code
|
||||||
|
_familyCode = _rawID[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private methods
|
||||||
|
|
||||||
|
private static string ConvertToString(short[] rawID)
|
||||||
|
{
|
||||||
|
StringBuilder friendlyID = new StringBuilder();
|
||||||
|
|
||||||
|
// Loop backwards over the ID array
|
||||||
|
for (int iIndex = rawID.Length - 1; iIndex >= 0; iIndex--)
|
||||||
|
{
|
||||||
|
// Convert the short value into a hex string and append it to the ID string
|
||||||
|
friendlyID.AppendFormat("{0:X2}", rawID[iIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the ID string
|
||||||
|
return friendlyID.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public short[] RawID
|
||||||
|
{
|
||||||
|
get { return _rawID; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return _friendlyName; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Family
|
||||||
|
{
|
||||||
|
get { return _familyCode; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return _friendlyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
136
owNetwork.cs
Normal file
136
owNetwork.cs
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owNetwork
|
||||||
|
{
|
||||||
|
#region Member variables
|
||||||
|
|
||||||
|
private owSession _session; // Current session
|
||||||
|
private Dictionary<string, owDevice> _deviceList; // List of current devices
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public owNetwork(owSession Session)
|
||||||
|
{
|
||||||
|
_session = Session;
|
||||||
|
|
||||||
|
_deviceList = new Dictionary<string, owDevice>();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Delegates
|
||||||
|
|
||||||
|
public delegate void DeviceEventDelegate(owDevice device);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
|
||||||
|
public event DeviceEventDelegate DeviceAdded;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private methods
|
||||||
|
|
||||||
|
private void LoadDevices()
|
||||||
|
{
|
||||||
|
owDevice device; // Current device object
|
||||||
|
|
||||||
|
// Get the first device on the network
|
||||||
|
short nResult = TMEX.TMFirst(_session.SessionHandle, _session.StateBuffer);
|
||||||
|
|
||||||
|
// Keep looping while we get good device data
|
||||||
|
while (nResult == 1)
|
||||||
|
{
|
||||||
|
// Create a new device ID buffer
|
||||||
|
short[] nROM = new short[8];
|
||||||
|
|
||||||
|
// Get the ROM from the device
|
||||||
|
nResult = TMEX.TMRom(_session.SessionHandle, _session.StateBuffer, nROM);
|
||||||
|
|
||||||
|
// If the ROM was read correctly then add the device to the list
|
||||||
|
if (nResult == 1)
|
||||||
|
{
|
||||||
|
// Get the deviceID
|
||||||
|
owIdentifier deviceID = new owIdentifier(nROM);
|
||||||
|
|
||||||
|
// Create a new device object
|
||||||
|
switch (deviceID.Family)
|
||||||
|
{
|
||||||
|
case 0x10:
|
||||||
|
device = new owDeviceFamily10(_session, nROM);
|
||||||
|
break;
|
||||||
|
case 0x1D:
|
||||||
|
device = new owDeviceFamily1D(_session, nROM);
|
||||||
|
break;
|
||||||
|
case 0x20:
|
||||||
|
device = new owDeviceFamily20(_session, nROM);
|
||||||
|
break;
|
||||||
|
case 0x26:
|
||||||
|
device = new owDeviceFamily26(_session, nROM);
|
||||||
|
break;
|
||||||
|
case 0x12:
|
||||||
|
device = new owDeviceFamily12(_session, nROM);
|
||||||
|
break;
|
||||||
|
case 0xFF:
|
||||||
|
device = new owDeviceFamilyFF(_session, nROM);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
device = new owDevice(_session, nROM);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we've seen this device before
|
||||||
|
if (!_deviceList.ContainsKey(device.ID.Name))
|
||||||
|
{
|
||||||
|
// Add the device to the device list
|
||||||
|
_deviceList[device.ID.Name] = device;
|
||||||
|
|
||||||
|
// Raise the device added event
|
||||||
|
if (DeviceAdded != null)
|
||||||
|
DeviceAdded(device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to get the next device
|
||||||
|
nResult = TMEX.TMNext(_session.SessionHandle, _session.StateBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public Dictionary<string, owDevice> Devices
|
||||||
|
{
|
||||||
|
get { return _deviceList; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Public methods
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
// Load the device list
|
||||||
|
LoadDevices();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Terminate()
|
||||||
|
{
|
||||||
|
// Get rid of the device list
|
||||||
|
_deviceList.Clear();
|
||||||
|
_deviceList = null;
|
||||||
|
|
||||||
|
// Get rid of the session
|
||||||
|
_session = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
156
owSession.cs
Normal file
156
owSession.cs
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
using Common.Debug;
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace OneWireAPI
|
||||||
|
{
|
||||||
|
public class owSession
|
||||||
|
{
|
||||||
|
#region Member variables
|
||||||
|
|
||||||
|
private int _sessionHandle; // Session handle
|
||||||
|
private owNetwork _network; // Network object
|
||||||
|
|
||||||
|
private readonly short _portNumber; // Port number
|
||||||
|
private readonly short _portType; // Port type
|
||||||
|
private readonly byte[] _stateBuffer; // Global state buffer
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public owSession()
|
||||||
|
{
|
||||||
|
// Create the global state buffer
|
||||||
|
_stateBuffer = new byte[(int) TMEX.TMStateBufferSize.NoEPROMWriting];
|
||||||
|
|
||||||
|
// Get the default port number and type from the system
|
||||||
|
short result = TMEX.TMReadDefaultPort(out _portNumber, out _portType);
|
||||||
|
|
||||||
|
Tracer.WriteLine("TMReadDefaultPort - Return: {0}, Port Number: {1}, Port Type: {2}", result, _portNumber, _portType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public owSession(short PortNumber, short PortType)
|
||||||
|
{
|
||||||
|
// Create the global state buffer
|
||||||
|
_stateBuffer = new byte[(int) TMEX.TMStateBufferSize.NoEPROMWriting];
|
||||||
|
|
||||||
|
// Store the port number and type specified
|
||||||
|
_portNumber = PortNumber;
|
||||||
|
_portType = PortType;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public short PortNumber
|
||||||
|
{
|
||||||
|
get { return _portNumber; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public short PortType
|
||||||
|
{
|
||||||
|
get { return _portType; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SessionHandle
|
||||||
|
{
|
||||||
|
get { return _sessionHandle; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public owNetwork Network
|
||||||
|
{
|
||||||
|
get { return _network; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] StateBuffer
|
||||||
|
{
|
||||||
|
get { return _stateBuffer; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
public bool Acquire()
|
||||||
|
{
|
||||||
|
// Create a byte array to hold the version information
|
||||||
|
byte[] version = new byte[80];
|
||||||
|
|
||||||
|
// Get the version
|
||||||
|
TMEX.Get_Version(version);
|
||||||
|
|
||||||
|
// Decode the version
|
||||||
|
string sVersion = System.Text.Encoding.Default.GetString(version, 0, version.Length);
|
||||||
|
|
||||||
|
// Strip everything up to the first null character
|
||||||
|
sVersion = sVersion.Substring(0, sVersion.IndexOf("\0"));
|
||||||
|
|
||||||
|
Tracer.WriteLine("Version: {0}", sVersion);
|
||||||
|
|
||||||
|
Tracer.WriteLine("Starting Aquire");
|
||||||
|
|
||||||
|
// Start a session on the port
|
||||||
|
_sessionHandle = TMEX.TMExtendedStartSession(_portNumber, _portType, IntPtr.Zero);
|
||||||
|
|
||||||
|
Tracer.WriteLine("TMExtendedStartSession - Return: {0}", _sessionHandle);
|
||||||
|
|
||||||
|
// If we didn't get a session then throw an error
|
||||||
|
if (_sessionHandle <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Setup the port for the current session
|
||||||
|
short result = TMEX.TMSetup(_sessionHandle);
|
||||||
|
|
||||||
|
Tracer.WriteLine("TMSetup - Return: {0}", result);
|
||||||
|
|
||||||
|
// Check the result
|
||||||
|
if (result != 1)
|
||||||
|
{
|
||||||
|
// Release the session
|
||||||
|
Release();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the network object and pass ourself as the session
|
||||||
|
_network = new owNetwork(this);
|
||||||
|
|
||||||
|
// Initialize the network
|
||||||
|
_network.Initialize();
|
||||||
|
|
||||||
|
// Initialize the static adapter code with the session
|
||||||
|
owAdapter.Initialize(this);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Release()
|
||||||
|
{
|
||||||
|
Tracer.WriteLine("Starting Release");
|
||||||
|
|
||||||
|
// Terminate the network
|
||||||
|
if (_network != null)
|
||||||
|
{
|
||||||
|
_network.Terminate();
|
||||||
|
_network = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the session
|
||||||
|
short result = TMEX.TMClose(_sessionHandle);
|
||||||
|
|
||||||
|
Tracer.WriteLine("TMClose - Return: {0}", result);
|
||||||
|
|
||||||
|
// End the session
|
||||||
|
result = TMEX.TMEndSession(_sessionHandle);
|
||||||
|
|
||||||
|
Tracer.WriteLine("TMEndSession - Return: {0}", result);
|
||||||
|
|
||||||
|
// Clear the session variable
|
||||||
|
_sessionHandle = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
5
packages.config
Normal file
5
packages.config
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
<package id="Microsoft.Bcl" version="1.1.8" targetFramework="net40" />
|
||||||
|
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net40" />
|
||||||
|
</packages>
|
||||||
118
packages/Microsoft.Bcl.1.1.8/License-Stable.rtf
vendored
Normal file
118
packages/Microsoft.Bcl.1.1.8/License-Stable.rtf
vendored
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Tahoma;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Calibri;}{\f3\fnil\fcharset0 Calibri;}{\f4\fnil\fcharset2 Symbol;}}
|
||||||
|
{\colortbl ;\red31\green73\blue125;\red0\green0\blue255;}
|
||||||
|
{\*\listtable
|
||||||
|
{\list\listhybrid
|
||||||
|
{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx360}
|
||||||
|
{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}
|
||||||
|
{\listlevel\levelnfc2\leveljc0\levelstartat1{\leveltext\'02\'02.;}{\levelnumbers\'01;}\jclisttab\tx720}\listid1 }
|
||||||
|
{\list\listhybrid
|
||||||
|
{\listlevel\levelnfc0\leveljc0\levelstartat1{\leveltext\'02\'00.;}{\levelnumbers\'01;}\jclisttab\tx363}
|
||||||
|
{\listlevel\levelnfc4\leveljc0\levelstartat1{\leveltext\'02\'01.;}{\levelnumbers\'01;}\jclisttab\tx363}\listid2 }}
|
||||||
|
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}}
|
||||||
|
{\stylesheet{ Normal;}{\s1 heading 1;}{\s2 heading 2;}{\s3 heading 3;}}
|
||||||
|
{\*\generator Riched20 6.2.9200}\viewkind4\uc1
|
||||||
|
\pard\nowidctlpar\sb120\sa120\b\f0\fs24 MICROSOFT SOFTWARE LICENSE TERMS\par
|
||||||
|
|
||||||
|
\pard\brdrb\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 MICROSOFT .NET LIBRARY \par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\sb120\sa120\fs19 These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its affiliates) and you. Please read them. They apply to the software named above, which includes the media on which you received it, if any. The terms also apply to any Microsoft\par
|
||||||
|
|
||||||
|
\pard{\pntext\f4\'B7\tab}{\*\pn\pnlvlblt\pnf4\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120\b0 updates,\par
|
||||||
|
{\pntext\f4\'B7\tab}supplements,\par
|
||||||
|
{\pntext\f4\'B7\tab}Internet-based services, and\par
|
||||||
|
{\pntext\f4\'B7\tab}support services\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\sb120\sa120\b for this software, unless other terms accompany those items. If so, those terms apply.\par
|
||||||
|
BY USING THE SOFTWARE, YOU ACCEPT THESE TERMS. IF YOU DO NOT ACCEPT THEM, DO NOT USE THE SOFTWARE.\par
|
||||||
|
|
||||||
|
\pard\brdrt\brdrs\brdrw10\brsp20 \nowidctlpar\sb120\sa120 IF YOU COMPLY WITH THESE LICENSE TERMS, YOU HAVE THE PERPETUAL RIGHTS BELOW.\par
|
||||||
|
|
||||||
|
\pard
|
||||||
|
{\listtext\f0 1.\tab}\jclisttab\tx360\ls1\nowidctlpar\s1\fi-357\li357\sb120\sa120 INSTALLATION AND USE RIGHTS. \par
|
||||||
|
|
||||||
|
\pard
|
||||||
|
{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\s2\fi-363\li720\sb120\sa120 Installation and Use.\b0\fs20 You may install and use any number of copies of the software to design, develop and test your programs.\par
|
||||||
|
{\listtext\f0 b.\tab}\b\fs19 Third Party Programs.\b0\fs20 The software may include third party programs that Microsoft, not the third party, licenses to you under this agreement. Notices, if any, for the third party program are included for your information only.\b\fs19\par
|
||||||
|
|
||||||
|
\pard
|
||||||
|
{\listtext\f0 2.\tab}\jclisttab\tx360\ls1\nowidctlpar\s1\fi-357\li357\sb120\sa120\fs20 ADDITIONAL LICENSING REQUIREMENTS AND/OR USE RIGHTS.\par
|
||||||
|
|
||||||
|
\pard
|
||||||
|
{\listtext\f0 a.\tab}\jclisttab\tx363\ls1\ilvl1\nowidctlpar\s2\fi-363\li720\sb120\sa120 DISTRIBUTABLE CODE.\~ \b0 The software is comprised of Distributable Code. \f1\ldblquote\f0 Distributable Code\f1\rdblquote\f0 is code that you are permitted to distribute in programs you develop if you comply with the terms below.\b\par
|
||||||
|
|
||||||
|
\pard
|
||||||
|
{\listtext\f0 i.\tab}\jclisttab\tx720\ls1\ilvl2\nowidctlpar\s3\fi-357\li1077\sb120\sa120\tx1077 Right to Use and Distribute. \par
|
||||||
|
|
||||||
|
\pard{\pntext\f4\'B7\tab}{\*\pn\pnlvlblt\pnf4\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 You may copy and distribute the object code form of the software.\par
|
||||||
|
{\pntext\f4\'B7\tab}Third Party Distribution. You may permit distributors of your programs to copy and distribute the Distributable Code as part of those programs.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\s3\fi-357\li1077\sb120\sa120\tx1077\b ii.\tab Distribution Requirements.\b0 \b For any Distributable Code you distribute, you must\par
|
||||||
|
|
||||||
|
\pard{\pntext\f4\'B7\tab}{\*\pn\pnlvlblt\pnf4\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 add significant primary functionality to it in your programs;\par
|
||||||
|
{\pntext\f4\'B7\tab}require distributors and external end users to agree to terms that protect it at least as much as this agreement;\par
|
||||||
|
{\pntext\f4\'B7\tab}display your valid copyright notice on your programs; and\par
|
||||||
|
{\pntext\f4\'B7\tab}indemnify, defend, and hold harmless Microsoft from any claims, including attorneys\rquote fees, related to the distribution or use of your programs.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\s3\fi-357\li1077\sb120\sa120\tx1077\b iii.\tab Distribution Restrictions.\b0 \b You may not\par
|
||||||
|
|
||||||
|
\pard{\pntext\f4\'B7\tab}{\*\pn\pnlvlblt\pnf4\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-357\li1434\sb120\sa120\b0 alter any copyright, trademark or patent notice in the Distributable Code;\par
|
||||||
|
{\pntext\f4\'B7\tab}use Microsoft\rquote s trademarks in your programs\rquote names or in a way that suggests your programs come from or are endorsed by Microsoft;\par
|
||||||
|
{\pntext\f4\'B7\tab}include Distributable Code in malicious, deceptive or unlawful programs; or\par
|
||||||
|
{\pntext\f4\'B7\tab}modify or distribute the source code of any Distributable Code so that any part of it becomes subject to an Excluded License. An Excluded License is one that requires, as a condition of use, modification or distribution, that\par
|
||||||
|
|
||||||
|
\pard{\pntext\f4\'B7\tab}{\*\pn\pnlvlblt\pnf4\pnindent360{\pntxtb\'B7}}\nowidctlpar\fi-358\li1792\sb120\sa120 the code be disclosed or distributed in source code form; or\cf1\f2\par
|
||||||
|
{\pntext\f4\'B7\tab}\cf0\f0 others have the right to modify it.\cf1\f2\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\s1\fi-357\li357\sb120\sa120\cf0\b\f0 3.\tab\fs19 SCOPE OF LICENSE. \b0 The software is licensed, not sold. This agreement only gives you some rights to use the software. Microsoft reserves all other rights. Unless applicable law gives you more rights despite this limitation, you may use the software only as expressly permitted in this agreement. In doing so, you must comply with any technical limitations in the software that only allow you to use it in certain ways. You may not\par
|
||||||
|
|
||||||
|
\pard{\pntext\f4\'B7\tab}{\*\pn\pnlvlblt\pnf4\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 work around any technical limitations in the software;\par
|
||||||
|
{\pntext\f4\'B7\tab}reverse engineer, decompile or disassemble the software, except and only to the extent that applicable law expressly permits, despite this limitation;\par
|
||||||
|
{\pntext\f4\'B7\tab}publish the software for others to copy;\par
|
||||||
|
{\pntext\f4\'B7\tab}rent, lease or lend the software;\par
|
||||||
|
{\pntext\f4\'B7\tab}transfer the software or this agreement to any third party; or\par
|
||||||
|
{\pntext\f4\'B7\tab}use the software for commercial software hosting services.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\s1\fi-357\li357\sb120\sa120\b\fs20 4.\tab\fs19 BACKUP COPY. \b0 You may make one backup copy of the software. You may use it only to reinstall the software.\par
|
||||||
|
\b\fs20 5.\tab\fs19 DOCUMENTATION. \b0 Any person that has valid access to your computer or internal network may copy and use the documentation for your internal, reference purposes.\par
|
||||||
|
\b\fs20 6.\tab\fs19 EXPORT RESTRICTIONS. \b0 The software is subject to United States export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the software. These laws include restrictions on destinations, end users and end use. For additional information, see {\cf2\ul\fs20{\field{\*\fldinst{HYPERLINK www.microsoft.com/exporting }}{\fldrslt{www.microsoft.com/exporting}}}}\f0\fs19 .\cf2\ul\fs20\par
|
||||||
|
\cf0\ulnone\b 7.\tab\fs19 SUPPORT SERVICES. \b0 Because this software is \ldblquote as is,\rdblquote we may not provide support services for it.\par
|
||||||
|
\b\fs20 8.\tab\fs19 ENTIRE AGREEMENT. \b0 This agreement, and the terms for supplements, updates, Internet-based services and support services that you use, are the entire agreement for the software and support services.\par
|
||||||
|
\b\fs20 9.\tab\fs19 APPLICABLE LAW.\par
|
||||||
|
|
||||||
|
\pard
|
||||||
|
{\listtext\f0 a.\tab}\jclisttab\tx363\ls2\ilvl1\nowidctlpar\s2\fi-363\li720\sb120\sa120 United States. \b0 If you acquired the software in the United States, Washington state law governs the interpretation of this agreement and applies to claims for breach of it, regardless of conflict of laws principles. The laws of the state where you live govern all other claims, including claims under state consumer protection laws, unfair competition laws, and in tort.\par
|
||||||
|
{\listtext\f0 b.\tab}\b Outside the United States. If you acquired the software in any other country, the laws of that country apply.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\s1\fi-357\li357\sb120\sa120\fs20 10.\tab\fs19 LEGAL EFFECT. \b0 This agreement describes certain legal rights. You may have other rights under the laws of your country. You may also have rights with respect to the party from whom you acquired the software. This agreement does not change your rights under the laws of your country if the laws of your country do not permit it to do so.\par
|
||||||
|
\b\fs20 11.\tab\fs19 DISCLAIMER OF WARRANTY. THE SOFTWARE IS LICENSED \ldblquote AS-IS.\rdblquote YOU BEAR THE RISK OF USING IT. MICROSOFT GIVES NO EXPRESS WARRANTIES, GUARANTEES OR CONDITIONS. YOU MAY HAVE ADDITIONAL CONSUMER RIGHTS OR STATUTORY GUARANTEES UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT EXCLUDES THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\li357\sb120\sa120 FOR AUSTRALIA \endash YOU HAVE STATUTORY GUARANTEES UNDER THE AUSTRALIAN CONSUMER LAW AND NOTHING IN THESE TERMS IS INTENDED TO AFFECT THOSE RIGHTS.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\s1\fi-357\li357\sb120\sa120\fs20 12.\tab\fs19 LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM MICROSOFT AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP TO U.S. $5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL, LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\li357\sb120\sa120\b0 This limitation applies to\par
|
||||||
|
|
||||||
|
\pard{\pntext\f4\'B7\tab}{\*\pn\pnlvlblt\pnf4\pnindent363{\pntxtb\'B7}}\nowidctlpar\fi-363\li720\sb120\sa120 anything related to the software, services, content (including code) on third party Internet sites, or third party programs; and\par
|
||||||
|
{\pntext\f4\'B7\tab}claims for breach of contract, breach of warranty, guarantee or condition, strict liability, negligence, or other tort to the extent permitted by applicable law.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\sb120\sa120 It also applies even if Microsoft knew or should have known about the possibility of the damages. The above limitation or exclusion may not apply to you because your country may not allow the exclusion or limitation of incidental, consequential or other damages.\par
|
||||||
|
\lang9 Please note: As this software is distributed in Quebec, Canada, some of the clauses in this agreement are provided below in French.\par
|
||||||
|
Remarque : Ce logiciel \'e9tant distribu\'e9 au Qu\'e9bec, Canada, certaines des clauses dans ce contrat sont fournies ci-dessous en fran\'e7ais.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\s1\sb120\sa120\b\lang1033 EXON\'c9RATION DE GARANTIE. \b0 Le logiciel vis\'e9 par une licence est offert \'ab tel quel \'bb. Toute utilisation de ce logiciel est \'e0 votre seule risque et p\'e9ril. Microsoft n\rquote accorde aucune autre garantie expresse. Vous pouvez b\'e9n\'e9ficier de droits additionnels en vertu du droit local sur la protection des consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties implicites de qualit\'e9 marchande, d\rquote ad\'e9quation \'e0 un usage particulier et d\rquote absence de contrefa\'e7on sont exclues.\par
|
||||||
|
\b LIMITATION DES DOMMAGES-INT\'c9R\'caTS ET EXCLUSION DE RESPONSABILIT\'c9 POUR LES DOMMAGES. \b0 Vous pouvez obtenir de Microsoft et de ses fournisseurs une indemnisation en cas de dommages directs uniquement \'e0 hauteur de 5,00 $ US. Vous ne pouvez pr\'e9tendre \'e0 aucune indemnisation pour les autres dommages, y compris les dommages sp\'e9ciaux, indirects ou accessoires et pertes de b\'e9n\'e9fices.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\sb120\sa120\lang9 Cette limitation concerne :\par
|
||||||
|
|
||||||
|
\pard{\pntext\f4\'B7\tab}{\*\pn\pnlvlblt\pnf4\pnindent360{\pntxtb\'B7}}\nowidctlpar\li720\sb120\sa120 tout ce qui est reli\'e9 au logiciel, aux services ou au contenu (y compris le code) figurant sur des sites Internet tiers ou dans des programmes tiers ; et\par
|
||||||
|
{\pntext\f4\'B7\tab}les r\'e9clamations au titre de violation de contrat ou de garantie, ou au titre de responsabilit\'e9 stricte, de n\'e9gligence ou d\rquote une autre faute dans la limite autoris\'e9e par la loi en vigueur.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\sb120\sa120 Elle s\rquote applique \'e9galement, m\'eame si Microsoft connaissait ou devrait conna\'eetre l\rquote\'e9ventualit\'e9 d\rquote un tel dommage. Si votre pays n\rquote autorise pas l\rquote exclusion ou la limitation de responsabilit\'e9 pour les dommages indirects, accessoires ou de quelque nature que ce soit, il se peut que la limitation ou l\rquote exclusion ci-dessus ne s\rquote appliquera pas \'e0 votre \'e9gard.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\s1\sb120\sa120\b\lang1033 EFFET JURIDIQUE. \b0 Le pr\'e9sent contrat d\'e9crit certains droits juridiques. Vous pourriez avoir d\rquote autres droits pr\'e9vus par les lois de votre pays. Le pr\'e9sent contrat ne modifie pas les droits que vous conf\'e8rent les lois de votre pays si celles-ci ne le permettent pas.\par
|
||||||
|
|
||||||
|
\pard\nowidctlpar\sb120\sa120\b\fs20\lang1036\par
|
||||||
|
|
||||||
|
\pard\sa200\sl276\slmult1\b0\f3\fs22\lang9\par
|
||||||
|
}
|
||||||
|
| ||||||