PollResponse

Describes the fields that may be sent to a CloudPRNT compatible device in response to a received PollRequest.
This object is intended to be serialised as JSON data, and passed back to CloudPRNT devices via http, in response to receiving a request poll.

NameSpace: StarMicronics.CloudPrnt.CpMessage

Syntax

public class PollResponse

Properties

claimBarcodeReader

A list of barcode reader device names which should be claimed by the server to receive scan events.
It is necessary to set this for every response in order maintain a claim and continue to receive barcode scan events.

Declaration

public List<string> claimBarcodeReader { get; set; }

Property Value

Type

Description

System.Collections.Generic.List<System.String>

claimKeyboard

A list of keyboard device names which should be claimed by the server to receive key press events.
It is necessary to set this for every response in order maintain a claim and continue to receive key press events.

Declaration

public List<string> claimKeyboard { get; set; }

Property Value

Type

Description

System.Collections.Generic.List<System.String>

clientAction

An optional list of ClientActionRequest objects, which are used to request an extended function of the client device.

Declaration

public List<ClientActionRequest> clientAction { get; set; }

Property Value

Type

Description

System.Collections.Generic.List< ClientActionRequest >

deleteMethod

An optional string value which should be set to “DELETE”, “GET” or null.
Servers which are unable to handle DELETE requests, can set this field to “GET” to ask the CloudPRNT device to confitm job completion or failure via a GET request.

Declaration

public string deleteMethod { get; set; }

Property Value

Type

Description

System.String

display

A list of DisplayUpdate objects, which are used to send instructions to displays connected to the CloudPRNT client device.

Declaration

public List<DisplayUpdate> display { get; set; }

Property Value

Type

Description

System.Collections.Generic.List< DisplayUpdate >

jobReady

Set to true to inform the CloudPRNT device that a job is available for printing.
This field is mandatory and must be specified one every poll.
When the CloudPRNT device has been informed that a job is ready for printing, then it will select a preferred mediaType and issue an http GET to request the print job data.

Declaration

public bool jobReady { get; set; }

Property Value

Type

Description

System.Boolean

mediaTypes

When ‘jobReady’ is set to true, then mediaTypes must also provide a list of strings representing the media formats in which the job can be provided to the CloudPRNT device.
When ‘jobReady’ is set to false, then this field will not be processed by the CloudPRNT client device and so can be null.
Is is recommended to use an ICpDocument class to enable server side job format conversion.
And in this case, the mediaTypes list can be obtained from an ICpDocument object directly.

Declaration

public bool jobReady { get; set; }

Property Value

Type

Description

System.Boolean

Methods

ToJson(PollResponse, Boolean)

Serialize a PollResponse object into CloudPRNT compatible JSON string data, ready for returning to a client device in response to a CloudPRNT PollRequest POST.

Declaration

public static string ToJson(PollResponse pollResponse, bool indented = false)

Parameters

Type

Name

Description

PollResponse

pollResponse

PollResponse object to be serialized

System.Boolean

indented

Set to true to format/indent the JSON. Intended to generate human readabe data for debugging (defaults to false)

Returns

Type

Description

System.String`

CloudPRNT compatible JSON polling POST response data.

ToJson(Boolean)

Serialize into CloudPRNT compatible JSON string data, ready for returning to a client device in response to a CloudPRNT PollRequest POST.
An exception will be thrown in case of failure, with an inner exception containing the error of the underlying serialization engine (currently Newtonsoft.Json).

Declaration

public string ToJson(bool indented = false)

Parameters

Type

Name

Description

System.Boolean

indented

Set to true to generate indented, human readable style JSON data (intended for debugging).

Returns

Type

Description

System.String`