![Two Technologies JETT RFID Скачать руководство пользователя страница 58](http://html1.mh-extra.com/html/two-technologies/jett-rfid/jett-rfid_technical-reference-manual_1184794058.webp)
Generating Audio Tones
The JETT•RFID has a beep driver that you can incorporate into an application for various purposes,
such as notifying an operator that an malfunction occurred or that a process has finished. You can
access the beep driver directly or via Beep.DLL. Parameters that you can define include frequency,
volume and duration (in milliseconds).
Accessing the Beep Driver Directly
The following code snippets (written in eMbedded Visual C++ 4.0) show you how to incorporate beep
driver calls directly into an application
Beep Driver File Structure
The following code shows the file structure used by the beep driver. It also lists the minimum and
maximum allowable values for each parameter.
#ifndef __BEEP_H__
#define __BEEP_H__
typedef struct
{
DWORD dwFrequency;
// Frequency
DWORD dwVolume;
// Volume
DWORD dwDurationMs;
// Beep duration in ms
} BEEP_USER,*PBEEP_USER;
#define FREQUENCY_MIN
56 // Frequency Min
#define FREQUENCY_MAX
20000 // Frequency Max
#define VOLUME_MIN
1 // Normalized Volume Min
#define VOLUME_MAX
100
// Normalized Volume Max
#define DURATIONMS_MIN
0x0
// DurationMs Min
#define DURATIONMS_MAX
10000 // DurationMs Max – 10 secs
BEEP_USER bsBeep;
HANDLE hBEPDevice = NULL;
DWORD dwNumberofBytesRead = 0;
#endif
Creating and Writing to the Beep Driver File
The following code shows how to specify the beep parameters, create a file to store the parameters,
validate that the parameters are within range and then write the values to the file.
If you are generating a series of beeps, you should put a delay of at least one millisecond between each
beep to avoid sound overlap.
bsBeep.dwFrequency = 500;
bsBeep.dwVolume = 20;
bsBeep.dwDurationMs = 1000;
hBEPDevice = CreateFile(L”BEP1:”,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
WriteFile(hBEPDevice,&bsBeep,sizeof(bsBeep),&dwNumberofBytesRead,0);
CloseHandle(hBEPDevice);
Application
Development
5-18