@@ -33,15 +33,6 @@ export enum ThreadPriority {
33
33
PriorityError
34
34
}
35
35
36
- export class CanBridgeInitializationError extends Error {
37
- cause : any ;
38
-
39
- constructor ( cause : any ) {
40
- super ( "Failed to load the CANBridge native addon. This is likely a packaging problem, or perhaps the Visual Studio C++ redistributable package is not installed. See cause field for details." ) ;
41
- this . cause = cause ;
42
- }
43
- }
44
-
45
36
export class CanBridge {
46
37
getDevices : ( ) => Promise < CanDeviceInfo [ ] > ;
47
38
registerDeviceToHAL : ( descriptor :string , messageId :Number , messageMask :number ) => number ;
@@ -67,34 +58,30 @@ export class CanBridge {
67
58
ackHeartbeats : ( ) => void ;
68
59
69
60
constructor ( ) {
70
- try {
71
- const addon = require ( 'node-gyp-build' ) ( path . join ( __dirname , '..' ) ) ;
72
-
73
- this . getDevices = promisify ( addon . getDevices ) ;
74
- this . registerDeviceToHAL = addon . registerDeviceToHAL ;
75
- this . unregisterDeviceFromHAL = promisify ( addon . unregisterDeviceFromHAL ) ;
76
- this . receiveMessage = addon . receiveMessage ;
77
- this . openStreamSession = addon . openStreamSession ;
78
- this . readStreamSession = addon . readStreamSession ;
79
- this . closeStreamSession = addon . closeStreamSession ;
80
- this . getCANDetailStatus = addon . getCANDetailStatus ;
81
- this . sendCANMessage = addon . sendCANMessage ;
82
- this . sendHALMessage = addon . sendHALMessage ;
83
- this . initializeNotifier = addon . initializeNotifier ;
84
- this . waitForNotifierAlarm = promisify ( addon . waitForNotifierAlarm ) ;
85
- this . stopNotifier = addon . stopNotifier ;
86
- this . writeDfuToBin = promisify ( addon . writeDfuToBin ) ;
87
- this . openHALStreamSession = addon . openHALStreamSession ;
88
- this . readHALStreamSession = addon . readHALStreamSession ;
89
- this . closeHALStreamSession = addon . closeHALStreamSession ;
90
- this . setThreadPriority = addon . setThreadPriority ;
91
- this . setSparkMaxHeartbeatData = addon . setSparkMaxHeartbeatData ;
92
- this . startRevCommonHeartbeat = addon . startRevCommonHeartbeat ;
93
- this . ackHeartbeats = addon . ackHeartbeats ;
94
- this . stopHeartbeats = addon . stopHeartbeats ;
95
- } catch ( e : any ) {
96
- throw new CanBridgeInitializationError ( e ) ;
97
- }
61
+ const addon = require ( 'node-gyp-build' ) ( path . join ( __dirname , '..' ) ) ;
62
+
63
+ this . getDevices = promisify ( addon . getDevices ) ;
64
+ this . registerDeviceToHAL = addon . registerDeviceToHAL ;
65
+ this . unregisterDeviceFromHAL = promisify ( addon . unregisterDeviceFromHAL ) ;
66
+ this . receiveMessage = addon . receiveMessage ;
67
+ this . openStreamSession = addon . openStreamSession ;
68
+ this . readStreamSession = addon . readStreamSession ;
69
+ this . closeStreamSession = addon . closeStreamSession ;
70
+ this . getCANDetailStatus = addon . getCANDetailStatus ;
71
+ this . sendCANMessage = addon . sendCANMessage ;
72
+ this . sendHALMessage = addon . sendHALMessage ;
73
+ this . initializeNotifier = addon . initializeNotifier ;
74
+ this . waitForNotifierAlarm = promisify ( addon . waitForNotifierAlarm ) ;
75
+ this . stopNotifier = addon . stopNotifier ;
76
+ this . writeDfuToBin = promisify ( addon . writeDfuToBin ) ;
77
+ this . openHALStreamSession = addon . openHALStreamSession ;
78
+ this . readHALStreamSession = addon . readHALStreamSession ;
79
+ this . closeHALStreamSession = addon . closeHALStreamSession ;
80
+ this . setThreadPriority = addon . setThreadPriority ;
81
+ this . setSparkMaxHeartbeatData = addon . setSparkMaxHeartbeatData ;
82
+ this . startRevCommonHeartbeat = addon . startRevCommonHeartbeat ;
83
+ this . ackHeartbeats = addon . ackHeartbeats ;
84
+ this . stopHeartbeats = addon . stopHeartbeats ;
98
85
}
99
86
}
100
87
0 commit comments