Paxar Gold 6037EX User Manual

Size:
2.78 Mb
Download

Example

#include <stdio.h> #include "mmsultra.h"

void main(void)

 

{

// Print data structure

PRINTINIT pConfig;

short sStatus = 0;

// Status of comm. calls

unsigned short usStatus = 0;

// Battery level

sStatus = pclInit(NULL);

// Start Print subsystem

if (sStatus != 0)

printf("Init Failed\nError: %d", sStatus);

else

 

{

// Get the battery level

usStatus = pclGetBatteryLevel();

if (usStatus <= 711)

// Display results

printf("Charge the battery");

 

else

 

if (usStatus >= 832)

 

printf("Can run and print");

 

else

 

printf("Can run/cannot print");

 

}

// Close Print subsystem

pclClose();

}

 

Function Reference 4-25

p c l G e t B l a c k M a r k S e n s o r

Description

Retrieves the black mark sensor’s latest state. This state is not necessarily the current state because it is updated only by the Print subsystem.

Syntax

unsigned short far pclGetBlackMarkSensor(void);

Parameters

None

Return Values

1

The supplies are aligned on the black mark.

0

The supplies are not aligned on the black mark, or the

 

Print subsystem is busy or uninitialized.

703-793

A motion control error occurred. After the operator

 

corrects the printer condition, the application must call

 

pclClearError to reset the Motion Control subsystem.

Refer to the MPCL Packet Reference Manual for more information.

4-26Programmer’s Manual

Example

#include <conio.h> #include <stdio.h> #include "mmsultra.h"

void main(void)

 

{

// Print data structure

PRINTINIT pConfig;

unsigned short usStatus = 0;

// Battery level

short sStatus = 0;

// Command calls status

sStatus = pclInit(NULL);

// Start Print subsystem

if (sStatus != 0)

 

printf("Init Failed\nError: %d", usStatus);

else

 

{

// Check battery

usStatus = pclGetBatteryLevel();

if (usStatus <= 711)

 

printf(“Charge your battery”);

 

else

 

{

// Get sensor state

usStatus = pclGetBlackMarkSensor();

switch (usStatus)

// Display result

{

 

case 1: printf("Supplies are aligned"); break;

case 0: printf(“Supplies misaligned or system error”); break;

default: printf("Error--press any key when reset."); _getch();

pclClearError();

}

 

}

 

}

// Close Print subsystem

pclClose();

}

Function Reference 4-27

p c l G e t E r r o r M s g

Description

Testing/Debugging Only. Retrieves a pointer to the error message corresponding to a specified error number. Use this function on error numbers returned by pclOpen, pclWrite, and pclStatus.

Many error messages are longer than 20 characters. An application must format the message before displaying it to avoid truncation. See “Display” in Chapter 2 for more information.

Error numbers that this function can retrieve must be positive. Zero indicates success, and negative numbers are ROM-DOSerrors.

Syntax

char far* far pclGetErrorMsg(unsigned short usMsgNo);

Parameters

usMsgNo The error number.

Return Values

Pointer to a null-terminated

Successful.

message string

 

0

Unsuccessful.

4-28Programmer’s Manual

if (!pclBatteryOkToPrint()) printf("Low battery error");
else
{

Example

#include <stdio.h> #include "mmsultra.h"

void main(void)

 

{

// Command calls status

short sStatus = 0;

short usStatus = 0;

// Command calls status

char far* cStatus = NULL;

// Error message

PRINTINIT pConfig;

// Print data structure

sStatus = pclInit(NULL);

// Start Print subsystem

if (sStatus != 0)

 

printf("Init Failed\nError: %d", sStatus); else

{

// Check battery

// Open file usStatus = pclOpen("B:\\MPCL\\TEST.FAB"); if (usStatus > 0)

{

cStatus = pclGetErrorMsg(usStatus); printf("%Fs\n", cStatus);

}

 

}

 

}

// Close Print subsystem

pclClose();

}

Function Reference 4-29

p c l G e t O n D e m a n d S e n s o r

Description

Determines the on-demandsensor’s current state. This sensor is an option for the printer.

Syntax

unsigned short far pclGetOnDemandSensor(void);

Parameters

None

Return Values

1

The sensor is blocked.

0

The sensor is not blocked.

703-793

A motion control error occurred. After the operator

 

corrects the printer condition, the application must call

 

pclClearError to reset the Motion Control subsystem.

Refer to the MPCL Packet Reference Manual for more information.

4-30Programmer’s Manual

Example

#include <conio.h> #include <stdio.h> #include <string.h> #include "mmsultra.h"

void main(void)

 

{

// Print data structure

PRINTINIT pConfig;

short sStatus = 0;

// Command calls status

char cFormat[100];

// Format to print

sStatus = pclInit(NULL);

// Start Print subsystem

if (sStatus != 0)

 

printf("Init Failed\nError: %d", sStatus);

 

else

 

{

// Check battery

if (!pclBatteryOkToPrint())

printf("Battery too low");

 

else

// Write format

{

strcpy(cFormat, "{F,1,A,R,E,400,200,\"1C39\"|"); strcat(cFormat, "B,1,12,F,320,29,4,12,20,8,L,0|"); strcat(cFormat, "R,1,\"666666666666"); strcat(cFormat, "\"|}");

sStatus = pclWrite(cFormat, strlen(cFormat));

Function Reference 4-31

if (sStatus != 0)

printf("Format Write error - %d", sStatus); else

{ // Start batch sStatus = pclWrite("{B,1,N,1|E,0,0,1,1,0,1|}", 24);

if (sStatus != 0)

printf("Batch Write error - %d", sStatus); else

{

while ((sStatus = pclStatus()) == 1) // Wait until done

;

sStatus = pclGetOnDemandSensor(); // Check sensor

switch (sStatus)

// Display result

{

 

case 0: printf("\nNot blocked"); break;

case 1: printf("\nBlocked"); break;

default: printf("Error--press any key when reset."); _getch();

pclClearError();

}

 

}

 

}

 

}

 

}

// Close Print subsystem

pclClose();

}

4-32Programmer’s Manual

p c l G e t S u p p l y T y p e

Description

Retrieves the current supply type.

Syntax

unsigned short far pclGetSupplyType(void);

Parameters

None

Return Values

MMS_LOW_ENERGY

Paper

MMS_MEDIUM_ENERGY

Fax

MMS_HIGH_ENERGY

Synthetic

703-793

A motion control error occurred. After

 

the operator corrects the printer

 

condition, the application must call

 

pclClearError to reset the Motion

 

Control subsystem. Refer to the

 

MPCL Packet Reference Manualfor

 

more information.

Function Reference 4-33

Example

#include <conio.h> #include <stdio.h> #include "mmsultra.h"

void main(void)

 

{

// Supply type

unsigned short usType = 0;

PRINTINIT pConfig;

// Print data structure

unsigned short usStatus = 0;

// Battery level

short sStatus = 0;

// Command calls status

sStatus = pclInit(NULL);

// Start Print subsystem

if (sStatus != 0)

 

printf("Init Failed\nError: %d", sStatus);

else {

 

usStatus = pclGetBatteryLevel();

// Check battery

if (usStatus <= 711)

printf("Charge your battery");

 

else {

// Get supply type

usType = pclGetSupplyType();

switch (usType) {

// Display result

case MMS_LOW_ENERGY:

 

printf("Using regular paper"); break;

case MMS_MEDIUM_ENERGY:

 

printf("Using fax paper");

 

break;

case MMS_HIGH_ENERGY:

 

printf("Using synthetic paper");

 

break;

default:

printf("Error--press any key when reset.");

 

_getch();

}

pclClearError();

 

}

 

}

// Close Print subsystem

pclClose();

}

4-34Programmer’s Manual