├── plugin
├── KIPCPlugin
│ ├── KOS
│ │ ├── Extensions.cs
│ │ ├── KRPCClient.cs
│ │ ├── KRPCConnection.cs
│ │ └── Addon.cs
│ ├── FodyWeavers.xml
│ ├── Serialization
│ │ ├── Exceptions.cs
│ │ ├── CollectionHandler.cs
│ │ ├── BodyHandler.cs
│ │ ├── SerializesAttribute.cs
│ │ ├── VesselHandler.cs
│ │ ├── ListHandlers.cs
│ │ ├── LexiconHandler.cs
│ │ ├── GeometryHandlers.cs
│ │ ├── TypeRegistry.cs
│ │ ├── TypeSerializer.cs
│ │ ├── TypeHandler.cs
│ │ └── Serializer.cs
│ ├── packages.config
│ ├── Extensions.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Addon.cs
│ ├── KRPC
│ │ ├── Processor.cs
│ │ └── Service.cs
│ ├── Util
│ │ ├── CountingIterator.cs
│ │ ├── Validation.cs
│ │ └── CacheDictionary.cs
│ ├── KIPCPlugin.csproj
│ ├── KOSAddon.cs
│ └── KIPC.csproj
├── KIPC.version
├── KIPC.version.template
├── KIPC.sln
└── Postbuild.ps1
├── .vscode
└── settings.json
├── python
├── requirements.txt
└── cli.py
├── doc
├── CHANGELOG.md
├── kos.md
├── index.md
├── krpc.md
└── LICENSE.md
├── .gitattributes
├── KIPC.netkan
├── README.md
└── .gitignore
/plugin/KIPCPlugin/KOS/Extensions.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | // Place your settings in this file to overwrite default and user settings.
2 | {
3 | "editor.rulers": [120],
4 | }
--------------------------------------------------------------------------------
/plugin/KIPCPlugin/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/python/requirements.txt:
--------------------------------------------------------------------------------
1 | Jinja2==2.8
2 | krpc==0.3.5
3 | krpc.clientgen==0.2.2
4 | krpctools==0.3.5
5 | MarkupSafe==0.23
6 | protobuf==3.0.0b3
7 | six==1.10.0
8 |
--------------------------------------------------------------------------------
/plugin/KIPC.version:
--------------------------------------------------------------------------------
1 | {"NAME":"kIPC","VERSION":{"MAJOR":0,"MINOR":2,"PATCH":0,"BUILD":0},"KSP_VERSION":{"MAJOR":1,"MINOR":1,"PATCH":3},"KSP_VERSION_MIN":{"MAJOR":1,"MINOR":1,"PATCH":3},"KSP_VERSION_MAX":{"MAJOR":1,"MINOR":1,"PATCH":99},"GITHUB":{"USERNAME":"dewiniaid","REPOSITORY":"ksp-kipc","ALLOW_PRE_RELEASE":false},"URL":"https://raw.githubusercontent.com/dewiniaid/ksp-kipc/master/plugin/KIPC.version"}
2 |
--------------------------------------------------------------------------------
/python/cli.py:
--------------------------------------------------------------------------------
1 | import krpc
2 | import code
3 |
4 | conn = krpc.connect(name="KIPC Test Script")
5 | print(conn.krpc.get_status())
6 |
7 | processors = conn.kipc.get_processors(conn.space_center.active_vessel)
8 | print(repr(processors))
9 | part = processors[0].part
10 | print(repr(part))
11 | processor = conn.kipc.get_processor(part)
12 | print(repr(processor))
13 |
14 | code.interact(local=globals())
15 |
16 |
--------------------------------------------------------------------------------
/plugin/KIPCPlugin/Serialization/Exceptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace KIPC.Serialization
4 | {
5 | public class SerializationException : Exception
6 | {
7 | public SerializationException() { }
8 | public SerializationException(string message) : base(message) { }
9 | public SerializationException(string message, Exception inner) : base(message, inner) { }
10 | }
11 | }
--------------------------------------------------------------------------------
/plugin/KIPCPlugin/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/plugin/KIPC.version.template:
--------------------------------------------------------------------------------
1 | {
2 | "NAME":"kIPC",
3 |
4 | "VERSION": { "MAJOR": 0, "MINOR": 2, "PATCH": 0, "BUILD" :0 },
5 | "KSP_VERSION": { "MAJOR": 1, "MINOR": 1, "PATCH": 3 },
6 | "KSP_VERSION_MIN": { "MAJOR": 1, "MINOR": 1, "PATCH": 3 },
7 | "KSP_VERSION_MAX": { "MAJOR": 1, "MINOR": 1, "PATCH": 99 },
8 |
9 | "GITHUB": {
10 | "USERNAME": "dewiniaid",
11 | "REPOSITORY": "ksp-kipc",
12 | "ALLOW_PRE_RELEASE": false
13 | },
14 | "URL": "https://raw.githubusercontent.com/dewiniaid/ksp-kipc/master/plugin/KIPC.version"
15 | }
16 |
--------------------------------------------------------------------------------
/plugin/KIPCPlugin/KOS/KRPCClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | using kOS.Safe.Encapsulation;
7 |
8 | namespace KIPC.KOS
9 | {
10 | ///
11 | /// Represents a KRPC client. Placeholder.
12 | ///
13 | [kOS.Safe.Utilities.KOSNomenclature("KRPCClient")]
14 | class KRPCClient : Structure
15 | {
16 | public KRPCClient(kOS.SharedObjects shared) { }
17 |
18 | public override string ToString()
19 | {
20 | return "KRPCClient(PLACEHOLDER)";
21 | }
22 |
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/doc/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | **[ [KIPC Overview](index.md) ] [ [kOS API](kos.md) ] [ [kRPC API](krpc.md) ] [ [Changelog](CHANGELOG.md) ] [ [License](LICENSE.md) ]**
4 |
5 | ## 0.2.0-beta (2016-07-16)
6 |
7 | - Added client libraries for C#, C++ and Java.
8 | - Added preliminary support for CKAN and KSP-AVC. This release *does not* include MiniAVC and *does not* use the internet to check for version updates, but other providers of MiniAVC/KSP-AVC might.
9 |
10 | ## 0.1.1-dev2 (2016-07-12)
11 |
12 | - Added `KIPC.GetMessages` and `KIPC.CountMessages` for better control and information about the message queue.
13 | - Added `KIPC.ResolveBodies` and `KIPC.ResolveVessels` to handle multiple bodies/vessels at once.
14 | - Added `KIPC.GetProcessor` to retrieve the kOSProcessor of a single part (compare to `KIPC.GetProcessors` which receives all processors on a given vesse)
15 | - Added `KIPC.GetPartsTagged` to find parts with a given `kOSNameTag`.
16 |
17 | ## 0.1.0-dev1 (2016-07-10)
18 |
19 | - First development release.
20 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | # http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
3 | * text=auto
4 |
5 | *.cs text eol=crlf diff=csharp
6 |
7 | # Custom for Visual Studio
8 | *.sln text eol=crlf
9 | *.csproj text eol=crlf
10 | *.vbproj text eol=crlf
11 | *.fsproj text eol=crlf
12 | *.dbproj text eol=crlf
13 |
14 | *.vcxproj text eol=crlf
15 | *.vcxitems text eol=crlf
16 | *.props text eol=crlf
17 | *.filters text eol=crlf
18 |
19 | # Basic .gitattributes for a python repo.
20 |
21 | # Source files
22 | # ============
23 | *.pxd text
24 | *.py text
25 | *.py3 text
26 | *.pyw text
27 | *.pyx text
28 |
29 | # Binary files
30 | # ============
31 | *.db binary
32 | *.p binary
33 | *.pkl binary
34 | *.pyc binary
35 | *.pyd binary
36 | *.pyo binary
37 |
38 | # Note: .db, .p, and .pkl files are associated
39 | # with the python modules ``pickle``, ``dbm.*``,
40 | # ``shelve``, ``marshal``, ``anydbm``, & ``bsddb``
41 | # (among others).
42 |
--------------------------------------------------------------------------------
/KIPC.netkan:
--------------------------------------------------------------------------------
1 | {
2 | "spec_version" : 1,
3 | "identifier" : "KIPC",
4 | "author" : "dewin",
5 | "$kref" : "#/ckan/github/dewiniaid/ksp-kipc",
6 | "$vref" : "#/ckan/ksp-avc",
7 | "name" : "kIPC: Kerbal Interprocess Communication",
8 | "abstract" : "Provides a communication bridge between kOS and kRPC.",
9 | "description" : "kIPC adds a bridge between kOS and kRPC. It allows kOS processors to send messages to kRPC clients and allows kRPC clients to send messages directly to kOS procesors.",
10 | "license" : "GPL-3.0",
11 | "release_status" : "testing",
12 | "resources" : {
13 | "homepage" : "http://forum.kerbalspaceprogram.com/index.php?/topic/142979-113",
14 | "repository" : "https://github.com/dewiniaid/ksp-kipc",
15 | "manual" : "https://github.com/dewiniaid/ksp-kipc/blob/master/doc/index.md"
16 | },
17 | "install" : [
18 | {
19 | "file": "GameData/KIPC",
20 | "install_to": "GameData"
21 | }
22 | ],
23 | "x_last_revision_by": "dewin",
24 | "depends": [
25 | { "name": "kOS", "min_version" : "1.0.0" },
26 | { "name": "kRPC" }
27 | ],
28 | "x_netkan_override": [
29 | {
30 | "version": "v0.2.0-beta",
31 | "override": { "ksp_version_max": "1.1.99" }
32 | }
33 | ]
34 | }
35 |
--------------------------------------------------------------------------------
/plugin/KIPCPlugin/KOS/KRPCConnection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | using kOS.Safe.Encapsulation;
7 |
8 | using KIPC.Serialization;
9 |
10 | namespace KIPC.KOS
11 | {
12 | ///
13 | /// Represents a KRPC connection. Placeholder.
14 | ///
15 | [kOS.Safe.Utilities.KOSNomenclature("KRPCConnection")]
16 | class KRPCConnection : kOS.Safe.Communication.Connection
17 | {
18 | public KRPCClient Client { get; private set; }
19 | private kOS.SharedObjects shared;
20 | public KRPCConnection(kOS.SharedObjects shared, KRPCClient client)
21 | {
22 | Client = client;
23 | this.shared = shared;
24 | }
25 |
26 | public override bool Connected { get; } = true;
27 | public override double Delay { get; } = 0;
28 |
29 | protected override Structure Destination()
30 | {
31 | return Client;
32 | }
33 |
34 | protected override BooleanValue SendMessage(Structure content)
35 | {
36 | KIPC.Addon.krpcMessageQueue.Enqueue(Serializer.WriteJson(shared, content));
37 | return true;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/doc/kos.md:
--------------------------------------------------------------------------------
1 | # Using KIPC within kOS
2 |
3 | **[ [KIPC Overview](index.md) ] [ [kOS API](kos.md) ] [ [kRPC API](krpc.md) ] [ [Changelog](CHANGELOG.md) ] [ [License](LICENSE.md) ]**
4 |
5 | ## Supported data types
6 | All currently serializable data types should be supported; these are the same restrictions as what you can use when
7 | sending messages between processors or vessels.
8 |
9 | These types include simple types like `ScalarValue`, `Boolean` and `String`, most of the collection types
10 | (`Lexicon`, `List`, `Queue`, `Stack`), and some object references (`Vessel` and `Body`). `Vector` is currently
11 | supported, but `Direction` is not available in this build due to limitations within kOS.
12 |
13 | ## Sending Messages
14 |
15 | **ADDON:KIPC:CONNECTION**
16 | Returns a `KRPCConnection` that can be used to send messages to kRPC. This functions like a normal `Connection`
17 | within processors on the same vessel.
18 |
19 | ## Unstable/Developer API
20 | These are all mostly intended for the developer build; they may change or be removed at any time.
21 |
22 | **ADDON:KIPC:SERIALIZE(_content_)**
23 |
24 | Serializes _content_ and returns the result.
25 |
26 | **ADDON:KIPC:DESERIALIZE(_json_)**
27 |
28 | Deserializes _json_ and returns the result.
29 |
30 | **ADDON:KIPC:SEND(_vessel_, _content_)**
31 | Immediately sends a message to the target vessel, ignoring RemoteTech restrictions (if any).
32 |
--------------------------------------------------------------------------------
/plugin/KIPC.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio 14
3 | VisualStudioVersion = 14.0.25123.0
4 | MinimumVisualStudioVersion = 10.0.40219.1
5 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AC48674B-DA82-45FA-AEFF-96AD040C3974}"
6 | ProjectSection(SolutionItems) = preProject
7 | KIPC.version = KIPC.version
8 | KIPC.version.template = KIPC.version.template
9 | Postbuild.ps1 = Postbuild.ps1
10 | EndProjectSection
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KIPC", "KIPCPlugin\KIPC.csproj", "{FEBE111A-D442-48BF-90B3-9135B577A4F6}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {FEBE111A-D442-48BF-90B3-9135B577A4F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {FEBE111A-D442-48BF-90B3-9135B577A4F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {FEBE111A-D442-48BF-90B3-9135B577A4F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {FEBE111A-D442-48BF-90B3-9135B577A4F6}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/plugin/KIPCPlugin/Serialization/CollectionHandler.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Collections;
3 | using KIPC.Extensions;
4 |
5 | namespace KIPC.Serialization
6 | {
7 | using JsonList = List