From 84ce34b21391dd821144b196da759b39f7faf2cd Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 11 Oct 2018 17:16:57 +0300 Subject: [PATCH] Initial Commit --- .gitattributes | 1 + .gitignore | 46 ++++ README.md | 53 ++++ android/build.gradle | 36 +++ android/src/main/AndroidManifest.xml | 6 + .../com/reactlibrary/RNSerialportModule.java | 22 ++ .../com/reactlibrary/RNSerialportPackage.java | 28 ++ index.js | 6 + ios/RNSerialport.h | 11 + ios/RNSerialport.m | 13 + ios/RNSerialport.podspec | 24 ++ ios/RNSerialport.xcodeproj/project.pbxproj | 259 ++++++++++++++++++ .../contents.xcworkspacedata | 9 + package.json | 20 ++ windows/.gitignore | 78 ++++++ windows/.npmignore | 9 + windows/RNSerialport.sln | 89 ++++++ .../RNSerialport/Properties/AssemblyInfo.cs | 30 ++ .../Properties/RNSerialport.rd.xml | 28 ++ windows/RNSerialport/RNSerialport.csproj | 153 +++++++++++ windows/RNSerialport/RNSerialportModule.cs | 33 +++ windows/RNSerialport/RNSerialportPackage.cs | 53 ++++ windows/RNSerialport/project.json | 16 ++ 23 files changed, 1023 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 README.md create mode 100644 android/build.gradle create mode 100644 android/src/main/AndroidManifest.xml create mode 100644 android/src/main/java/com/reactlibrary/RNSerialportModule.java create mode 100644 android/src/main/java/com/reactlibrary/RNSerialportPackage.java create mode 100644 index.js create mode 100644 ios/RNSerialport.h create mode 100644 ios/RNSerialport.m create mode 100644 ios/RNSerialport.podspec create mode 100644 ios/RNSerialport.xcodeproj/project.pbxproj create mode 100644 ios/RNSerialport.xcworkspace/contents.xcworkspacedata create mode 100644 package.json create mode 100644 windows/.gitignore create mode 100644 windows/.npmignore create mode 100644 windows/RNSerialport.sln create mode 100644 windows/RNSerialport/Properties/AssemblyInfo.cs create mode 100644 windows/RNSerialport/Properties/RNSerialport.rd.xml create mode 100644 windows/RNSerialport/RNSerialport.csproj create mode 100644 windows/RNSerialport/RNSerialportModule.cs create mode 100644 windows/RNSerialport/RNSerialportPackage.cs create mode 100644 windows/RNSerialport/project.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..eb39591 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.pbxproj -text \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9cadbfe --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ + +# OSX +# +.DS_Store + +# node.js +# +node_modules/ +npm-debug.log +yarn-error.log + + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml + +# BUCK +buck-out/ +\.buckd/ +*.keystore + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..d80afbc --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ + +# react-native-serialport + +## Getting started + +`$ npm install react-native-serialport --save` + +### Mostly automatic installation + +`$ react-native link react-native-serialport` + +### Manual installation + + +#### iOS + +1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` +2. Go to `node_modules` ➜ `react-native-serialport` and add `RNSerialport.xcodeproj` +3. In XCode, in the project navigator, select your project. Add `libRNSerialport.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` +4. Run your project (`Cmd+R`)< + +#### Android + +1. Open up `android/app/src/main/java/[...]/MainActivity.java` + - Add `import com.reactlibrary.RNSerialportPackage;` to the imports at the top of the file + - Add `new RNSerialportPackage()` to the list returned by the `getPackages()` method +2. Append the following lines to `android/settings.gradle`: + ``` + include ':react-native-serialport' + project(':react-native-serialport').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-serialport/android') + ``` +3. Insert the following lines inside the dependencies block in `android/app/build.gradle`: + ``` + compile project(':react-native-serialport') + ``` + +#### Windows +[Read it! :D](https://github.com/ReactWindows/react-native) + +1. In Visual Studio add the `RNSerialport.sln` in `node_modules/react-native-serialport/windows/RNSerialport.sln` folder to their solution, reference from their app. +2. Open up your `MainPage.cs` app + - Add `using Serialport.RNSerialport;` to the usings at the top of the file + - Add `new RNSerialportPackage()` to the `List` returned by the `Packages` method + + +## Usage +```javascript +import RNSerialport from 'react-native-serialport'; + +// TODO: What to do with the module? +RNSerialport; +``` + \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..a28f0dd --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,36 @@ + +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:1.3.1' + } +} + +apply plugin: 'com.android.library' + +android { + compileSdkVersion 23 + buildToolsVersion "23.0.1" + + defaultConfig { + minSdkVersion 16 + targetSdkVersion 22 + versionCode 1 + versionName "1.0" + } + lintOptions { + abortOnError false + } +} + +repositories { + mavenCentral() +} + +dependencies { + compile 'com.facebook.react:react-native:+' +} + \ No newline at end of file diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000..41a92ab --- /dev/null +++ b/android/src/main/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/android/src/main/java/com/reactlibrary/RNSerialportModule.java b/android/src/main/java/com/reactlibrary/RNSerialportModule.java new file mode 100644 index 0000000..3b8dbcb --- /dev/null +++ b/android/src/main/java/com/reactlibrary/RNSerialportModule.java @@ -0,0 +1,22 @@ + +package com.reactlibrary; + +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.Callback; + +public class RNSerialportModule extends ReactContextBaseJavaModule { + + private final ReactApplicationContext reactContext; + + public RNSerialportModule(ReactApplicationContext reactContext) { + super(reactContext); + this.reactContext = reactContext; + } + + @Override + public String getName() { + return "RNSerialport"; + } +} \ No newline at end of file diff --git a/android/src/main/java/com/reactlibrary/RNSerialportPackage.java b/android/src/main/java/com/reactlibrary/RNSerialportPackage.java new file mode 100644 index 0000000..9131d43 --- /dev/null +++ b/android/src/main/java/com/reactlibrary/RNSerialportPackage.java @@ -0,0 +1,28 @@ + +package com.reactlibrary; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import com.facebook.react.ReactPackage; +import com.facebook.react.bridge.NativeModule; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.uimanager.ViewManager; +import com.facebook.react.bridge.JavaScriptModule; +public class RNSerialportPackage implements ReactPackage { + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + return Arrays.asList(new RNSerialportModule(reactContext)); + } + + // Deprecated from RN 0.47 + public List> createJSModules() { + return Collections.emptyList(); + } + + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } +} \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..60701a7 --- /dev/null +++ b/index.js @@ -0,0 +1,6 @@ + +import { NativeModules } from 'react-native'; + +const { RNSerialport } = NativeModules; + +export default RNSerialport; diff --git a/ios/RNSerialport.h b/ios/RNSerialport.h new file mode 100644 index 0000000..28a45d3 --- /dev/null +++ b/ios/RNSerialport.h @@ -0,0 +1,11 @@ + +#if __has_include("RCTBridgeModule.h") +#import "RCTBridgeModule.h" +#else +#import +#endif + +@interface RNSerialport : NSObject + +@end + \ No newline at end of file diff --git a/ios/RNSerialport.m b/ios/RNSerialport.m new file mode 100644 index 0000000..c5ec0ff --- /dev/null +++ b/ios/RNSerialport.m @@ -0,0 +1,13 @@ + +#import "RNSerialport.h" + +@implementation RNSerialport + +- (dispatch_queue_t)methodQueue +{ + return dispatch_get_main_queue(); +} +RCT_EXPORT_MODULE() + +@end + \ No newline at end of file diff --git a/ios/RNSerialport.podspec b/ios/RNSerialport.podspec new file mode 100644 index 0000000..4f63aa3 --- /dev/null +++ b/ios/RNSerialport.podspec @@ -0,0 +1,24 @@ + +Pod::Spec.new do |s| + s.name = "RNSerialport" + s.version = "1.0.0" + s.summary = "RNSerialport" + s.description = <<-DESC + RNSerialport + DESC + s.homepage = "" + s.license = "MIT" + # s.license = { :type => "MIT", :file => "FILE_LICENSE" } + s.author = { "author" => "author@domain.cn" } + s.platform = :ios, "7.0" + s.source = { :git => "https://github.com/author/RNSerialport.git", :tag => "master" } + s.source_files = "RNSerialport/**/*.{h,m}" + s.requires_arc = true + + + s.dependency "React" + #s.dependency "others" + +end + + \ No newline at end of file diff --git a/ios/RNSerialport.xcodeproj/project.pbxproj b/ios/RNSerialport.xcodeproj/project.pbxproj new file mode 100644 index 0000000..a602b9b --- /dev/null +++ b/ios/RNSerialport.xcodeproj/project.pbxproj @@ -0,0 +1,259 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + B3E7B58A1CC2AC0600A0062D /* RNSerialport.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNSerialport.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 58B511D91A9E6C8500147676 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 134814201AA4EA6300B7C361 /* libRNSerialport.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNSerialport.a; sourceTree = BUILT_PRODUCTS_DIR; }; + B3E7B5881CC2AC0600A0062D /* RNSerialport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNSerialport.h; sourceTree = ""; }; + B3E7B5891CC2AC0600A0062D /* RNSerialport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSerialport.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 58B511D81A9E6C8500147676 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 134814211AA4EA7D00B7C361 /* Products */ = { + isa = PBXGroup; + children = ( + 134814201AA4EA6300B7C361 /* libRNSerialport.a */, + ); + name = Products; + sourceTree = ""; + }; + 58B511D21A9E6C8500147676 = { + isa = PBXGroup; + children = ( + B3E7B5881CC2AC0600A0062D /* RNSerialport.h */, + B3E7B5891CC2AC0600A0062D /* RNSerialport.m */, + 134814211AA4EA7D00B7C361 /* Products */, + ); + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 58B511DA1A9E6C8500147676 /* RNSerialport */ = { + isa = PBXNativeTarget; + buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNSerialport" */; + buildPhases = ( + 58B511D71A9E6C8500147676 /* Sources */, + 58B511D81A9E6C8500147676 /* Frameworks */, + 58B511D91A9E6C8500147676 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = RNSerialport; + productName = RCTDataManager; + productReference = 134814201AA4EA6300B7C361 /* libRNSerialport.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 58B511D31A9E6C8500147676 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0830; + ORGANIZATIONNAME = Facebook; + TargetAttributes = { + 58B511DA1A9E6C8500147676 = { + CreatedOnToolsVersion = 6.1.1; + }; + }; + }; + buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNSerialport" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 58B511D21A9E6C8500147676; + productRefGroup = 58B511D21A9E6C8500147676; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 58B511DA1A9E6C8500147676 /* RNSerialport */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 58B511D71A9E6C8500147676 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + B3E7B58A1CC2AC0600A0062D /* RNSerialport.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 58B511ED1A9E6C8500147676 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 58B511EE1A9E6C8500147676 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 58B511F01A9E6C8500147676 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../../React/**", + "$(SRCROOT)/../../react-native/React/**", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = RNSerialport; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 58B511F11A9E6C8500147676 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + HEADER_SEARCH_PATHS = ( + "$(inherited)", + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, + "$(SRCROOT)/../../../React/**", + "$(SRCROOT)/../../react-native/React/**", + ); + LIBRARY_SEARCH_PATHS = "$(inherited)"; + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = RNSerialport; + SKIP_INSTALL = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNSerialport" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 58B511ED1A9E6C8500147676 /* Debug */, + 58B511EE1A9E6C8500147676 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNSerialport" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 58B511F01A9E6C8500147676 /* Debug */, + 58B511F11A9E6C8500147676 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 58B511D31A9E6C8500147676 /* Project object */; +} diff --git a/ios/RNSerialport.xcworkspace/contents.xcworkspacedata b/ios/RNSerialport.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..643b9e6 --- /dev/null +++ b/ios/RNSerialport.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,9 @@ +// !$*UTF8*$! + + + + + + \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..3dd134d --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ + +{ + "name": "react-native-serialport", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "react-native" + ], + "author": "", + "license": "", + "peerDependencies": { + "react-native": "^0.41.2", + "react-native-windows": "0.41.0-rc.1" + + } +} diff --git a/windows/.gitignore b/windows/.gitignore new file mode 100644 index 0000000..cbf7e7f --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1,78 @@ +*AppPackages* +*BundleArtifacts* +*ReactAssets* + +#OS junk files +[Tt]humbs.db +*.DS_Store + +#Visual Studio files +*.[Oo]bj +*.user +*.aps +*.pch +*.vspscc +*.vssscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.[Cc]ache +*.ilk +*.log +*.lib +*.sbr +*.sdf +*.opensdf +*.opendb +*.unsuccessfulbuild +ipch/ +[Oo]bj/ +[Bb]in +[Dd]ebug*/ +[Rr]elease*/ +Ankh.NoLoad + +#MonoDevelop +*.pidb +*.userprefs + +#Tooling +_ReSharper*/ +*.resharper +[Tt]est[Rr]esult* +*.sass-cache + +#Project files +[Bb]uild/ + +#Subversion files +.svn + +# Office Temp Files +~$* + +# vim Temp Files +*~ + +#NuGet +packages/ +*.nupkg + +#ncrunch +*ncrunch* +*crunch*.local.xml + +# visual studio database projects +*.dbmdl + +#Test files +*.testsettings + +#Other files +*.DotSettings +.vs/ +*project.lock.json diff --git a/windows/.npmignore b/windows/.npmignore new file mode 100644 index 0000000..dd626ca --- /dev/null +++ b/windows/.npmignore @@ -0,0 +1,9 @@ + +# Make sure we don't publish build artifacts to NPM +ARM/ +Debug/ +x64/ +x86/ +bin/ +obj/ +.vs/ diff --git a/windows/RNSerialport.sln b/windows/RNSerialport.sln new file mode 100644 index 0000000..66a2407 --- /dev/null +++ b/windows/RNSerialport.sln @@ -0,0 +1,89 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RNSerialport", "RNSerialport\RNSerialport.csproj", "{24E14E20-CD60-11E8-A172-C185C54DD2AB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative", "..\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj", "{C7673AD5-E3AA-468C-A5FD-FA38154E205C}" +EndProject +Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ReactNative.Shared", "..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.shproj", "{EEA8B852-4D07-48E1-8294-A21AB5909FE5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChakraBridge", "..\node_modules\react-native-windows\ReactWindows\ChakraBridge\ChakraBridge.vcxproj", "{4B72C796-16D5-4E3A-81C0-3E36F531E578}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{c7673ad5-e3aa-468c-a5fd-fa38154e205c}*SharedItemsImports = 4 + ..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{eea8b852-4d07-48e1-8294-a21ab5909fe5}*SharedItemsImports = 13 + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Development|ARM = Development|ARM + Development|x64 = Development|x64 + Development|x86 = Development|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Debug|ARM.ActiveCfg = Debug|ARM + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Debug|ARM.Build.0 = Debug|ARM + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Debug|x64.ActiveCfg = Debug|x64 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Debug|x64.Build.0 = Debug|x64 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Debug|x86.ActiveCfg = Debug|x86 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Debug|x86.Build.0 = Debug|x86 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Development|ARM.ActiveCfg = Development|ARM + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Development|ARM.Build.0 = Development|ARM + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Development|x64.ActiveCfg = Development|x64 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Development|x64.Build.0 = Development|x64 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Development|x86.ActiveCfg = Development|x86 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Development|x86.Build.0 = Development|x86 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Release|ARM.ActiveCfg = Release|ARM + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Release|ARM.Build.0 = Release|ARM + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Release|x64.ActiveCfg = Release|x64 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Release|x64.Build.0 = Release|x64 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Release|x86.ActiveCfg = Release|x86 + {24E14E20-CD60-11E8-A172-C185C54DD2AB}.Release|x86.Build.0 = Release|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.ActiveCfg = Debug|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.Build.0 = Debug|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.ActiveCfg = Debug|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.Build.0 = Debug|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.ActiveCfg = Debug|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.Build.0 = Debug|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.ActiveCfg = Debug|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.Build.0 = Debug|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.ActiveCfg = Debug|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.Build.0 = Debug|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.ActiveCfg = Debug|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.Build.0 = Debug|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.ActiveCfg = Release|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.Build.0 = Release|ARM + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.ActiveCfg = Release|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.Build.0 = Release|x64 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.ActiveCfg = Release|x86 + {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.Build.0 = Release|x86 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.ActiveCfg = Debug|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.Build.0 = Debug|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.ActiveCfg = Debug|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.Build.0 = Debug|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.ActiveCfg = Debug|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.Build.0 = Debug|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|ARM.ActiveCfg = Debug|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|ARM.Build.0 = Debug|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x64.ActiveCfg = Debug|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x64.Build.0 = Debug|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x86.ActiveCfg = Debug|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x86.Build.0 = Debug|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.ActiveCfg = Release|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.Build.0 = Release|ARM + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.ActiveCfg = Release|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.Build.0 = Release|x64 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.ActiveCfg = Release|Win32 + {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal + \ No newline at end of file diff --git a/windows/RNSerialport/Properties/AssemblyInfo.cs b/windows/RNSerialport/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1d3d679 --- /dev/null +++ b/windows/RNSerialport/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("RNSerialport")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RNSerialport")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[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 Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] + \ No newline at end of file diff --git a/windows/RNSerialport/Properties/RNSerialport.rd.xml b/windows/RNSerialport/Properties/RNSerialport.rd.xml new file mode 100644 index 0000000..df7e78f --- /dev/null +++ b/windows/RNSerialport/Properties/RNSerialport.rd.xml @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/windows/RNSerialport/RNSerialport.csproj b/windows/RNSerialport/RNSerialport.csproj new file mode 100644 index 0000000..4e2e2ca --- /dev/null +++ b/windows/RNSerialport/RNSerialport.csproj @@ -0,0 +1,153 @@ + + + + + Debug + x86 + {24E14E20-CD60-11E8-A172-C185C54DD2AB} + Library + Properties + Serialport + Serialport + en-US + UAP + 10.0.10586.0 + 10.0.10240.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\..\node_modules + + + ..\.. + + + x86 + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x86 + false + prompt + + + x86 + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x86 + false + prompt + + + ARM + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + ARM + false + prompt + + + ARM + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + ARM + false + prompt + + + x64 + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + x64 + false + prompt + + + x64 + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + x64 + false + prompt + + + true + bin\x86\Development\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + true + full + x86 + false + prompt + MinimumRecommendedRules.ruleset + + + true + bin\ARM\Development\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + true + full + ARM + false + prompt + MinimumRecommendedRules.ruleset + + + true + bin\x64\Development\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + true + full + x64 + false + prompt + MinimumRecommendedRules.ruleset + + + + + + + + + + + + + + {c7673ad5-e3aa-468c-a5fd-fa38154e205c} + ReactNative + + + + 14.0 + + + + diff --git a/windows/RNSerialport/RNSerialportModule.cs b/windows/RNSerialport/RNSerialportModule.cs new file mode 100644 index 0000000..d862680 --- /dev/null +++ b/windows/RNSerialport/RNSerialportModule.cs @@ -0,0 +1,33 @@ +using ReactNative.Bridge; +using System; +using System.Collections.Generic; +using Windows.ApplicationModel.Core; +using Windows.UI.Core; + +namespace Serialport.RNSerialport +{ + /// + /// A module that allows JS to share data. + /// + class RNSerialportModule : NativeModuleBase + { + /// + /// Instantiates the . + /// + internal RNSerialportModule() + { + + } + + /// + /// The name of the native module. + /// + public override string Name + { + get + { + return "RNSerialport"; + } + } + } +} diff --git a/windows/RNSerialport/RNSerialportPackage.cs b/windows/RNSerialport/RNSerialportPackage.cs new file mode 100644 index 0000000..b133c91 --- /dev/null +++ b/windows/RNSerialport/RNSerialportPackage.cs @@ -0,0 +1,53 @@ +using ReactNative.Bridge; +using ReactNative.Modules.Core; +using ReactNative.UIManager; +using System; +using System.Collections.Generic; + +namespace Serialport.RNSerialport +{ + /// + /// Package defining core framework modules (e.g., ). + /// It should be used for modules that require special integration with + /// other framework parts (e.g., with the list of packages to load view + /// managers from). + /// + public class RNSerialportPackage : IReactPackage + { + /// + /// Creates the list of native modules to register with the react + /// instance. + /// + /// The react application context. + /// The list of native modules. + public IReadOnlyList CreateNativeModules(ReactContext reactContext) + { + return new List + { + new RNSerialportModule(), + }; + } + + /// + /// Creates the list of JavaScript modules to register with the + /// react instance. + /// + /// The list of JavaScript modules. + public IReadOnlyList CreateJavaScriptModulesConfig() + { + return new List(0); + } + + /// + /// Creates the list of view managers that should be registered with + /// the . + /// + /// The react application context. + /// The list of view managers. + public IReadOnlyList CreateViewManagers( + ReactContext reactContext) + { + return new List(0); + } + } +} diff --git a/windows/RNSerialport/project.json b/windows/RNSerialport/project.json new file mode 100644 index 0000000..89d0fa7 --- /dev/null +++ b/windows/RNSerialport/project.json @@ -0,0 +1,16 @@ +{ + "dependencies": { + "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2" + }, + "frameworks": { + "uap10.0": {} + }, + "runtimes": { + "win10-arm": {}, + "win10-arm-aot": {}, + "win10-x86": {}, + "win10-x86-aot": {}, + "win10-x64": {}, + "win10-x64-aot": {} + } +}