Code

Signaler
Messages postés
5
Date d'inscription
vendredi 7 décembre 2007
Statut
Membre
Dernière intervention
11 décembre 2007
-
Messages postés
860
Date d'inscription
jeudi 4 mars 2004
Statut
Membre
Dernière intervention
19 août 2014
-
Je débute en c# et j'ai du mal à trancrire un code en vc#.. Quelqun aurait il une solution s v p?
Voici le code:

#ifndef

__PULSESTAR_H

#define __PULSESTAR_H
#include

"StdAfx.h"
typedef
unsigned
char uchar;

typedef
unsigned
short ushort;

typedef
unsigned
long ulong;

typedef
struct LANGANDCODEPAGE {                                                                     WORD wLanguage;
                                                                      WORD wCodePage;

                                                                      } LangAndCodePage;

 

typedef

struct {

char internal_id[15];
// read only
char user_info[17];
// read/write
uchar config_data[32];
// read/write
uchar probe_time[20];
// read/write "mm/dd/yyyy hh:mm:ss" format
uchar product_id;
// read only
uchar sw_version;
// read only
uchar hw_version;
// read only
ulong battery_voltage;
// read only
ulong next_event_addr;
// read only
ulong events_since_reset;
// read/write (reset to 0, clears memory)
uchar vib_duration;
// read/write
uchar vib_intensity;
// read/write
uchar rep_read_delay;
// read/write
uchar irda_trigger_count;
// read/write
uchar irda_pause;
// read/write
uchar irda_duration;
// read/write
ulong low_bat_threshold;
// read/write
BOOLEAN irda_short_enable;
// read/write
BOOLEAN data_read_enable;
// read/write
} ConfigStruct;
// The following masks should be used in psWriteConfig() to specify which fields in the ConfigStruct are valid.

#define

USER_INFO_MASK 0x0001

#define CONFIG_DATA_MASK 0x0002

#define REALTIME_CLOCK_MASK 0x0004

#define VIB_DURATION_MASK 0x0008

#define VIB_INTENSITY_MASK 0x0010

#define REP_READ_DELAY_MASK 0x0020

#define IRDA_TRIGGER_COUNT_MASK 0x0040

#define IRDA_PAUSE_MASK 0x0080

#define IRDA_DURATION_MASK 0x0100

#define BAT_THRESHOLD_MASK 0x0200

#define IRDA_SHORT_ENABLE_MASK 0x0400

#define DATA_READ_ENABLE_MASK 0x0800

#define IRDA_LED_FLASH_MASK 0x1000

#define ALL_MASK 0x1FFF
// Events from the probe are downloaded into the following type of struct.

typedef

struct {                           uchar button_id[15];

// 14 chars. plus a NULL.
                           uchar timestamp[20];ulong data_size;
                           uchar * data;                           } DataStruct;

struct

stringdesc {

                                long length;

                               char * string;
                              };
// Possible error values. The error list, g_ErrorText, is defined in "global_data.cpp".

enum

{noErr = 1000,
errMem,

// 1001
errFile,
// 1002
errPort,
// 1003
errSync,
// 1004
errAbort,
// 1005
errBadID,
// 1006
errBadCmd,
// 1007
errNoData,
// 1008
errTimeOut,
// 1009
errBadMode,
// 1010
errDataFail,
// 1011
errSyncFail,
// 1012
errBadValue,
// 1013
errBaudRate,
// 1014
errNoContact,
// 1015
errEndOfData,
// 1016
errNoConfig,
// 1017
errVersion,
// 1018
errBadBatVal,
// 1019
errUnknownType = 1099
};

#ifdef __cplusplus

extern
"C" {

#endif// Prototypes for the core calling routines in this DLL.

long

APIENTRY psOpenPort(ushort,
long, BOOLEAN);

long APIENTRY psClosePort(
void);

long APIENTRY psReadConfig(ConfigStruct *);

long APIENTRY psReadConfigNS(
void);

long APIENTRY psWriteConfig(ConfigStruct *, ulong);

long APIENTRY psReadDataCount(
void);

long APIENTRY psReadData(DataStruct *,
long);

long APIENTRY psReadDataNS(
long);

long APIENTRY psClearData(
void);

long APIENTRY psWakeProbe(
char *,
long);

long APIENTRY psKeepProbeAwake(
void);

long APIENTRY psSleepProbe(
long);
// Prototypes for psReadConfig() convenience routines

long

APIENTRY psGetCfgFactoryID(
char *);

long APIENTRY psGetCfgProbeTime(
char *);

long APIENTRY psGetCfgUserInfo(
char *);

char APIENTRY psGetCfgProductID(
void);

long APIENTRY psGetCfgSWVer(
void);

long APIENTRY psGetCfgHWVer(
void);

long APIENTRY psGetCfgVoltage(
void);

long APIENTRY psGetCfgEventCount(
void);

long APIENTRY psGetCfgVibDur(
void);

long APIENTRY psGetCfgVibInt(
void);

long APIENTRY psGetCfgRepReadDelay(
void);

long APIENTRY psGetCfgIrDATriggerCount(
void);

long APIENTRY psGetCfgIrDAPause(
void);

long APIENTRY psGetCfgIrDADur(
void);

long APIENTRY psGetCfgBatThreshold(
void);
BOOLEAN APIENTRY psGetCfgIrDAShortEnabled(
void);
BOOLEAN APIENTRY psGetCfgDataReadEnabled(
void);

long APIENTRY psGetCfgCalibrate(
void);
// Prototypes for psWriteConfig() convenience routines

long

APIENTRY psSetCfgUserInfo(
char *);

long APIENTRY psSetCfgProbeTime(
void);

long APIENTRY psSetCfgVibDur(
long);

long APIENTRY psSetCfgVibInt(
long);

long APIENTRY psSetCfgRepReadDelay(
long);

long APIENTRY psSetCfgIrDATriggerCount(
long);

long APIENTRY psSetCfgIrDAPause(
long);

long APIENTRY psSetCfgIrDADur(
long);

long APIENTRY psSetCfgBatThreshold(
short);

long APIENTRY psSetCfgBatLowBit(BOOLEAN);

long APIENTRY psSetCfgIrDAShortEnabled(BOOLEAN);

long APIENTRY psSetCfgDataReadEnabled(BOOLEAN);
// Prototypes for psReadData() convenience routines

enum

{noData = 0,
dataRaw,
dataHex

            };

long

APIENTRY psReadOneDatum(
void);

long APIENTRY psGetBtnID(
char *);

long APIENTRY psGetBtnTimestamp(
char *);

long APIENTRY psGetBtnDataLen(
void);

long APIENTRY psGetBtnDataCount(
void);

long APIENTRY psGetBtnData(
char *);
// Prototypes for misc. support routines

long

APIENTRY psDumpMemory(
char *);

long APIENTRY psGetLastError(
void);
BOOL APIENTRY psPrintableStr(
char *,
long);

long APIENTRY psGetDLLVersion(
char *);
// Prototype for user-supplied progress/interrupt callback function

typedef

BOOL CALLBACK PsProgressFn_t(ulong PercentageComplete);
// Returns TRUE if continue, else returns FALSE if interrupt now.

BOOL APIENTRY psSetProgressFn(PsProgressFn_t * userProgressFn);

// Returns TRUE if fn. set successfully, else returns FALSE.

// Prototypes for debug support.

void

APIENTRY db_psResetProbe(
void);

long APIENTRY db_psWriteConfig(
long);

long APIENTRY db_psReadData(
long);

long APIENTRY db_psLogEntry(
char *);

void APIENTRY db_psRestartDebugLog(
void);

#ifdef __cplusplus
}
// extern "C"#endif
#endif

1 réponse

Messages postés
860
Date d'inscription
jeudi 4 mars 2004
Statut
Membre
Dernière intervention
19 août 2014
25
Bonjour,

Pour ce faire, il suffit de prendre un bon cours de C# :
- http://tahe.developpez.com/dotnet/csharp/
- http://rmdiscala.developpez.com/cours/livres/LivreBases.html#csharp
Et convertir tout ceci par toi même.

Ca devrait pas être assez simple pour la conversion des structures, classes, variables et constantes...

Mais il n'existe personne et aucun logiciel (du moins à ma connaissance) qui puisse le faire pour toi.