Professional Documents
Culture Documents
DataLink2
Programmers Guide and Reference
Version 3.0
DataLink2 Programmers Guide and Reference
Intentionally Blank
DataLink2 Programmers Guide and Reference
Legal Information
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
This work contains the confidential and proprietary trade secrets of Schlumberger
and may not be copied or stored in an information retrieval system, transferred, used,
distributed, translated or retransmitted in any form or by any means, electronic or
mechanical, in whole or in part, without the express written permission of the
copyright owner.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference
Table of Contents
Legal Information .......................................................................................................................... 3
Table of Contents ........................................................................................................................... 4
Introduction to DataLink2 ............................................................................................................ 6
Before You Begin ........................................................................................................................ 6
DataLink2 Workflow ..................................................................................................................... 7
Interacting with DataLink2 ........................................................................................................... 7
Client application Specific Interaction......................................................................................... 7
User Specific Interaction.............................................................................................................. 7
Interaction Available to Both Parties ........................................................................................... 8
Getting Started ............................................................................................................................... 8
Installation ................................................................................................................................... 8
Project Setup ................................................................................................................................ 8
Test Harness Application......................................................................................................... 8
Custom Project Setup .............................................................................................................. 8
Configuration .......................................................................................................................... 8
Basic Workflow .............................................................................................................................. 8
Creating a DataLink2 Instance..................................................................................................... 9
Hooking Up to DataLink2 Events................................................................................................ 9
Working with Requested Data Descriptions .............................................................................. 10
Explicit vs. Implicit RDDs ..................................................................................................... 10
Creating an Index Value for an RDD .................................................................................... 10
Creating RDDs ...................................................................................................................... 11
Requested Data Validation .................................................................................................... 11
Specifying a Dispatch Delegate for RDDs ............................................................................ 12
Initializing DataLink2 ................................................................................................................ 12
UI Mode................................................................................................................................. 13
Silent Mode............................................................................................................................ 13
Consuming DataLink2 Data....................................................................................................... 13
Working with DataLink2 State ................................................................................................... 14
Saving State Information ........................................................................................................... 14
Loading State Information ......................................................................................................... 15
Loading Connection Information .......................................................................................... 16
Working with DataLink2 in Silent Mode ................................................................................... 16
Requirements ............................................................................................................................. 16
Initializing and Starting Transfer ............................................................................................... 16
Deployment and Upgrade ............................................................................................................ 17
Data Sanitization .......................................................................................................................... 17
Example Client Applications ....................................................................................................... 18
DataLink2 Test Harness............................................................................................................. 18
DataLink2 Recorder................................................................................................................... 19
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 6
Introduction to DataLink2
DataLink2 simplifies the delivery of real-time drilling data to Windows platform
applications, by providing an Applications Programmer Interface (API) to access real-
time source applications such as InterACT, IDEAL, and in the future, Horizon. In
addition, DataLink2 enabled client applications can provide the end user with a
consistent and intelligent User Interface (UI) for establishing connections to real-time
sources.
DataLink2 solves issues for three sets of users the end users, the application
development teams, and the real-time source teams. The issues solved for each user
group are:
For the end users, DataLink2 provides a common UI and ultimately a multitude of
adapters that can intelligently connect to a source of real-time drilling data. In future
versions of DataLink2 it is proposed that updates of adapters and the interface will
be directly initiated through the interface.
For the application development teams, DataLink2 provides a common API that is
completely independent of the real-time source being accessed. Time is no longer
an issue as it relates to developing a UI that enables users to connect to a real-time
source. DataLink2 provides all UI for the end users connection.
For the real-time source teams, only one connection to provide real-time data needs
to be addressed and by working closely with the real-time source team, the
DataLink2 interface will allow all DataLink2 enabled client applications to access the
data, as if it were any other real-time source.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 7
DataLink2 Workflow
DataLink2 will query for and transfer data in response to requests for data by the
client application. The client application defines the constraints for the queried data
by supplying DataLink2 with one or more Requested Data Descriptions (RDD). An RDD
is an object whose properties define the constraints of the data DataLink2 will query
for.
DataLink2 will then connect to a specified source and query for all available data
channels based on these constraints. These available data channels are then mapped
to their respective RDDs.
DataLink2 then begins transferring data for all mapped available data channels. The
client application can consume this data by hooking up to events that notify when the
data for each mapped available data channel comes in.
The client application cannot specify a source, provide source specific information, or
map available data channels to a requested data. It can, however, save source
specific state information that users cannot save.
Users can select a source and provide connection information for that source.
Users have the capability to adjust the mappings between available data channels
and requested data provided by the client application, or map additional available
data channels to certain types of requested data through the use of the UI.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 8
Getting Started
Installation
Execute the Slb.DataLink2.SDKInstaller.msi. The installer will provide DataLink2
assemblies, the DataLink2 merge module (to be included in the client applications
.msi), DataLink2 Recorder and the Test Application.
Project Setup
Configuration
You will need to include the necessary configuration for the Microsoft Enterprise
Library in your client applications configuration file. This configuration can be found
in DataLink2 TestHarness applications application configuration file.
(TestHarness.exe.config)
Basic Workflow
This section will walk through the basic workflow for interacting with DataLink2. We
will provide simple code examples that would be implemented in the client
application.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 9
We will hookup to the TransferStateChanged event. This event fires when either the
user begins transfer in the UI or if the client application begins transfer through the
Start method provided by IDataLink2.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 10
Explicit RDDs
An explicit RDD is the more specific of the two. It requires the definition of a code,
type, and index type. This type of RDD can map to only a single available data
channel. If an available data channel is found with the same code, type, and index
type DataLink2 will automatically map it to the explicit RDD.
Implicit RDDs
An implicit RDD is the least specific of the two. It requires only the type and the index
type, and cannot have a code. An implicit RDD can have multiple available data
channels with the same type and index type mapped to it. However, mapping to
implicit RDDs is considered additional data and is not mapped automatically. Mapping
to this type of RDD is left up to the user, by using the UI.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 11
double toDepthIndex = 0;
IIndexedValue indexedValue =
dl2Instance.CreateIndexedValue(toDepthIndex, "ft");
Creating RDDs
The client application specifies its requested data by using the factory methods
provided by the IRequestedDataHandler interface implemented by IDataLink2.
IRequestedDataDescription rdd1 =
dl2Instance.CreateRequestedData("HKLD",
EDataType.Log,
EIndexType.Time);
IRequestedDataDescription rdd2 =
dl2Instance.CreateRequestedData(EDataType.Any,
EIndexType.Any);
The type and index type of a requested data description is also validated. A requested
data descriptions type can never be of type Unspecified. Also, if a requested data
descriptions type is Any, its index type must be of Any as well. Also, if the type is Log
or Image, the index type cannot be Unspecified.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 12
rdd1.DispatchDelegate =
new EventHandler<DataDispatchEventArgs>(rdd1_DataDispatch);
dl2Instance.AssignDelegate(
new EventHandler<DataDispatchEventArgs>(rdds_DataDispatch));
The following illustrates how to add a delegate to all RDDs that are of type Log:
dl2Instance.AssignDelegate(EDataType.Log,
new EventHandler<DataDispatchEventArgs>(logs_DataDispatch));
The following illustrates how to add a delegate to all RDDs that are of type Any and of
index type Any:
Initializing DataLink2
Now that the instance has valid requested data, the client application can initialize
DataLink2. Initializing DataLink2 commits how DataLink2 will be used. DataLink2 has
two modes of interaction A UI mode and a silent mode. The following code
illustrates how to initialize DataLink2:
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 13
UI Mode
UI mode provides a user interface for DataLink2 that allows users of the client
application to connect to a source, to edit data mapping, and to begin data transfer.
In this mode, the client application is still able to interact with DataLink2. This allows
the client to save DataLink2s state or to begin transfer.
Silent Mode
Silent mode is intended to allow the client application to interact with DataLink2
without prompting the user for input. To use this workflow, DataLink2 must be run at
least once to allow the user to connect to a source. The client application can then
save all DataLink2 state information for future use.
For further information, read the Working with DataLink2 in Silent Mode section.
Console.Writeline(output);
}
}
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 14
The IStateSaver interface provides three overloads for the Save method. The first
method receives no arguments and is used to save state internally. The second uses
an out parameter of type ISerializedSourceObject, allowing the client application
to serialize the state information as they see fit. The third overload allows the user to
give any stream, leaving the serialization to DataLink2. The interface also provides the
Saving and Saved events, to notify the client application that information is about to
or has been saved. Each piece of state information is saved the same way.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 15
The following illustrates how to save mapping information using the overload with an
out parameter and a file stream:
ISerializedSourceObject item;
if (saver.Save(out item))
bf.Serialize(stream,
item);
}
The IStateLoader interface provides two overloads for the Load method. The first
method receives an argument of type ISerializedSourceObject. The second is of
type Stream.
Note: The Stream overload can only be used if the Stream overload of the
Save method was used to save state information.
The following illustrates how to load mapping information from the example above:
dl2instance.MappingInfoLoader.Load(item);
}
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 16
ISerializedConnectionObject conn =
item as ISerializedConnectionObject;
dl2instance.MappingInfoLoader.Load(item);
}
Requirements
The client application must have saved all DataLink2 state information in a prior
session. The client application must then load all state information with the correct
credentials, if needed.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 17
try
{
//Load mapping info using some method that
//returns a Stream / ISerializedSourceObject
this.dl2.MappingInfoLoader.Load(
MethodToLoadMappingInfo() );
this.dl2.Initialize(true);
this.dl2.Start();
}
catch (ConnectionFailureException e)
{
MessageBox.Show(e.Message, Resources.DialogTitle);
}
catch (Exception e)
{
MessageBox.Show(e.Message, Resources.DialogTitle);
}
Data Sanitization
The Sanitize Data functionality enables the user to correct a mismatch in naming
standards for units and/or channel codes. If the source and the real-time application
differ in the way they refer to a given unit or channel-code, the real-time application
can address this by providing a sanitizing file.
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 18
The sanitizing file resides in a subdirectory under the real-time application installation
directory. (<installation directory>\DataLink2\Sanitizing Info\) The Xml
Schema is provided in the SDK (SanitizingSchema.xsd)
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 19
DataLink2 Recorder
The Recorder (Recorder.exe) provides the programmer with a way to record data
from the real-time source and then simulate a real-time source with the Simulator
adapter.
Provide a location of the recorder output file to be created. Click Start and the
DataLink2 interface will launch. The recorder output file will not be written to until the
recording is stopped. The output file can then be used with the Simulator adapter
(Reset
Reset will cancel the current connection and return the recorder to its initial state).
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 20
Appendices
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 21
Name Description
Thrown if a list of adapters for sources could
AdapterException
not be loaded internally
Thrown by IDataLink2.Start when connection
ConnectionFailureException
fails.
Thrown by the DataLink2Factory when the
DataLink2CreationException
creation of the DataLink2 instance fails.
Thrown if de-serialization of an
SourceObjectException
ISerializedSourceObject fails.
InitializationException Thrown if Start is called before Initialize
Thrown by IDataLink2.CreateRequestedData
when an invalid IRequestedDataDescription is
RequestedDataException
passed, or if IDataLink2.Initialize is called and
no Requested data was given.
Thrown by IDataLink2.AddConnection when an
SourceException
invalid source is selected.
Thrown if there is no network connection to
NetworkUnavailableException
connect to a source when one is needed.
Name Event
ConnectionStateChangeEventArgs IDataLink2Notifier.ConnectionStateChanged
DataDispatchEventArgs IRequestedDataDescription.DataDispatch
StatusChangeEventArgs IDataLink2Notifier.StatusChanged
DL2ExceptionEventArgs IDataLink2Notifier.Error
TransferStateChangeEventArgs IDataLink2Notifier.TransferStateChanged
NewChannelEventArgs IDataLink2Notifier.NewChannel
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 22
Enumerations
EAdapterTransferState EIndexType
Enum Enum
Waiting Time
Starting MD
Transferring TVD
Suspended Any
Reconnecting Unspecified
EDataDescriptionType EOperationType
Enum Enum
RequestedDataDescription Append
AvailableDataDescription Update
Delete
EDataType ERiskType
Enum Enum
Log Risk
Survey Event
Image NearMiss
Text BestPractice
Risk LessonsLearned
Any Other
Unspecified Unknown
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 23
IData Interfaces
IData
Interface
Properties
IImageData
Interface
IData
Properties
ITextData
Interface
IData
Properties
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 24
IDataLink2 Interface
IDataLink2SourceHandler
Interface
Methods
IDataLink2
Interface
IDataLink2StateNotifier
IDataLink2SourceHandler
IRequestedDataHandler
IDataLink2StateSaver
IDataLink2StateLoader
IDataLink2UIHandler
Properties
Methods
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 25
IDataDescription Interfaces
IDataDescription
Interface
Properties
IAvailableDataDescription IRequestedDataDescription
Interface Interface
IDataDescription IDataDescription
Properties Properties
Description
FromIndex
Name
ToIndex
Unit
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 26
State Interfaces
IStateSaver ISerializedSourceObject
Interface Interface
ICloneable
Methods
Properties
Events
ISerializedConnectionObject
Interface
ISerializedSourceObject
IStateLoader
Interface Properties
Methods
Other Interfaces
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 27
DataLink2 Assemblies
Slb.DataLink2.Adapter.Ideal.dll Slb.DataLink2.Tools.InterACTFileUpl
Slb.DataLink2.Adapter.Simulator.dll oad.dll
Slb.DataLink2.Adapter.WitsmlApi.dll Slb.DataLink2.Tools.InterACTFileUpl
Slb.DataLink2.Adapter.Streaming.dll oad.Resources.dll
Slb.DataLink2.API.dll Recorder.exe
Slb.DataLink2.Common.dll TestHarness.exe
Slb.DataLink2.Kernel.dll
Backend (RT source) Related Assemblies
Interop.iaFileTransferHelper.dll AppDirect.dll
Interop.iaPubClient.dll iaFileTransferHelper.dll
Interop.APPDIRECTLib.dll iaPubClient.dll
Interop.SlbDataInterface.dll SlbDataInterface.exe
DataLink2 Configuration Files
Slb.DataLink2.Adapter.Ideal.dll.config
Slb.DataLink2.Adapter.WitsmlApi.dll.config
Slb.DataLink2.Kernel.DLL.config
TestHarness.exe.config
Recorder.exe.config
DataLink2 Documents
DataLink2_V3_API.pdf
DataLink2_V3_User_Guide.pdf
SanitizingSchema.xsd
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.
DataLink2 Programmers Guide and Reference 28
Private
Copyright 2006 Schlumberger, Unpublished Work. All rights reserved.