File tree Expand file tree Collapse file tree 5 files changed +324
-203
lines changed Expand file tree Collapse file tree 5 files changed +324
-203
lines changed Original file line number Diff line number Diff line change @@ -379,6 +379,26 @@ int systemBus::op_cpm(std::vector<uint8_t> *q)
379379
380380int systemBus::op_net (std::vector<uint8_t > *q)
381381{
382+ int result = 0 ;
383+ int expectedResult = 1 ;
384+
385+ if (q->size () >= expectedResult) {
386+ int device_id = q->at (0 );
387+
388+ // If device doesn't exist, create it.
389+ if (!_netDev.contains (device_id))
390+ {
391+ Debug_printf (" Opening new network device %u\n " ,device_id);
392+ _netDev[device_id] = new drivewireNetwork (this );
393+ }
394+
395+ Debug_printv (" OP_NET" );
396+ Debug_printf (" device = %d\n " , device_id);
397+ result = _netDev[device_id]->process (q);
398+ }
399+
400+ return result;
401+ #if 0
382402 int result = 1;
383403
384404 // Get device ID
@@ -397,6 +417,7 @@ int systemBus::op_net(std::vector<uint8_t> *q)
397417 Debug_printf("OP_NET: %u\n", device_id);
398418
399419 return result;
420+ #endif
400421}
401422
402423int systemBus::op_unhandled (std::vector<uint8_t > *q)
@@ -876,6 +897,7 @@ int systemBus::_drivewire_process_cmd(std::vector<uint8_t> *q)
876897 dwStateMethod = &systemBus::op_fuji;
877898 break ;
878899 case OP_NET:
900+ q->erase (q->begin ()); // lob off OP_NET so parsing in network.cpp can go smoothly
879901 dwStateMethod = &systemBus::op_net;
880902 break ;
881903 case OP_CPM:
Original file line number Diff line number Diff line change @@ -194,6 +194,7 @@ class systemBus
194194{
195195public:
196196 int (drivewireFuji::*fnStateMethod)(std::vector<uint8_t > *);
197+ int (drivewireNetwork::*nwStateMethod)(std::vector<uint8_t > *);
197198 void resetState (void );
198199
199200private:
Original file line number Diff line number Diff line change 3030drivewireFuji theFuji; // global fuji device object
3131
3232// drivewireDisk drivewireDiskDevs[MAX_HOSTS];
33- drivewireNetwork drivewireNetDevs[MAX_NETWORK_DEVICES];
33+ // drivewireNetwork drivewireNetDevs[MAX_NETWORK_DEVICES];
3434
3535bool _validate_host_slot (uint8_t slot, const char *dmsg = nullptr );
3636bool _validate_device_slot (uint8_t slot, const char *dmsg = nullptr );
You can’t perform that action at this time.
0 commit comments