Академический Документы
Профессиональный Документы
Культура Документы
Migration Guide
Migration Overview
M00100000
Rev. A
Cautions
No part of this document may be reproduced, stored in a retrieval system, or transmitted in any form or by
any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permis-
sion of Seiko Epson Corporation.
The contents of this document are subject to change without notice. Please contact us for the latest informa-
tion.
While every precaution has been taken in the preparation of this document, Seiko Epson Corporation
assumes no responsibility for errors or omissions.
Neither is any liability assumed for damages resulting from the use of the information contained herein.
Neither Seiko Epson Corporation nor its affiliates shall be liable to the purchaser of this product or third
parties for damages, losses, costs, or expenses incurred by the purchaser or third parties as a result of:
accident, misuse, or abuse of this product or unauthorized modifications, repairs, or alterations to this
product, or (excluding the U.S.) failure to strictly comply with Seiko Epson Corporations operating and
maintenance instructions.
Seiko Epson Corporation shall not be liable against any damages or problems arising from the use of any
options or any consumable products other than those specified as Original Epson Products or Epson
Approved Products by Seiko Epson Corporation.
Trademarks
EPSON is a registered trademark of Seiko Epson Corporation.
Exceed Your Vision is registered trademark or trademark of Seiko Epson Corporation.
Microsoft, MSDN, Visual C++, Visual C#, Visual Basic, Visual Studio, and Windows are registered
trademarks or trademarks of Microsoft Corporation in the United States and other countries.
All other trademarks are the property of their respective owners and used for identification purpose only.
2
Restriction of Use
When this product is used for applications requiring high reliability/safety, such as transportation devices
related to aviation, rail, marine, automotive, etc.; disaster prevention devices; various safety devices, etc.; or
functional/precision devices, etc., you should use this product only after giving consideration to including fail-
safes and redundancies into your design to maintain safety and total system reliability. Because this product was
not intended for use in applications requiring extremely high reliability/safety, such as aerospace equipment,
main communication equipment, nuclear power control equipment, or medical equipment related to direct
medical care, etc., please make your own judgment on this product's suitability after a full evaluation.
3
Contents
Restriction of Use ....................................................................................................................3
Contents....................................................................................................................................4
Migration Overview.........................................................................................5
4
Chapter 1 Migration Overview
Migration Overview
This manual explains how to use the ePOS-Print SDK for Windows store app (hereinafter referred to as "ePOS-
Print SDK") to modify developed applications so that they operate on Epson ePOS SDK for Universal Windows
apps (hereinafter referred to as "Epson ePOS SDK").
Modifying a program so that it operates on the Epson ePOS SDK APIs enables you to migrate to an application
that supports a universal Windows platform.
This can also support new products and new functions for Epson TM printers and peripherals.
For Epson ePOS SDK, use Visual Studio 2015 Update 1 or later.
5
Chapter 2 Migration from ePOS-Print SDK
Migration procedure
The migration procedure is described below.
1
Procedure
Migrating the application
Description
Migrating the application project to Universal Windows apps while referencing
2
project to Universal Win- Microsoft's website
dows apps Refer to " Migrating the application project to Universal Windows apps".
2 Installing SDK Installing Epson ePOS SDK in the application project
Refer to " Installing Epson ePOS SDK".
3 Changing library references Changing the library references from ePOS-Print SDK to Epson ePOS SDK
Refer to " Changing library references".
4 Changing namespace Changing the namespace set in the application to the Epson ePOS SDK namespace
Refer to " Changing namespace".
5 Changing classes Changing the ePOS-Print SDK classes to the Epson ePOS SDK classes
Refer to " Changing classes name".
6
Chapter 2 Migration from ePOS-Print SDK
6 Changing APIs Modifying the program or changing the ePOS-Print SDK APIs that have different
specifications from those of Epson ePOS SDK
The changes are described below.
Modifying the program to enable specific functions
Modify the functions listed below.
Establishing and cutting the communication with the printer
Refer to " Establishing and cutting the communication with the printer".
Printing
Refer to " Printing".
Obtaining status
Refer to " Obtaining status".
Printer search
Refer to " Printer search".
Status monitoring
Refer to " Monitoring of the status".
Changing event obtaining procedure
Refer to " Changing event obtaining procedure".
Changing exceptions
Refer to " Changing exceptions". 2
Changing API name
API names to be changed (You may need to change parameters too)
Refer to " Changing API name".
Changing API parameters
API names do not change, but parameter changes are necessary.
Refer to " Changing API parameters".
Changing events
Refer to " Changing events".
7 Application building Building a project for the modified application.
This completes the migration with the Epson ePOS SDK API.
7
Chapter 2 Migration from ePOS-Print SDK
8
Chapter 2 Migration from ePOS-Print SDK
5 Unselect [Epson ePOS-Print SDK] and [Microsoft Visual C++ 2013 Runtime Package
for Windows], then select [Epson ePOS SDK for Universal Windows apps] and [Visual
C++ 2015 Runtime for Universal Windows Platform Apps].
6 Click [OK].
9
Chapter 2 Migration from ePOS-Print SDK
Changing namespace
Change the namespace set in the application to the Epson ePOS SDK namespace.
Namespace to be added
Epson ePOS SDK Description
Epson.Epos.Epos2 Namespace for using general functions of Epson ePOS SDK.
Namespace to be changed
Type ePOS-Print SDK Epson ePOS SDK
Print class LibEposPrint Epson.Epos.Epos2.Printer
Builder class
Finder class Epson.Epos.Epos2.Discovery
10
Chapter 2 Migration from ePOS-Print SDK
Print.OpenPrinterAsync() Printer.ConnectAsync()
2
Disconnection
Print.ClosePrinterAsync() Printer.DisconnectAsync()
11
Chapter 2 Migration from ePOS-Print SDK
Program differences
ePOS-Print SDK
try
{
Print printer = new Print();
/*connection*/
await printer.OpenPrinterAsync(DevType.DEVTYPE_TCP, "192.168.192.168",
Monitoring.MONITORING_TRUE, Print.PARAM_DEFAULT, Print.PARAM_DEFAULT);
//...processing...
/*disconnection*/
await printer.ClosePrinterAsync();
}
catch (Exception ex)
{
//...processing...
}
//...processing...
/*disconnection*/
await printer.DisconnectAsync();
}
catch(Exception e)
{
//...processing...
}
12
Chapter 2 Migration from ePOS-Print SDK
Printing
ePOS-Print and Epson ePOS SDK have different procedures for executing the printing function. The print
result is not the return of SendDataAsync, but now is notified to the registered event handler. Use the following
as a reference when modifying your program.
Builder.AddTextAlign(); Printer.AddAlign();
Builder.AddText() Printer.AddText()
Builder.Add****() Printer.Add****()
Callback:
13
Chapter 2 Migration from ePOS-Print SDK
Program differences
ePOS-Print SDK
try
{
/*Prerequisite*/
Builder builder = new Builder("TM-T88V", ModelLang.MODEL_LANG_ANK);
/*Send*/
await printer.OpenPrinterAsync(DevType.DEVTYPE_TCP,"192.168.192.168",
Monitoring.MONITORING_TRUE, Print.PARAM_DEFAULT, Print.PARAM_DEFAULT);
}
status = await printer.SendDataAsync(builder, 10000);
await printer.ClosePrinterAsync();
2
catch(Exception ex)
{
//...processing...
}
/*Send*/
//...Connecting...
await printer.SendDataAsync(Printer.PARAM_DEFAULT);
}
catch(Exception e)
{
//...processing...
}
}
14
Chapter 2 Migration from ePOS-Print SDK
Obtaining status
ePOS-Print and Epson ePOS SDK have different procedures for executing the status obtaining function. Use the
following as a reference when modifying your program.
PrinterStatus status =
Print.GetPrinterStatus()
PrinterStatusInfo status =
await Printer.GetStatusAsync()
2
status.Connection
Status Acquisition
status.Online
Offline Offline
status.BatteryLevel
15
Chapter 2 Migration from ePOS-Print SDK
Program differences
ePOS-Print SDK
PrinterStatus status;
status.printerStatus = 0;
status.batteryStatus = 0;
try
{
/*Prerequisite*/
Print printer = new Print();
/*Connect to device*/
await printer.OpenPrinterAsync(DevType.DEVTYPE_TCP, "192.168.192.168",
Monitoring.MONITORING_TRUE, Print.PARAM_DEFAULT, Print.PARAM_DEFAULT);
/*Obtaining status*/
status = await printer.GetStatusAsync();
//...processing...
if ((printerStatus & Print.ST_NO_RESPONSE) == Print.ST_NO_RESPONSE)
{
2
//no response
}
16
Chapter 2 Migration from ePOS-Print SDK
try
{
/*Prerequisite*/
//...connecting...
/*Obtaining status*/
status = await printer.GetStatusAsync();
if (status.Connection == Connection.False)
{
// no response
}
if (status.Online == Online.False)
{
}
// status offline
2
if (status.BatteryLevel == BatteryLevel.Level6)
{
// battery level 6
}
}
catch(Exception e)
{
//...processing...
}
17
Chapter 2 Migration from ePOS-Print SDK
Printer search
ePOS-Print and Epson ePOS SDK have different procedures for executing the printer search function. Use the
following as a reference when modifying your program.
2
device detection event
Discovery.StartAsync(option)
Result Acquisition
Finder.GetDeviceInfoList()
When a device detection event occurs,
notification is sent to the event handler
Search End
Finder.StopAsync() Discovery.StopAsync()
Callback:
18
Chapter 2 Migration from ePOS-Print SDK
Program differences
ePOS-Print SDK
try
{
/*Search start*/
await Finder.StartAsync(IoDevType.TCP, "255.255.255.255");
/*Result acquisition*/
list = Finder.GetDeviceInfoList(IoFilterOption.DEFAULT);
string deviceName = "";
string ipAddress = "";
for(int index = 0; index < list.length; index++)
{
deviceName = list[index].DeviceName;
ipAddress = list[index].IpAddress;
}
/*Search end*/
await Finder.StopAsync();
2
}
catch (Exception ex)
{
//...processing...
}
19
Chapter 2 Migration from ePOS-Print SDK
try
{
//Search start
await Discovery.StartAsync(option);
}
catch(Exception e)
{
//...processing...
}
}
}
/*Result acquisition*/
string target = args.DeviceInfo.Target; 2
private async void StopDiscovery()
{
try
{
//Stop search
await Discovery.StopAsync();
//Release
Discovery.Discovered -= Discovery_Discovered;
}
catch(Exception e)
{
//...processing...
}
}
20
Chapter 2 Migration from ePOS-Print SDK
Printer.Interval = 1000
Print.OpenPrinterAsync(1000)
Printer.StartMonitor()
Callback Notification
Print.ClosePrinterAsync() Printer.StopMonitor()
Callback:
21
Chapter 2 Migration from ePOS-Print SDK
Program differences
ePOS-Print SDK
try
{
/*Status monitor start*/
await printer.OpenPrinterAsync(DevType.DEVTYPE_TCP,"192.168.192.168",
Monitoring.MONITORING_TRUE, Print.PARAM_DEFAULT, Print.PARAM_DEFAULT);
//...processing...
2
/*Status monitor end*/
await printer.ClosePrinterAsync();
}
catch(Exception ex)
{
//...processing...
}
}
22
Chapter 2 Migration from ePOS-Print SDK
//...connecting...
//...processing...
}
printer.StopMonitor();
catch(Exception e)
2
{
//...processing...
}
}
23
Chapter 2 Migration from ePOS-Print SDK
Printer.StatusChanged +=
Event-handler-name
SetStatusChangeEventCallback
(StatusChangeEvent target)
2
Callback Function
Callback:
24
Chapter 2 Migration from ePOS-Print SDK
Program differences
ePOS-Print SDK
25
Chapter 2 Migration from ePOS-Print SDK
Changing exceptions
In Epson ePOS SDK, the definition names for error statuses returned as exceptions were changed. The error statuses which
were renamed are listed in the table below.
In Epson ePOS SDK, exceptions only occur during errors. If an error is not occurring, an exception is not returned.
For detail of error statuses, refer to ePOS-Print SDK for Windows Store apps Users Manual or Epson ePOS SDK for
Universal Windows apps Users Manual.
26
Chapter 2 Migration from ePOS-Print SDK
27
Chapter 2 Migration from ePOS-Print SDK
28
Chapter 2 Migration from ePOS-Print SDK
Changing events
The events that need to be changed or deleted when migrating from ePOS-Print SDK to Epson ePOS SDK are
listed in the tables below.
To see what has changed, compare the APIs that register event notification methods in "ePOS-Print SDK for
Windows Store apps User's Manual" and "Epson ePOS SDK for Universal Windows apps User's Manual".
Events to be changed
ePOS-Print SDK Epson ePOS SDK
Function How to register event notifications
Notification Method
Printer status notification public void SetStatusChangeEventCall- public event Windows.Founda-
back(LibEposPrint.StatusChangeEvent tar- tion.TypedEvent Handler<Printer,
get); Printer.StatusChangedEventArgs > Status-
Changed
void method-name (string deviceName, int
status);
void method-name (Printer sender,
Printer.StatusChangeEventArgs args);
2
Events to be deleted
How to register event notifications
Function
Notification Method
Notification of online public void SetOnlineEventCallback(LibEposPrint.OnlineEvent target);
event void method-name (string deviceName);
Notification of offline public void SetOfflineEventCallback(LibEposPrint.OfflineEvent target);
event void method-name (string deviceName);
Notification of power-off public void SetPowerOffEventCallback(LibEposPrint.PowerOffEvent target);
event void method-name (string deviceName);
Notification of cover public void SetCoverEventCallback(LibEposPrint.CoverOpenEvent target);
closed void method-name (string deviceName);
Notification of cover open public void SetCoverOpenEventCallback(LibEposPrint.CoverOpenEvent target);
void method-name (string deviceName);
Notification of paper OK public void SetPaperOkEventCallback(LibEposPrint.PaperOkEvent target);
void method-name (string deviceName);
Notification of paper near- public void SetPaperNearEndEventCallback(LibEposPrint.PaperNearEndEvent target);
end void method-name (string deviceName);
Notification of paper end public void SetPaperEndEventCallback(LibEposPrint.PaperEndEvent target);
void method-name (string deviceName);
Notification of drawer public void SetDrawerClosedEventCallback(LibEposPrint.DrawerClosedEvent target);
closed void method-name (string deviceName);
Notification of drawer public void SetDrawerOpenEventCallback(LibEposPrint.DrawerOpenEvent target);
open void method-name (string deviceName);
Notification of battery low public void SetBatteryLowEventCallback(LibEposPrint.BatteryLowEvent target);
void method-name (string deviceName);
Notification of battery public void SetBatteryOkEventCallback(LibEposPrint.BatteryOkEvent target);
level OK void method-name (string deviceName);
29
Chapter 2 Migration from ePOS-Print SDK
30