equal
deleted
inserted
replaced
47 // ---------------------------------------------------------------------------- |
47 // ---------------------------------------------------------------------------- |
48 // |
48 // |
49 Device::Device( ExecState* exec ) |
49 Device::Device( ExecState* exec ) |
50 : JSObject() |
50 : JSObject() |
51 { |
51 { |
52 m_privateData = new DevicePrivate(this); |
52 m_valid = EFalse; |
53 if (!m_privateData || !m_privateData->m_deviceBinding ) |
53 TRAP_IGNORE( |
54 m_valid = EFalse; |
54 m_deviceBinding = CDeviceLiwBinding::NewL(); |
55 else |
55 ) |
56 m_valid = ETrue; |
56 if (m_deviceBinding) |
57 } |
57 { |
58 |
58 m_privateData = new DevicePrivate(this); |
|
59 if (m_privateData) |
|
60 m_valid = ETrue; |
|
61 } |
|
62 } |
59 |
63 |
60 // ---------------------------------------------------------------------------- |
64 // ---------------------------------------------------------------------------- |
61 // Device::SetUid |
65 // Device::SetUid |
62 // |
66 // |
63 // ---------------------------------------------------------------------------- |
67 // ---------------------------------------------------------------------------- |
64 // |
68 // |
65 void Device::SetUid( const TUint& aValue) |
69 void Device::SetUid( const TUint& aValue) |
66 { |
70 { |
67 if(m_privateData) |
71 if(m_deviceBinding) |
68 m_privateData->SetUid( aValue); |
72 m_deviceBinding->SetUid( aValue); |
69 } |
73 } |
70 |
74 |
71 // ---------------------------------------------------------------------------- |
75 // ---------------------------------------------------------------------------- |
72 // Device::Close |
76 // Device::Close |
73 // |
77 // |
79 return; |
83 return; |
80 |
84 |
81 m_valid = EFalse; |
85 m_valid = EFalse; |
82 delete m_privateData; |
86 delete m_privateData; |
83 m_privateData = NULL; |
87 m_privateData = NULL; |
|
88 delete m_deviceBinding; |
|
89 m_deviceBinding = NULL; |
84 } |
90 } |
85 |
91 |
86 |
92 |
87 // ---------------------------------------------------------------------------- |
93 // ---------------------------------------------------------------------------- |
88 // Device::~Device |
94 // Device::~Device |
139 |
145 |
140 switch( token ) |
146 switch( token ) |
141 { |
147 { |
142 case getServiceObject: |
148 case getServiceObject: |
143 case listProviders: |
149 case listProviders: |
144 return new DeviceFunc( exec, m_privateData->m_deviceBinding, token ); |
150 return new DeviceFunc( exec, m_deviceBinding, token ); |
145 |
151 |
146 default: |
152 default: |
147 return throwError(exec, GeneralError); |
153 return throwError(exec, GeneralError); |
148 } |
154 } |
149 } |
155 } |
220 // DevicePrivate constructor |
226 // DevicePrivate constructor |
221 // |
227 // |
222 // --------------------------------------------------------------------------- |
228 // --------------------------------------------------------------------------- |
223 DevicePrivate::DevicePrivate( Device* jsobj ) |
229 DevicePrivate::DevicePrivate( Device* jsobj ) |
224 { |
230 { |
225 m_deviceBinding = NULL; |
231 m_jsobj = jsobj; |
226 TRAP_IGNORE( |
232 m_exec = NULL; |
227 m_deviceBinding = CDeviceLiwBinding::NewL(); |
|
228 m_jsobj = jsobj; |
|
229 m_exec = NULL;) |
|
230 } |
233 } |
231 |
234 |
232 // --------------------------------------------------------------------------- |
235 // --------------------------------------------------------------------------- |
233 // DevicePrivate destructor |
236 // DevicePrivate destructor |
234 // |
237 // |
236 DevicePrivate::~DevicePrivate() |
239 DevicePrivate::~DevicePrivate() |
237 { |
240 { |
238 // invalid the Device |
241 // invalid the Device |
239 if (m_jsobj) |
242 if (m_jsobj) |
240 m_jsobj->m_valid = EFalse; |
243 m_jsobj->m_valid = EFalse; |
241 |
|
242 delete m_deviceBinding; |
|
243 m_deviceBinding = NULL; |
|
244 } |
|
245 |
|
246 // --------------------------------------------------------------------------- |
|
247 // DevicePrivate SetUid |
|
248 // |
|
249 // --------------------------------------------------------------------------- |
|
250 void DevicePrivate::SetUid( const TUint& aValue) |
|
251 { |
|
252 if(m_deviceBinding) |
|
253 m_deviceBinding->SetUid( aValue); |
|
254 } |
244 } |
255 |
245 |
256 // ---------------------------------------------------------------------------- |
246 // ---------------------------------------------------------------------------- |
257 // DeviceFunc::DeviceFunc |
247 // DeviceFunc::DeviceFunc |
258 // |
248 // |
336 return ret; |
326 return ret; |
337 } |
327 } |
338 |
328 |
339 MDeviceBinding* Device::GetDeviceBinding() |
329 MDeviceBinding* Device::GetDeviceBinding() |
340 { |
330 { |
341 return m_privateData->m_deviceBinding; |
331 return m_deviceBinding; |
342 } |
332 } |
343 |
333 |
344 //END OF FILE |
334 //END OF FILE |
345 |
335 |
346 |
336 |